diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 0bb16b3cbd6..ab67974c920 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -154,8 +154,10 @@ if ($action == 'update') //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9325b38cfb3..65fd69a9a8b 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -905,8 +905,8 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res = $this->db->query($sql); - if ($res < 0) { - $this->error = $this->db->lasterror(); + if (!$res) { + $this->error=$this->db->lasterror(); $error++; } @@ -916,8 +916,8 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res = $this->db->query($sql); - if ($res < 0) { - $this->error = $this->db->lasterror(); + if (!$res) { + $this->error=$this->db->lasterror(); $error++; } } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cba83d8f015..d8b4424661a 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -214,6 +214,76 @@ class Account extends CommonObject */ public $date_solde; + + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', '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. + * 'enabled' is a condition when the field must be managed. + * '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' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * '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. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * '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. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), + 'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1), + 'bank' =>array('type'=>'varchar(60)', 'label'=>'Bank', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + 'code_banque' =>array('type'=>'varchar(128)', 'label'=>'Code banque', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'code_guichet' =>array('type'=>'varchar(6)', 'label'=>'Code guichet', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'number' =>array('type'=>'varchar(255)', 'label'=>'Number', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'cle_rib' =>array('type'=>'varchar(5)', 'label'=>'Cle rib', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'bic' =>array('type'=>'varchar(11)', 'label'=>'Bic', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'iban_prefix' =>array('type'=>'varchar(34)', 'label'=>'Iban prefix', 'enabled'=>1, 'visible'=>-1, 'position'=>70), + 'country_iban' =>array('type'=>'varchar(2)', 'label'=>'Country iban', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'cle_iban' =>array('type'=>'varchar(2)', 'label'=>'Cle iban', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'domiciliation' =>array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'state_id' =>array('type'=>'integer', 'label'=>'State id', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95), + 'proprio' =>array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'owner_address' =>array('type'=>'text', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'courant' =>array('type'=>'smallint(6)', 'label'=>'Courant', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>110), + 'clos' =>array('type'=>'smallint(6)', 'label'=>'Clos', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>115), + 'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120), + 'url' =>array('type'=>'varchar(128)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>125), + 'account_number' =>array('type'=>'varchar(32)', 'label'=>'Account number', 'enabled'=>1, 'visible'=>-1, 'position'=>130), + 'accountancy_journal' =>array('type'=>'varchar(20)', 'label'=>'Accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>135), + 'currency_code' =>array('type'=>'varchar(3)', 'label'=>'Currency code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>140), + 'min_allowed' =>array('type'=>'integer', 'label'=>'Min allowed', 'enabled'=>1, 'visible'=>-1, 'position'=>145), + 'min_desired' =>array('type'=>'integer', 'label'=>'Min desired', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'comment' =>array('type'=>'text', 'label'=>'Comment', 'enabled'=>1, 'visible'=>-1, 'position'=>155), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>156), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Fk accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>190), + ); + // END MODULEBUILDER PROPERTIES + /** * Current account */ diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 762ebe0fbcf..5831467ce63 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -239,6 +239,7 @@ if ($modecompta == 'CREANCES-DETTES') } $sql .= " WHERE l.fk_facture = f.rowid"; $sql .= " AND f.fk_statut in (1,2)"; + $sql .= " AND l.product_type in (0,1)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2,5)"; } else { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f59e57d3516..20f36998174 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6117,6 +6117,12 @@ class Form } if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow; } + else + { + // For backward compatibility + $objecttmp->fields['ref']=array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1); + } + if (empty($fieldstoshow)) { if (isset($objecttmp->fields['ref'])) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 515a86a9331..bc86076644c 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1085,7 +1085,7 @@ if (empty($reshook)) if ($action == 'add' && $user->rights->fournisseur->commande->creer) { $error = 0; - + $selectedLines = GETPOST('toselect', 'array'); if ($socid < 1) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Supplier')), null, 'errors'); @@ -1177,7 +1177,7 @@ if (empty($reshook)) for ($i = 0; $i < $num; $i++) { - if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0) + if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0 || !in_array($lines[$i]->id, $selectedLines)) continue; $label = (!empty($lines[$i]->label) ? $lines[$i]->label : ''); @@ -1755,7 +1755,7 @@ if ($action == 'create') print ''; print ''; - print "\n"; + // Show origin lines if (!empty($origin) && !empty($originid) && is_object($objectsrc)) @@ -1765,10 +1765,11 @@ if ($action == 'create') print ''; - $objectsrc->printOriginLinesList(); + $objectsrc->printOriginLinesList('', $selectedLines); print '
'; } + print "\n"; } elseif (!empty($object->id)) { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 7a9a00cd3c2..58ea57dd3ad 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -317,6 +317,7 @@ if ($id > 0 || !empty($ref)) print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); print '
'; + print ''; print ''; print ''; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 4b3d181517d..8c022457f88 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -215,7 +215,7 @@ if ($action == "view_ticketlist") 't.date_close' => array('label' => $langs->trans("TicketCloseOn"), 'checked' => 0), 't.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), //'t.track_id' => array('label' => $langs->trans("IDTracking"), 'checked' => 0), - 't.fk_statut' => array('label' => $langs->trans("Statut"), 'checked' => 1), + 't.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1), 't.subject' => array('label' => $langs->trans("Subject"), 'checked' => 1), 'type.code' => array('label' => $langs->trans("Type"), 'checked' => 1), 'category.code' => array('label' => $langs->trans("Category"), 'checked' => 1), diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index e19d9181d8e..f9a3c725032 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -648,14 +648,14 @@ function MoreActions(totalactions){ if (pageactions==0){ pageactions=1; for (i = 0; i <= totalactions; i++){ - if (i<9) $("#action"+i).hide(); + if (i<12) $("#action"+i).hide(); else $("#action"+i).show(); } } else if (pageactions==1){ pageactions=0; for (i = 0; i <= totalactions; i++){ - if (i<9) $("#action"+i).show(); + if (i<12) $("#action"+i).show(); else $("#action"+i).hide(); } } @@ -936,12 +936,12 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { foreach ($menus as $menu) { $i++; - if (count($menus) > 9 and $i == 9) + if (count($menus) > 12 and $i == 12) { echo ''; echo ''; } - elseif ($i > 9) echo ''; + elseif ($i > 12) echo ''; else echo ''; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index aa06addc5ff..e925c5aae9b 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -344,7 +344,7 @@ if ($action == "addline") $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, '', '', 0, 100, '', null, 0); } - $invoice->fetch($placeid); + $invoice->fetch($placeid); } if ($action == "freezone") { diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 8201e673d9f..15e019dd311 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -787,8 +787,8 @@ if (!empty($id) || !empty($ref)) print ''.$prodstatic->getLibStatut(2, 0).''; print ''.$prodstatic->getLibStatut(2, 1).''; print ''; - print ''.img_edit().''; - print ''.img_delete().''; + print 'id.'">'.img_edit().''; + print 'id.'">'.img_delete().''; print ''; print ''; if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined