BUG 10957 "Feature request - Limit input document..." SOLVED

- Feature request - Limit input document maximum size
- Problema resuelto, al crear un nuevo Input Document se ha adicionado un nuevo campo "Maximum file size" y un dropdown
  que determina la unidad de medida en "KB y MB", esto permite definir el limite del tamañel archivo a anexar.
  Cuando se ejectua el caso al hacer click en "Attach", se muestra el tamañaximo que se puede adjuntar el archivo si es
  mayor	al limite se mostrara un mensaje; asi tambien si se tiene un file asocioado a un input document al igual que lo
  anterior se mostrara un mensaje.
This commit is contained in:
Luis Fernando Saisa Lopez
2014-09-15 12:09:31 -04:00
parent 12692ca8aa
commit 42f06bce9f
21 changed files with 414 additions and 71 deletions

View File

@@ -83,6 +83,10 @@ class InputDocumentMapBuilder
$tMap->addColumn('INP_DOC_TYPE_FILE', 'InpDocTypeFile', 'string', CreoleTypes::VARCHAR, false, 200);
$tMap->addColumn('INP_DOC_MAX_FILESIZE', 'InpDocMaxFilesize', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('INP_DOC_MAX_FILESIZE_UNIT', 'InpDocMaxFilesizeUnit', 'string', CreoleTypes::VARCHAR, true, 2);
$tMap->addValidator('INP_DOC_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Input Document UID can be no larger than 32 in size');
$tMap->addValidator('INP_DOC_UID', 'required', 'propel.validator.RequiredValidator', '', 'Input Document UID is required.');

View File

@@ -81,6 +81,18 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
*/
protected $inp_doc_type_file = '*.*';
/**
* The value for the inp_doc_max_filesize field.
* @var int
*/
protected $inp_doc_max_filesize = 0;
/**
* The value for the inp_doc_max_filesize_unit field.
* @var string
*/
protected $inp_doc_max_filesize_unit = 'KB';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -194,6 +206,28 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
return $this->inp_doc_type_file;
}
/**
* Get the [inp_doc_max_filesize] column value.
*
* @return int
*/
public function getInpDocMaxFilesize()
{
return $this->inp_doc_max_filesize;
}
/**
* Get the [inp_doc_max_filesize_unit] column value.
*
* @return string
*/
public function getInpDocMaxFilesizeUnit()
{
return $this->inp_doc_max_filesize_unit;
}
/**
* Set the value of [inp_doc_uid] column.
*
@@ -392,6 +426,50 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
} // setInpDocTypeFile()
/**
* Set the value of [inp_doc_max_filesize] column.
*
* @param int $v new value
* @return void
*/
public function setInpDocMaxFilesize($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->inp_doc_max_filesize !== $v || $v === 0) {
$this->inp_doc_max_filesize = $v;
$this->modifiedColumns[] = InputDocumentPeer::INP_DOC_MAX_FILESIZE;
}
} // setInpDocMaxFilesize()
/**
* Set the value of [inp_doc_max_filesize_unit] column.
*
* @param string $v new value
* @return void
*/
public function setInpDocMaxFilesizeUnit($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->inp_doc_max_filesize_unit !== $v || $v === 'KB') {
$this->inp_doc_max_filesize_unit = $v;
$this->modifiedColumns[] = InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT;
}
} // setInpDocMaxFilesizeUnit()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -427,12 +505,16 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$this->inp_doc_type_file = $rs->getString($startcol + 8);
$this->inp_doc_max_filesize = $rs->getInt($startcol + 9);
$this->inp_doc_max_filesize_unit = $rs->getString($startcol + 10);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 9; // 9 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 11; // 11 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating InputDocument object", $e);
@@ -663,6 +745,12 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
case 8:
return $this->getInpDocTypeFile();
break;
case 9:
return $this->getInpDocMaxFilesize();
break;
case 10:
return $this->getInpDocMaxFilesizeUnit();
break;
default:
return null;
break;
@@ -692,6 +780,8 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$keys[6] => $this->getInpDocDestinationPath(),
$keys[7] => $this->getInpDocTags(),
$keys[8] => $this->getInpDocTypeFile(),
$keys[9] => $this->getInpDocMaxFilesize(),
$keys[10] => $this->getInpDocMaxFilesizeUnit(),
);
return $result;
}
@@ -750,6 +840,12 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
case 8:
$this->setInpDocTypeFile($value);
break;
case 9:
$this->setInpDocMaxFilesize($value);
break;
case 10:
$this->setInpDocMaxFilesizeUnit($value);
break;
} // switch()
}
@@ -809,6 +905,14 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$this->setInpDocTypeFile($arr[$keys[8]]);
}
if (array_key_exists($keys[9], $arr)) {
$this->setInpDocMaxFilesize($arr[$keys[9]]);
}
if (array_key_exists($keys[10], $arr)) {
$this->setInpDocMaxFilesizeUnit($arr[$keys[10]]);
}
}
/**
@@ -856,6 +960,14 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $this->inp_doc_type_file);
}
if ($this->isColumnModified(InputDocumentPeer::INP_DOC_MAX_FILESIZE)) {
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE, $this->inp_doc_max_filesize);
}
if ($this->isColumnModified(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT)) {
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, $this->inp_doc_max_filesize_unit);
}
return $criteria;
}
@@ -926,6 +1038,10 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$copyObj->setInpDocTypeFile($this->inp_doc_type_file);
$copyObj->setInpDocMaxFilesize($this->inp_doc_max_filesize);
$copyObj->setInpDocMaxFilesizeUnit($this->inp_doc_max_filesize_unit);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseInputDocumentPeer
const CLASS_DEFAULT = 'classes.model.InputDocument';
/** The total number of columns. */
const NUM_COLUMNS = 9;
const NUM_COLUMNS = 11;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -58,6 +58,12 @@ abstract class BaseInputDocumentPeer
/** the column name for the INP_DOC_TYPE_FILE field */
const INP_DOC_TYPE_FILE = 'INPUT_DOCUMENT.INP_DOC_TYPE_FILE';
/** the column name for the INP_DOC_MAX_FILESIZE field */
const INP_DOC_MAX_FILESIZE = 'INPUT_DOCUMENT.INP_DOC_MAX_FILESIZE';
/** the column name for the INP_DOC_MAX_FILESIZE_UNIT field */
const INP_DOC_MAX_FILESIZE_UNIT = 'INPUT_DOCUMENT.INP_DOC_MAX_FILESIZE_UNIT';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -69,10 +75,10 @@ abstract class BaseInputDocumentPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('InpDocUid', 'ProUid', 'InpDocFormNeeded', 'InpDocOriginal', 'InpDocPublished', 'InpDocVersioning', 'InpDocDestinationPath', 'InpDocTags', 'InpDocTypeFile', ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID, InputDocumentPeer::PRO_UID, InputDocumentPeer::INP_DOC_FORM_NEEDED, InputDocumentPeer::INP_DOC_ORIGINAL, InputDocumentPeer::INP_DOC_PUBLISHED, InputDocumentPeer::INP_DOC_VERSIONING, InputDocumentPeer::INP_DOC_DESTINATION_PATH, InputDocumentPeer::INP_DOC_TAGS, InputDocumentPeer::INP_DOC_TYPE_FILE, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID', 'PRO_UID', 'INP_DOC_FORM_NEEDED', 'INP_DOC_ORIGINAL', 'INP_DOC_PUBLISHED', 'INP_DOC_VERSIONING', 'INP_DOC_DESTINATION_PATH', 'INP_DOC_TAGS', 'INP_DOC_TYPE_FILE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
BasePeer::TYPE_PHPNAME => array ('InpDocUid', 'ProUid', 'InpDocFormNeeded', 'InpDocOriginal', 'InpDocPublished', 'InpDocVersioning', 'InpDocDestinationPath', 'InpDocTags', 'InpDocTypeFile', 'InpDocMaxFilesize', 'InpDocMaxFilesizeUnit', ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID, InputDocumentPeer::PRO_UID, InputDocumentPeer::INP_DOC_FORM_NEEDED, InputDocumentPeer::INP_DOC_ORIGINAL, InputDocumentPeer::INP_DOC_PUBLISHED, InputDocumentPeer::INP_DOC_VERSIONING, InputDocumentPeer::INP_DOC_DESTINATION_PATH, InputDocumentPeer::INP_DOC_TAGS, InputDocumentPeer::INP_DOC_TYPE_FILE, InputDocumentPeer::INP_DOC_MAX_FILESIZE, InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID', 'PRO_UID', 'INP_DOC_FORM_NEEDED', 'INP_DOC_ORIGINAL', 'INP_DOC_PUBLISHED', 'INP_DOC_VERSIONING', 'INP_DOC_DESTINATION_PATH', 'INP_DOC_TAGS', 'INP_DOC_TYPE_FILE', 'INP_DOC_MAX_FILESIZE', 'INP_DOC_MAX_FILESIZE_UNIT', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -82,10 +88,10 @@ abstract class BaseInputDocumentPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('InpDocUid' => 0, 'ProUid' => 1, 'InpDocFormNeeded' => 2, 'InpDocOriginal' => 3, 'InpDocPublished' => 4, 'InpDocVersioning' => 5, 'InpDocDestinationPath' => 6, 'InpDocTags' => 7, 'InpDocTypeFile' => 8, ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID => 0, InputDocumentPeer::PRO_UID => 1, InputDocumentPeer::INP_DOC_FORM_NEEDED => 2, InputDocumentPeer::INP_DOC_ORIGINAL => 3, InputDocumentPeer::INP_DOC_PUBLISHED => 4, InputDocumentPeer::INP_DOC_VERSIONING => 5, InputDocumentPeer::INP_DOC_DESTINATION_PATH => 6, InputDocumentPeer::INP_DOC_TAGS => 7, InputDocumentPeer::INP_DOC_TYPE_FILE => 8, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID' => 0, 'PRO_UID' => 1, 'INP_DOC_FORM_NEEDED' => 2, 'INP_DOC_ORIGINAL' => 3, 'INP_DOC_PUBLISHED' => 4, 'INP_DOC_VERSIONING' => 5, 'INP_DOC_DESTINATION_PATH' => 6, 'INP_DOC_TAGS' => 7, 'INP_DOC_TYPE_FILE' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
BasePeer::TYPE_PHPNAME => array ('InpDocUid' => 0, 'ProUid' => 1, 'InpDocFormNeeded' => 2, 'InpDocOriginal' => 3, 'InpDocPublished' => 4, 'InpDocVersioning' => 5, 'InpDocDestinationPath' => 6, 'InpDocTags' => 7, 'InpDocTypeFile' => 8, 'InpDocMaxFilesize' => 9, 'InpDocMaxFilesizeUnit' => 10, ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID => 0, InputDocumentPeer::PRO_UID => 1, InputDocumentPeer::INP_DOC_FORM_NEEDED => 2, InputDocumentPeer::INP_DOC_ORIGINAL => 3, InputDocumentPeer::INP_DOC_PUBLISHED => 4, InputDocumentPeer::INP_DOC_VERSIONING => 5, InputDocumentPeer::INP_DOC_DESTINATION_PATH => 6, InputDocumentPeer::INP_DOC_TAGS => 7, InputDocumentPeer::INP_DOC_TYPE_FILE => 8, InputDocumentPeer::INP_DOC_MAX_FILESIZE => 9, InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT => 10, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID' => 0, 'PRO_UID' => 1, 'INP_DOC_FORM_NEEDED' => 2, 'INP_DOC_ORIGINAL' => 3, 'INP_DOC_PUBLISHED' => 4, 'INP_DOC_VERSIONING' => 5, 'INP_DOC_DESTINATION_PATH' => 6, 'INP_DOC_TAGS' => 7, 'INP_DOC_TYPE_FILE' => 8, 'INP_DOC_MAX_FILESIZE' => 9, 'INP_DOC_MAX_FILESIZE_UNIT' => 10, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -204,6 +210,10 @@ abstract class BaseInputDocumentPeer
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_TYPE_FILE);
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_MAX_FILESIZE);
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT);
}
const COUNT = 'COUNT(INPUT_DOCUMENT.INP_DOC_UID)';