--- /tmp/dsg/dolibarr/htdocs/compta/cashcontrol/class/github_19.0.3_cashcontrol.class.php +++ /tmp/dsg/dolibarr/htdocs/compta/cashcontrol/class/client_cashcontrol.class.php @@ -22 +22 @@ - * \file htdocs/compta/cashcontrol/class/cashcontrol.class.php + * \file cashcontrol/class/cashcontrol.class.php @@ -57,25 +57 @@ - /** - * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') - * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" - * 'label' the translation key. - * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) - * 'position' is the sort order of field. - * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). - * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) - * 'noteditable' says if field is not editable (1 or 0) - * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. - * 'index' if we want an index in database. - * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). - * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. - * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). - * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200' - * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. - * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") - * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. - * 'comment' is not used. You can store here any text of your choice. It is not used by application. - * - * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. - */ + @@ -83 +59 @@ - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10), + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10), @@ -89,6 +65,6 @@ - 'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'csslist'=>'amount'), - 'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'csslist'=>'amount'), - 'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'csslist'=>'amount'), - 'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36, 'csslist'=>'amount'), - 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'), - 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'), + 'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25), + 'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30), + 'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33), + 'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36), + 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'), + 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'), @@ -95,0 +72 @@ + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>490), @@ -97 +73,0 @@ - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502), @@ -99,4 +75,2 @@ - 'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600), - 'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated')), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')), @@ -105,3 +78,0 @@ - /** - * @var int Object Id - */ @@ -109 +79,0 @@ - public $label; @@ -122,2 +92,7 @@ - * @var integer|string date_creation - */ + * @var integer|string $date_valid + */ + public $date_valid; + + /** + * @var integer|string date_creation + */ @@ -125 +99,0 @@ - public $fk_user_creat; @@ -131,12 +104,0 @@ - /** - * @var integer|string $date_modification - * @deprecated - */ - public $tms; - - /** - * @var integer|string $date_valid - */ - public $date_valid; - public $fk_user_valid; - @@ -165 +127 @@ - * @return int Return integer <0 if KO, Id of created object if OK + * @return int <0 if KO, Id of created object if OK @@ -174,9 +136,3 @@ - if (empty($this->cash)) { - $this->cash = 0; - } - if (empty($this->cheque)) { - $this->cheque = 0; - } - if (empty($this->card)) { - $this->card = 0; - } + if (empty($this->cash)) $this->cash = 0; + if (empty($this->cheque)) $this->cheque = 0; + if (empty($this->card)) $this->card = 0; @@ -201,2 +157,2 @@ - $sql .= ((int) $conf->entity); - $sql .= ", ".(is_numeric($this->opening) ? price2num($this->opening, 'MT') : 0); + $sql .= $conf->entity; + $sql .= ", ".(is_numeric($this->opening) ? $this->opening : 0); @@ -209,4 +165,4 @@ - $sql .= ", ".((int) $this->year_close); - $sql .= ", ".price2num($this->cash, 'MT'); - $sql .= ", ".price2num($this->cheque, 'MT'); - $sql .= ", ".price2num($this->card, 'MT'); + $sql .= ", ".$this->year_close; + $sql .= ", ".$this->cash; + $sql .= ", ".$this->cheque; + $sql .= ", ".$this->card; @@ -227 +183 @@ - $sql = 'UPDATE '.MAIN_DB_PREFIX.'pos_cash_fence SET ref = rowid where rowid = '.((int) $this->id); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'pos_cash_fence SET ref = rowid where rowid = '.$this->id; @@ -250 +206 @@ - * @return int Return integer <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK @@ -260 +216,2 @@ - if ($this->status == self::STATUS_VALIDATED) { + if ($this->status == self::STATUS_VALIDATED) + { @@ -267 +224 @@ - if (!empty($user->rights->$posmodule->use)) + if (! empty($user->rights->$posmodule->use)) @@ -282 +239 @@ - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " WHERE rowid=".$this->id; @@ -299 +256,2 @@ - if (!$error && !$notrigger) { + if (!$error && !$notrigger) + { @@ -302,3 +260 @@ - if ($result < 0) { - $error++; - } + if ($result < 0) $error++; @@ -328 +284 @@ - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @return int <0 if KO, 0 if not found, >0 if OK @@ -333 +289 @@ - //if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); + if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); @@ -342 +298 @@ - * @return int Return integer <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK @@ -354 +310 @@ - * @return int Return integer <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK @@ -358,2 +314,2 @@ - return $this->deleteCommon($user, $notrigger); - //return $this->deleteCommon($user, $notrigger, 1); + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); @@ -384 +340,2 @@ - if (empty($this->labelStatus) || empty($this->labelStatusShort)) { + if (empty($this->labelStatus) || empty($this->labelStatusShort)) + { @@ -387,4 +344,4 @@ - $this->labelStatus[0] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatus[1] = $langs->transnoentitiesnoconv('Closed'); - $this->labelStatusShort[0] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatusShort[1] = $langs->transnoentitiesnoconv('Closed'); + $this->labelStatus[0] = $langs->trans('Draft'); + $this->labelStatus[1] = $langs->trans('Closed'); + $this->labelStatusShort[0] = $langs->trans('Draft'); + $this->labelStatusShort[1] = $langs->trans('Closed'); @@ -394,3 +351 @@ - if ($status == self::STATUS_VALIDATED) { - $statusType = 'status6'; - } + if ($status == self::STATUS_VALIDATED) $statusType = 'status6'; @@ -405,4 +360,4 @@ - * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking @@ -415,3 +370 @@ - if (!empty($conf->dol_no_mouse_hover)) { - $notooltip = 1; // Force disable tooltips - } + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips @@ -423 +376 @@ - $label = ''.$langs->trans("CashControl").''; + $label = ''.$langs->trans("CashFence").''; @@ -429,9 +382,6 @@ - if ($option != 'nolink') { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { - $add_save_lastsearch_values = 1; - } - if ($add_save_lastsearch_values) { - $url .= '&save_lastsearch_values=1'; - } + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; @@ -441,10 +391,18 @@ - if (empty($notooltip)) { - if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $label = $langs->trans("ShowMyObject"); - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); - } + if (empty($notooltip)) + { + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label = $langs->trans("ShowMyObject"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + + /* + $hookmanager->initHooks(array('myobjectdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); @@ -457,6 +415,2 @@ - if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - } - if ($withpicto != 2) { - $result .= $this->ref; - } + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; @@ -468 +422 @@ - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); @@ -470,4 +424,2 @@ - if ($reshook > 0) { - $result = $hookmanager->resPrint; - } else { - $result .= $hookmanager->resPrint; + if ($reshook > 0) { $result = $hookmanager->resPrint; + } else { $result .= $hookmanager->resPrint; @@ -478,39 +429,0 @@ - - /** - * Return clicable link of object (with eventually picto) - * - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data - * @return string HTML Code for Kanban thumb. - */ - public function getKanbanView($option = '', $arraydata = null) - { - global $langs; - - $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); - - $return = '