コード例 #1
0
ファイル: InvoiceLine.php プロジェクト: occitech/invoices
 /**
  * Constructor
  *
  * @param mixed $id Set this ID for this model on startup, can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  * @return void
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     $this->validate = array('product_model' => array('notempty' => array('rule' => array('notempty'), 'message' => __d('invoices', 'Please enter a product Model Class', true), 'allowEmpty' => false, 'required' => true, 'last' => false), 'maxlength' => array('rule' => array('maxlength', 100), 'message' => __d('invoices', 'The product Model Class should not exceed 100 characters', true))), 'product_id' => array('notempty' => array('rule' => array('notempty'), 'message' => __d('invoices', 'Please enter a product id', true), 'allowEmpty' => false, 'required' => true)), 'product_name' => array('notempty' => array('rule' => array('notempty'), 'message' => __d('invoices', 'Please enter a product name', true), 'allowEmpty' => false, 'required' => true)), 'excl_tax_price' => array('numeric' => array('rule' => array('numeric'), 'message' => __d('invoices', 'Please a decimal value for ecl. tax price', true), 'allowEmpty' => false, 'required' => true)), 'tva_price' => array('numeric' => array('rule' => array('numeric'), 'message' => __d('invoices', 'Please enter a decimal value for tva price', true), 'allowEmpty' => false, 'required' => true)), 'tva_rate' => array('numeric' => array('rule' => array('numeric'), 'message' => __d('invoices', 'Please enter a decimal value for tva rate', true), 'allowEmpty' => false, 'required' => true)));
     parent::__construct($id, $table, $ds);
 }
コード例 #2
0
ファイル: InvoiceSetting.php プロジェクト: occitech/invoices
 /**
  * Constructor
  *
  * @param mixed $id Set this ID for this model on startup, can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  * @return void
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     $this->validate = array('name' => array('notempty' => array('rule' => array('notempty'), 'message' => __d('invoices', 'Please, write a name.'), 'allowEmpty' => false, 'required' => true)), 'value' => array('notempty' => array('rule' => array('notempty'), 'message' => __d('invoices', 'Please, write a value.'), 'allowEmpty' => false, 'required' => true)), 'tag' => array('notempty' => array('rule' => array('notempty'), 'message' => __d('invoices', 'Please, write a tag.'), 'allowEmpty' => false, 'required' => true, 'last' => false), 'isUnique' => array('rule' => array('isUnique'), 'message' => __d('invoices', 'The tag must be unique.'))));
     parent::__construct($id, $table, $ds);
 }
コード例 #3
0
ファイル: Invoice.php プロジェクト: occitech/invoices
    /**
     * Constructor
     *
     * @param mixed $id Set this ID for this model on startup, can also be an array of options, see above.
     * @param string $table Name of database table to use.
     * @param string $ds DataSource connection name.
     * @return void
     */
    public function __construct($id = false, $table = null, $ds = null)
    {
        $userClass = Configure::read('Invoices.UserClass');
        $this->__idIsNumber = Configure::read('Invoices.idIsNumber');
        if (is_null($this->__idIsNumber)) {
            $this->__idIsNumber = true;
        }
        $maxLengthRule = create_function('$limit', <<<FUNC
\t\t\treturn array('maxLength' => array(
\t\t\t\t'rule' => array('maxLength', \$limit),
\t\t\t\t'message' => sprintf(__d('invoices', 'The field must not exceed %s characters', true), \$limit),
\t\t\t\t'allowEmpty' => true,
\t\t\t\t'required' => false,
\t\t\t\t'last' => false,
\t\t\t));
FUNC
);
        $this->validate = array('prefix' => $maxLengthRule(10), 'payment_type' => $maxLengthRule(20), 'payment_ref' => $maxLengthRule(100));
        $this->belongsTo = array('Client' => array('className' => $userClass, 'foreignKey' => 'client_id'));
        parent::__construct($id, $table, $ds);
        $this->_setInvoiceNumberGenerator(Configure::read('Invoice.invoiceNumberGenerator'));
    }