diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 1b68d910f0d..7d24b330d3e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1773,8 +1773,10 @@ else if ($action != 'editlogin' && $action != 'editthirdparty') { // Send - if ($object->statut == 1) { - print '
'.$langs->trans('SendMail').'
'; + if (empty($user->socid)) { + if ($object->statut == 1) { + print '
'.$langs->trans('SendMail').'
'; + } } // Send card by email diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 83f7b03d67f..19c0bab7150 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -154,8 +154,8 @@ 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", 'alpha'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SHOW_LOGO", GETPOST("MAIN_SHOW_LOGO", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index b4ff4ebac68..0292559c33c 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -281,7 +281,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - print ''.$langs->trans('SendMail').''."\n"; + if (empty($user->socid)) { + print ''.$langs->trans('SendMail').''."\n"; + } if ($user->rights->asset->write) { diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 3320c160fc2..9851aea96e7 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -601,7 +601,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - //print '' . $langs->trans('SendMail') . ''."\n"; + //if (empty($user->socid)) { + // print '' . $langs->trans('SendMail') . ''."\n"; + //} // Back to draft if ($object->status == $object::STATUS_VALIDATED) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 41cdd5caf5c..26229561472 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -903,7 +903,7 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res=$this->db->query($sql); - if ($res < 0) { + if (!$res) { $this->error=$this->db->lasterror(); $error++; } @@ -914,7 +914,7 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res=$this->db->query($sql); - if ($res < 0) { + if (!$res) { $this->error=$this->db->lasterror(); $error++; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1f5927f260a..32994e816de 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2498,11 +2498,13 @@ if ($action == 'create') } // Send - if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) { - if ($usercansend) { - print ''.$langs->trans('SendMail').''; - } else - print ''.$langs->trans('SendMail').''; + if (empty($user->socid)) { + if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) { + if ($usercansend) { + print ''.$langs->trans('SendMail').''; + } else + print ''.$langs->trans('SendMail').''; + } } // Create a sale order diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9b389bccb5b..5b046ecf536 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2548,11 +2548,13 @@ if ($action == 'create' && $usercancreate) } // Send - if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) { - if ($usercansend) { - print ''.$langs->trans('SendMail').''; - } else - print ''.$langs->trans('SendMail').''; + if (empty($user->socid)) { + if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) { + if ($usercansend) { + print ''.$langs->trans('SendMail').''; + } else + print ''.$langs->trans('SendMail').''; + } } // Valid diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 6fc0efbd6e0..d030d523734 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/facture/card.php b/htdocs/compta/facture/card.php index bf03ad2c3d6..03ef9ac03a5 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5052,14 +5052,16 @@ elseif ($id > 0 || !empty($ref)) } // Send by mail - if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || !empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) { - if ($objectidnext) { - print ''.$langs->trans('SendMail').''; - } else { - if ($usercansend) { - print ''.$langs->trans('SendMail').''; - } else - print ''.$langs->trans('SendMail').''; + if (empty($user->socid)) { + if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || !empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) { + if ($objectidnext) { + print ''.$langs->trans('SendMail').''; + } else { + if ($usercansend) { + print ''.$langs->trans('SendMail').''; + } else + print ''.$langs->trans('SendMail').''; + } } } diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 7093a3b7a2f..5bb50d825fc 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/contact/card.php b/htdocs/contact/card.php index ed58d976d7c..e7fb6469869 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1449,15 +1449,17 @@ else $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook) && $action != 'presend') { - if (!empty($object->email)) - { - $langs->load("mails"); - print '
'.$langs->trans('SendMail').'
'; - } - else - { - $langs->load("mails"); - print '
'.$langs->trans('SendMail').'
'; + if (empty($user->socid)) { + if (!empty($object->email)) + { + $langs->load("mails"); + print '
'.$langs->trans('SendMail').'
'; + } + else + { + $langs->load("mails"); + print '
'.$langs->trans('SendMail').'
'; + } } if ($user->rights->societe->contact->creer) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c80dda1da91..9581d625f80 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2106,11 +2106,13 @@ else if (empty($reshook)) { // Send - if ($object->statut == 1) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) { - print '
'.$langs->trans('SendMail').'
'; - } else - print '
'.$langs->trans('SendMail').'
'; + if (empty($user->socid)) { + if ($object->statut == 1) { + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) { + print '
'.$langs->trans('SendMail').'
'; + } else + print '
'.$langs->trans('SendMail').'
'; + } } if ($object->statut == 0 && $nbofservices) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 6127a7d6044..454673fe55b 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -814,6 +814,10 @@ class CMailFile if (!empty($conf->global->$keyforsmtppw)) $this->transport->setPassword($conf->global->$keyforsmtppw); //$smtps->_msgReplyTo = 'reply@web.com'; + // Switch content encoding to base64 - avoid the doubledot issue with quoted-printable + $contentEncoderBase64 = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); + $this->message->setEncoder($contentEncoderBase64); + // Create the Mailer using your created Transport $this->mailer = new Swift_Mailer($this->transport); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 39493825377..fc2193b451a 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -207,7 +207,8 @@ class HookManager 'sendMailAfter', 'showLinkToObjectBlock', 'setContentSecurityPolicy', - 'setHtmlTitle' + 'setHtmlTitle', + 'completeTabsHead' ) )) $hooktype='addreplace'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4be8c74ffac..39a006e0342 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6032,6 +6032,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/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 0d702adab60..c4262f71f19 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -171,7 +171,8 @@ class pdf_espadon extends ModelePdfExpedition $nblines = count($object->lines); // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); + $realpatharray=array(); + $this->atleastonephoto = false; if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE)) { $objphoto = new Product($this->db); @@ -183,8 +184,16 @@ class pdf_espadon extends ModelePdfExpedition $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; - $dir = $conf->product->dir_output.'/'.$pdir; + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + } + else + { + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $dir = $conf->product->dir_output.'/'.$pdir; + } $realpath=''; @@ -206,7 +215,8 @@ class pdf_espadon extends ModelePdfExpedition $filename = $obj['photo']; } - $realpath = $dir.$filename; + $realpath = $dir.$filename; + $this->atleastonephoto = true; break; } @@ -1150,7 +1160,7 @@ class pdf_espadon extends ModelePdfExpedition 'border-left' => false, // remove left line separator ); - if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE) && !empty($this->atleastonephoto)) + if (!empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE) && !empty($this->atleastonephoto)) { $this->cols['photo']['status'] = true; } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index ad0272f46a1..506e72ba1b0 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -214,9 +214,16 @@ class pdf_rouget extends ModelePdfExpedition $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; - $dir = $conf->product->dir_output.'/'.$pdir; + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + } + else + { + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $dir = $conf->product->dir_output.'/'.$pdir; + } $realpath = ''; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 631c9ab4251..7bef90f514e 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2018 Francis Appels * Copyright (C) 2019 Markus Welters * Copyright (C) 2019 Rafael Ingenleuf + * Copyright (C) 2020 Marc Guenneugues * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -350,13 +351,18 @@ class pdf_standard extends ModeleExpenseReport $initialY = $tab_top + 7; $nexY = $tab_top + 7; + $showpricebeforepagebreak = 1; + $pdf->setTopMargin($tab_top_newpage); // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) { + $i = 0; + while ($i < $nblines) { $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); - - $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + if (empty($showpricebeforepagebreak)) { + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + } else { + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + } $pageposbefore = $pdf->getPage(); $curY = $nexY; $pdf->startTransaction(); @@ -367,7 +373,27 @@ class pdf_standard extends ModeleExpenseReport $pdf->rollbackTransaction(true); $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + if (empty($showpricebeforepagebreak)) { + $pdf->AddPage('', '', true); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + $pdf->setPage($pageposafter + 1); + $showpricebeforepagebreak = 1; + $nexY = $tab_top_newpage; + $nexY += ($pdf->getFontSize() * 1.3); // Passe espace entre les lignes + $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage + $pdf->SetTextColor(0, 0, 0); + + $pdf->setTopMargin($tab_top_newpage); + continue; + } else { + $pdf->setPageOrientation('', 1, $heightforfooter); + $showpricebeforepagebreak = 0; + } $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); @@ -397,6 +423,7 @@ class pdf_standard extends ModeleExpenseReport { $pdf->commitTransaction(); } + $i++; //nexY $nexY = $pdf->GetY(); $pageposafter = $pdf->getPage(); @@ -426,6 +453,7 @@ class pdf_standard extends ModeleExpenseReport while ($pagenb < $pageposafter) { $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index cc9111fc813..5f5e653bff2 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2529,13 +2529,15 @@ elseif ($id || $ref) } // Send - if ($object->statut > 0) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) + if (empty($user->socid)) { + if ($object->statut > 0) { - print ''.$langs->trans('SendMail').''; + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) + { + print ''.$langs->trans('SendMail').''; + } + else print ''.$langs->trans('SendMail').''; } - else print ''.$langs->trans('SendMail').''; } // Create bill diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index cbca46576a1..48b318620c9 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2643,14 +2643,15 @@ if ($action != 'create' && $action != 'edit') $object->fetch($id, $ref); // Send - if ($object->fk_statut > ExpenseReport::STATUS_DRAFT) { - //if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expensereport->expensereport_advance->send)) { - print ''; - //} else - // print ''; + if (empty($user->socid)) { + if ($object->fk_statut > ExpenseReport::STATUS_DRAFT) { + //if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expensereport->expensereport_advance->send)) { + print ''; + //} else + // print ''; + } } - /* Si l'état est "Brouillon" * ET user à droit "creer/supprimer" * ET fk_user_author == user courant diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index faf7943107f..ed6d7996eff 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1628,13 +1628,15 @@ elseif ($id > 0 || !empty($ref)) } // Send - if ($object->statut > Fichinter::STATUS_DRAFT) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) + if (empty($user->socid)) { + if ($object->statut > Fichinter::STATUS_DRAFT) { - print ''; + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) + { + print ''; + } + else print ''; } - else print ''; } // create intervention model diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 6463736ac93..0352963b13e 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a9503fa2162..43964b38431 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1086,7 +1086,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'); @@ -1178,7 +1178,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 : ''); @@ -1756,7 +1756,7 @@ if ($action == 'create') print ''; print ''; - print "\n"; + // Show origin lines if (!empty($origin) && !empty($originid) && is_object($objectsrc)) @@ -1766,10 +1766,11 @@ if ($action == 'create') print ''; - $objectsrc->printOriginLinesList(); + $objectsrc->printOriginLinesList('', $selectedLines); print '
'; } + print "\n"; } elseif (!empty($object->id)) { @@ -2442,11 +2443,13 @@ elseif (!empty($object->id)) } // Send - if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED, 3, 4, 5)) || !empty($conf->global->SUPPLIER_ORDER_SENDBYEMAIL_FOR_ALL_STATUS)) - { - if ($user->rights->fournisseur->commande->commander) + if (empty($user->socid)) { + if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED, 3, 4, 5)) || !empty($conf->global->SUPPLIER_ORDER_SENDBYEMAIL_FOR_ALL_STATUS)) { - print ''.$langs->trans('SendMail').''; + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans('SendMail').''; + } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 703a97fe11a..948fd389b60 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3134,13 +3134,15 @@ else } // Send by mail - if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED)) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send) + if (empty($user->socid)) { + if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED)) { - print ''; + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send) + { + print ''; + } + else print '
'.$langs->trans('SendMail').'
'; } - else print '
'.$langs->trans('SendMail').'
'; } // Make payments diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 6f3994572c6..14fa17480d9 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -165,7 +165,7 @@ SuppliersPrices=Vendor prices SuppliersPricesOfProductsOrServices=Vendor prices (of products or services) CustomCode=Customs / Commodity / HS code CountryOrigin=Origin country -Nature=Nature of produt (material/finished) +Nature=Nature of product (material/finished) ShortLabel=Short label Unit=Unit p=u. diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang index e7c248d631d..d117a47c1bf 100644 --- a/htdocs/langs/fr_FR/exports.lang +++ b/htdocs/langs/fr_FR/exports.lang @@ -109,7 +109,7 @@ Separator=Séparateur de champs Enclosure=Encadrement des chaînes de textes SpecialCode=Code spécial ExportStringFilter=%% permet de remplacer 1 ou plusieurs caractères dans le texte -ExportDateFilter=AAAA, AAAAMM, AAAAMMJJ: filtre pour une année/mois/jour
AAAA+AAAA, AAAAMM+AAAAMM, AAAAMMJJ+AAAAMMJJ: filtre pour une plage année/mois/jour
> AAAA, > AAAAMM, > AAAAMMJJ': filtre pour une date supérieure à une année/mois/jour donné
< AAAA, < AAAAMM, < AAAAMMJJ: filtre pour une date inférieure à une année/mois/jour donné +ExportDateFilter=AAAA, AAAAMM, AAAAMMJJ: filtre pour une année/mois/jour
AAAA+AAAA, AAAAMM+AAAAMM, AAAAMMJJ+AAAAMMJJ: filtre pour une plage année/mois/jour
> AAAA, > AAAAMM, > AAAAMMJJ: filtre pour une date supérieure à une année/mois/jour donné
< AAAA, < AAAAMM, < AAAAMMJJ: filtre pour une date inférieure à une année/mois/jour donné ExportNumericFilter=NNNNN filtre une seule valeur
NNNNN+NNNNN filtre une plage de valeurs
< NNNNN filtre les valeurs inférieures
> NNNNN filtre les valeurs supérieures ImportFromLine=Début d'import à la ligne numéro EndAtLineNb=Fin à la ligne numéro diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 97adff0558f..f44caa119a9 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -456,7 +456,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - print ''.$langs->trans('SendMail').''."\n"; + if (empty($user->socid)) { + print ''.$langs->trans('SendMail').''."\n"; + } // Back to draft if ($object->status == $object::STATUS_VALIDATED) diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index e16a19ea482..21558c257ec 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -574,7 +574,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - //print '' . $langs->trans('SendMail') . ''."\n"; + //if (empty($user->socid)) { + // print '' . $langs->trans('SendMail') . ''."\n"; + //} // Back to draft if ($object->status == $object::STATUS_VALIDATED) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index cb95f10d79f..f67910cbef4 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -70,13 +70,15 @@ if ($cancel) $action =''; if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer)) { $error=0; - for ($i=0; $i<$_POST["max_prod"]; $i++) + var_dump(GETPOST("max_prod", 'int')); + for ($i=0; $i < GETPOST("max_prod", 'int'); $i++) { - if ($_POST["prod_qty_".$i] > 0) + $qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS'); + if ($qty > 0) { - if ($object->add_sousproduit($id, $_POST["prod_id_".$i], $_POST["prod_qty_".$i], $_POST["prod_incdec_".$i]) > 0) + if ($object->add_sousproduit($id, GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')) > 0) { - //var_dump($id.' - '.$_POST["prod_id_".$i].' - '.$_POST["prod_qty_".$i]);exit; + //var_dump($i.' '.GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')); $action = 'edit'; } else @@ -94,7 +96,7 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se } else { - if ($object->del_sousproduit($id, $_POST["prod_id_".$i]) > 0) + if ($object->del_sousproduit($id, GETPOST("prod_id_".$i, 'int')) > 0) { $action = 'edit'; } @@ -106,6 +108,7 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se } } } + if (! $error) { header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); @@ -314,6 +317,7 @@ if ($id > 0 || ! empty($ref)) print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); print '
'; + print ''; print ''; print ''; @@ -540,7 +544,9 @@ if ($id > 0 || ! empty($ref)) if($num == 0) print ''.$langs->trans("NoMatchFound").''; - while ($i < $num) + $MAX = 100; + + while ($i < min($num, $MAX)) { $objp = $db->fetch_object($resql); if($objp->rowid != $id) @@ -572,7 +578,8 @@ if ($id > 0 || ! empty($ref)) } } - print "\n".''; + print "\n"; + print ''; $productstatic->id=$objp->rowid; $productstatic->ref=$objp->ref; @@ -620,6 +627,14 @@ if ($id > 0 || ! empty($ref)) } $i++; } + if ($num > $MAX) { + print ''; + print ''.$langs->trans("More").'...'; + print ''; + print ''; + print ''; + print ''; + } } else { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index f6daf4cb77d..4cf56b8a9d0 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -773,7 +773,12 @@ SCRIPT; if (empty($rowid)) { foreach ($extralabels as $key => $value) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { - print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : '', '', '', '', '', 0, 'product_fournisseur_price').''; + if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + + print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'; + if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); + else print $langs->trans($value); + print ''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : '', '', '', '', '', 0, 'product_fournisseur_price').''; } } } else { @@ -789,7 +794,14 @@ SCRIPT; $obj = $db->fetch_object($resql); foreach ($extralabels as $key => $value) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { - print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price').''; + if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + + print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'; + if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); + else print $langs->trans($value); + print ''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price'); + + print ''; } } $db->free($resql); @@ -892,7 +904,10 @@ SCRIPT; foreach ($extralabels as $key => $value) { // Show field if not hidden if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - print_liste_field_titre($value, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); + else $extratitle = $langs->trans($value); + print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); } } } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 3d389cf7eb2..df872491ae1 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -329,7 +329,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - print ''.$langs->trans('SendMail').''."\n"; + if (empty($user->socid)) { + print ''.$langs->trans('SendMail').''."\n"; + } if ($permissiontoadd) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6499cc0ce9d..03ba46a4068 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -103,11 +103,11 @@ class Entrepot extends CommonObject * @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'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10), - 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-2, 'showoncombobox'=>1, 'position'=>25), + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), + 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35), - 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>-2, 'position'=>40, 'showoncombobox'=>1), + 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1), 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45), 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50), @@ -119,7 +119,7 @@ class Entrepot extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>1010), - 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-2, 'position'=>200), + 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>200), ); /** diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index b84ddf9aad2..e4ad265c793 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,12 +50,12 @@ $search_status = GETPOST("search_status", "int"); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); -$page = GETPOST('page', 'int'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortfield) $sortfield = "e.ref"; +if (!$sortfield) $sortfield = "t.ref"; if (!$sortorder) $sortorder = "ASC"; // Security check @@ -77,38 +78,55 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'e.ref'=>"Ref", - 'e.lieu'=>"LocationSummary", - 'e.description'=>"Description", - 'e.address'=>"Address", - 'e.zip'=>'Zip', - 'e.town'=>'Town', + 't.ref'=>"Ref", + 't.lieu'=>"LocationSummary", + 't.description'=>"Description", + 't.address'=>"Address", + 't.zip'=>'Zip', + 't.town'=>'Town', + 't.phone'=>'Phone', + 't.fax'=>'Fax', ); +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all", 'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key]=GETPOST('search_'.$key, 'alpha'); +} + // Definition of fields for list $arrayfields = array( 'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'position'=>70), 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71), 'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72), ); -foreach ($object->fields as $key => $val) +foreach($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field - if (!empty($val['visible'])) $arrayfields['e.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); + if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); } // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + ); + } } } $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); + /* * Actions */ @@ -128,12 +146,12 @@ if (empty($reshook)) // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { - $search_ref = ""; - $sall = ""; - $search_label = ""; - $search_status = ""; - $toselect = ''; - $search_array_options = array(); + foreach ($object->fields as $key => $val) + { + $search[$key] = ''; + } + $toselect = ''; + $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) @@ -167,31 +185,38 @@ $title = $langs->trans("ListOfWarehouses"); // Build and execute select // -------------------------------------------------------------------- -$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,"; -$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; -$sqlGroupBy = ''; +$sql = 'SELECT '; +foreach ($object->fields as $key => $val) +{ + $sql .= 't.'.$key.', '; +} // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); - $sqlGroupBy .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); - } + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); } +$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); -$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as e"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; +$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON t.rowid = ps.fk_entrepot"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c_dep ON c_dep.rowid = e.fk_departement"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = e.fk_pays"; -$sql .= " WHERE e.entity IN (".getEntity('stock').")"; -if ($search_ref) $sql .= natural_search("e.ref", $search_ref); // ref -if ($search_label) $sql .= natural_search("e.lieu", $search_label); // label -if ($search_status != '' && $search_status >= 0) $sql .= " AND e.statut = ".$search_status; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c_dep ON c_dep.rowid = t.fk_departement"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk_pays"; +$sql .= " WHERE t.entity IN (".getEntity('stock').")"; +foreach ($search as $key => $val) +{ + if ($key == 'status' && $search[$key] == -1) continue; + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if (strpos($object->fields[$key]['type'], 'integer:') === 0) { + if ($search[$key] == '-1') $search[$key] = ''; + $mode_search = 2; + } + if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); +} if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -199,12 +224,25 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent".$sqlGroupBy; +$sql.= " GROUP BY "; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/,\s*$/', '', $sql); $totalnboflines = 0; $result = $db->query($sql); if ($result) { - $totalnboflines = $db->num_rows($result); + $totalnboflines = $db->num_rows($result); // fetch totals $line = $total = $totalsell = $totalStock = 0; while ($line < $totalnboflines) @@ -272,10 +310,11 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -if ($search_ref) $param .= "&search_ref=".urlencode($search_ref); -if ($search_label) $param .= "&search_label=".urlencode($search_label); -if ($search_status) $param .= "&search_status=".urlencode($search_status); -if ($search_all) $param .= "&search_all=".urlencode($search_all); +foreach ($search as $key => $val) +{ + if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); + else $param .= '&search_'.$key.'='.urlencode($search[$key]); +} if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -339,7 +378,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- @@ -353,7 +392,7 @@ foreach ($object->fields as $key => $val) elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; - if (!empty($arrayfields['e.'.$key]['checked'])) + if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; @@ -410,9 +450,9 @@ foreach ($object->fields as $key => $val) elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; - if (!empty($arrayfields['e.'.$key]['checked'])) + if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['e.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'e.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; } } @@ -430,13 +470,14 @@ if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (!empty($arrayfields["e.statut"]['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, '', $sortfield, $sortorder, 'right '); +if (!empty($arrayfields['t.statut']['checked'])) { + print_liste_field_titre($arrayfields['t.statut']['label'], $_SERVER["PHP_SELF"], "t.statut", '', $param, '', $sortfield, $sortorder, 'right '); } // Action column @@ -482,7 +523,7 @@ if ($num) if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; - if (!empty($arrayfields['e.'.$key]['checked'])) + if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if ($key == 'statut') print $warehouse->getLibStatut(5); @@ -491,8 +532,8 @@ if ($num) if (!$i) $totalarray['nbfield']++; if (!empty($val['isameasure'])) { - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'e.'.$key; - $totalarray['val']['e.'.$key] += $warehouse->$key; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['val']['t.'.$key] += $warehouse->$key; } } } @@ -535,7 +576,7 @@ if ($num) print $hookmanager->resPrint; // Status - if (!empty($arrayfields["e.statut"]['checked'])) { + if (!empty($arrayfields['t.statut']['checked'])) { print ''; if (!$i) $totalarray['nbfield']++; } @@ -561,22 +602,6 @@ if ($num) { // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; - - /*print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n";*/ } } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 48777ceb1e4..16cf9032731 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1191,9 +1191,11 @@ elseif ($object->id > 0) }*/ // Send - if ($object->statut != 2) - { - print ''.$langs->trans('SendMail').''; + if (empty($user->socid)) { + if ($object->statut != 2) + { + print ''.$langs->trans('SendMail').''; + } } // Modify diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index edb89257e3e..1a18954994f 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/reception/card.php b/htdocs/reception/card.php index 83a28d55f48..4a76631dc17 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -2056,13 +2056,15 @@ elseif ($id || $ref) } // Send - if ($object->statut > 0) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) + if (empty($user->socid)) { + if ($object->statut > 0) { - print ''.$langs->trans('SendByMail').''; + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) + { + print ''.$langs->trans('SendByMail').''; + } + else print ''.$langs->trans('SendByMail').''; } - else print ''.$langs->trans('SendByMail').''; } // Create bill diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 318e6dec614..9cc5febc2ca 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2714,16 +2714,18 @@ else } } - if (!empty($object->email) || $at_least_one_email_contact) - { - $langs->load("mails"); - print ''.$langs->trans('SendMail').''; - } - else - { - $langs->load("mails"); - print ''.$langs->trans('SendMail').''; - } + if (empty($user->socid)) { + if (!empty($object->email) || $at_least_one_email_contact) + { + $langs->load("mails"); + print ''.$langs->trans('SendMail').''; + } + else + { + $langs->load("mails"); + print ''.$langs->trans('SendMail').''; + } + } if ($user->rights->societe->creer) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2fa87eb8086..9cc36dbb7b4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3524,6 +3524,7 @@ class Societe extends CommonObject $this->phone = $member->phone; // Prof phone $this->email = $member->email; $this->socialnetworks = $member->socialnetworks; + $this->entity=$member->entity; $this->client = 1; // A member is a customer by default $this->code_client = ($customercode ? $customercode : -1); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e998f909d06..a3fdd48b04e 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1869,11 +1869,13 @@ if ($action == 'create') } // Send - if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance) { - print ''; - } else - print ''; + if (empty($user->socid)) { + if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance) { + print ''; + } else + print ''; + } } // Create an order diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 02652da5875..f61576216c7 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -59,7 +59,7 @@ $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_societe = GETPOST('search_societe', 'alpha'); -$search_author = GETPOST('search_author', 'alpha'); +$search_login = GETPOST('search_login', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = trim(GETPOST("search_state")); @@ -199,7 +199,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; - $search_author = ''; $yearvalid = ''; $monthvalid = ''; $dayvalid = ''; @@ -287,7 +286,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_ref) $sql .= natural_search('sp.ref', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_author) $sql .= natural_search('u.login', $search_author); +if ($search_login) $sql .= natural_search('u.login', $search_login); if ($search_montant_ht) $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1); if ($search_montant_vat != '') $sql .= natural_search("sp.tva", $search_montant_vat, 1); if ($search_montant_ttc != '') $sql .= natural_search("sp.total", $search_montant_ttc, 1); @@ -371,7 +370,7 @@ if ($resql) if ($search_user > 0) $param .= '&search_user='.$search_user; if ($search_sale > 0) $param .= '&search_sale='.$search_sale; if ($search_montant_ht) $param .= '&search_montant_ht='.$search_montant_ht; - if ($search_author) $param .= '&search_author='.$search_author; + if ($search_login) $param .= '&search_login='.$search_login; if ($search_town) $param .= '&search_town='.$search_town; if ($search_zip) $param .= '&search_zip='.$search_zip; if ($socid > 0) $param .= '&socid='.$socid; @@ -554,7 +553,7 @@ if ($resql) { // Author print ''; } // Extra fields diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index f684d18741d..402516d2eaf 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -281,7 +281,7 @@ if ($action == "addline") $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr); - $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, 0, null, 0, '', 0, 100, '', null, 0); + $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, 0, null, '', '', 0, 100, '', null, 0); $invoice->fetch($placeid); } @@ -295,7 +295,7 @@ if ($action == "freezone") { $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr); - $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', 'TTC', $number, 0, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0); + $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', 'TTC', $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0); $invoice->fetch($placeid); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 152103cc5db..4bedd36fc3c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1884,15 +1884,17 @@ else $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if (!empty($object->email)) - { - $langs->load("mails"); - print ''; - } - else - { - $langs->load("mails"); - print ''; + if (empty($user->socid)) { + if (!empty($object->email)) + { + $langs->load("mails"); + print ''; + } + else + { + $langs->load("mails"); + print ''; + } } if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 306586ec504..b39991e7f31 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -777,8 +777,8 @@ if (!empty($id) || !empty($ref)) print ''; print ''; print ''; print '
'; if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); @@ -379,13 +418,14 @@ if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Status -if (!empty($arrayfields["e.statut"]['checked'])) { +if (!empty($arrayfields['t.statut']['checked'])) { print ''; print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print '' . $warehouse->LibStatut($obj->statut, 5) . '
'.$langs->trans("Total").''.price2num($totalStock, 5).''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency); - else - { - $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"), $htmltext); - } - print '
'; - print ''; + print ''; print ''.$prodstatic->getLibStatut(2, 0).''.$prodstatic->getLibStatut(2, 1).''; - print ''.img_edit().''; - print ''.img_delete().''; + print 'id.'">'.img_edit().''; + print 'id.'">'.img_delete().''; 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 diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 36eb72dd916..046a5005e51 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -306,7 +306,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - print ''."\n"; + if (empty($user->socid)) { + print ''."\n"; + } if ($user->rights->website->write) { diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index d4dec007d86..c2755892716 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -334,9 +334,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { - // Send - print ''.$langs->trans('SendMail').''."\n"; - // Modify if ($user->rights->mymodule->write) {