diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 83ddd1bd888be..ba935a51a1e14 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -17,7 +17,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -33,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // Load translation files required by the page $langs->loadLangs(array("bills","compta","accountancy","productbatch")); @@ -173,7 +173,8 @@ $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,"; $sql.= " fd.situation_percent,"; -$sql.= " co.label as country, s.tva_intra"; +$sql.= " co.code as country_code, co.label as country,"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -229,7 +230,18 @@ $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } if (strlen(trim($search_country))) { - $sql .= natural_search("co.label", $search_country); + $arrayofcode = getCountriesInEEC(); + $country_code_in_EEC = $country_code_in_EEC_without_me = ''; + foreach ($arrayofcode as $key => $value) + { + $country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'"; + if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; + } + if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; + elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; + elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; + elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; + else $sql .= natural_search(array("co.code","co.label"), $search_country); } if (strlen(trim($search_tvaintra))) { $sql .= natural_search("s.tva_intra", $search_tvaintra); @@ -307,7 +319,10 @@ print ''; print ''; print ''; - print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + //print ''; + print ''; print ''; print ''; print ''; @@ -370,9 +385,10 @@ print ''; print '' . price($objp->total_ht) . ''; + print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; - print '' . $objp->country .''; + print '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; print '' . $objp->tva_intra . ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index b5fec4a0e7c52..53674d4cbcb8e 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // Load translation files required by the page $langs->loadLangs(array("bills","compta","accountancy","other","productbatch")); @@ -212,7 +213,8 @@ $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; $sql.= " aa.rowid as aarowid,"; -$sql.= " co.label as country, s.tva_intra"; +$sql.= " co.code as country_code, co.label as country,"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -265,7 +267,18 @@ $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } if (strlen(trim($search_country))) { - $sql .= natural_search("co.label", $search_country); + $arrayofcode = getCountriesInEEC(); + $country_code_in_EEC = $country_code_in_EEC_without_me = ''; + foreach ($arrayofcode as $key => $value) + { + $country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'"; + if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; + } + if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; + elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; + elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; + elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; + else $sql .= natural_search(array("co.code","co.label"), $search_country); } if (strlen(trim($search_tvaintra))) { $sql .= natural_search("s.tva_intra", $search_tvaintra); @@ -371,7 +384,10 @@ print ''; print ''; print ''; - print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + //print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index ae368a20de175..b328cf7345529 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -236,8 +236,6 @@ if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_month) $param .= '&search_month='.urlencode($search_month); if ($search_year) $param .= '&search_year='.urlencode($search_year); - if ($search_country) $param .= "&search_country=" . urlencode($search_country); - if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra); print '
' . "\n"; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 326d249f86d86..b2df1231a4e91 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // Load translation files required by the page $langs->loadLangs(array("compta","bills","other","accountancy","productbatch")); @@ -172,7 +173,9 @@ $sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,"; $sql.= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,"; $sql.= " aa.label, aa.account_number, "; -$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra"; +$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,"; +$sql.= " co.code as country_code, co.label as country,"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -221,7 +224,18 @@ $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } if (strlen(trim($search_country))) { - $sql .= natural_search("co.label", $search_country); + $arrayofcode = getCountriesInEEC(); + $country_code_in_EEC = $country_code_in_EEC_without_me = ''; + foreach ($arrayofcode as $key => $value) + { + $country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'"; + if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; + } + if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; + elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; + elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; + elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; + else $sql .= natural_search(array("co.code","co.label"), $search_country); } if (strlen(trim($search_tvaintra))) { $sql .= natural_search("s.tva_intra", $search_tvaintra); @@ -309,7 +323,10 @@ print ''; print ''; print ''; - print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + // print ''; + print ''; print ''; print ''; print ''; @@ -380,9 +397,11 @@ print ''; print '' . price($objp->total_ht) . ''; + print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; - print '' . $objp->country .''; + print '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + print '' . $objp->tva_intra . ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 18c9fa11a3c56..53dcc4b1270ad 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // Load translation files required by the page $langs->loadLangs(array("bills","compta","accountancy","other","productbatch")); @@ -213,7 +214,8 @@ $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; $sql.= " aa.rowid as aarowid,"; -$sql.= " co.label as country, s.tva_intra"; +$sql.= " co.code as country_code, co.label as country,"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -250,9 +252,6 @@ if (strlen(trim($search_vat))) { $sql .= natural_search("l.tva_tx", price2num($search_vat), 1); } -if (strlen(trim($search_tvaintra))) { - $sql .= natural_search("s.tva_intra", $search_tvaintra); -} if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) @@ -267,7 +266,21 @@ $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } if (strlen(trim($search_country))) { - $sql .= natural_search("co.label", $search_country); + $arrayofcode = getCountriesInEEC(); + $country_code_in_EEC = $country_code_in_EEC_without_me = ''; + foreach ($arrayofcode as $key => $value) + { + $country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'"; + if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; + } + if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; + elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; + elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; + elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; + else $sql .= natural_search(array("co.code","co.label"), $search_country); +} +if (strlen(trim($search_tvaintra))) { + $sql .= natural_search("s.tva_intra", $search_tvaintra); } if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")"; @@ -372,7 +385,10 @@ print ''; print ''; print ''; - print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + //print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index fd465dd180398..bc29c67c244c6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -641,7 +641,9 @@ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, 2); + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; @@ -713,7 +715,9 @@ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1); + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); } if ($result < 0) { diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 342fcd19796c3..dd2dd835a580f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -153,7 +153,7 @@ function __construct($db) // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Function sending an email has the adherent with the text supplied in parameter. + * Function sending an email to the current member with the text supplied in parameter. * * @param string $text Content of message (not html entities encoded) * @param string $subject Subject of message @@ -165,9 +165,10 @@ function __construct($db) * @param int $deliveryreceipt Ask a delivery receipt * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param string $errors_to erros to + * @param string $moreinheader Add more html headers * @return int <0 if KO, >0 if OK */ - function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') + function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='', $moreinheader='') { // phpcs:enable global $conf,$langs; @@ -189,9 +190,11 @@ function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=a $from=$conf->email_from; if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; + $trackid = 'mem'.$this->id; + // Send email (substitutionarray must be done just before this) include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml); + $mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, '', '', $trackid, $moreinheader); if ($mailfile->sendfile()) { return 1; @@ -2661,8 +2664,11 @@ public function sendReminderForExpiredSubscription($daysbeforeend=10) $from = $conf->global->ADHERENT_MAIL_FROM; $to = $adherent->email; + $trackid = 'mem'.$adherent->id; + $moreinheader='X-Dolibarr-Info: sendReminderForExpiredSubscription'."\r\n"; + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1); + $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, $moreinheader); $result = $cmail->sendfile(); if (! $result) { diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 08c3c3c87f5ee..9c5054773092b 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -394,7 +394,9 @@ $listofmimes=array(dol_mimetype($file)); } - $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1); + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader); if ($result < 0) { $errmsg=$object->error; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e0a683e31c0b3..aaa4fb0370642 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -950,6 +950,7 @@ { print $langs->trans("DictionaryDesc"); print " ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; + print '
'; } diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index e10b5530f523e..6b0ea790ab294 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -129,7 +129,7 @@ { $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); $ok=0; - dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump); + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); foreach($arrayofallowedcommand as $allowedcommand) { if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump)) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6ddb4dae1b39b..6d6ef4578cd96 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -254,7 +254,7 @@ function _checkFilters($sqlfilters) //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); $tmp=$sqlfilters; $ok=0; - $i=0; $nb=count($tmp); + $i=0; $nb=strlen($tmp); $counter=0; while ($i < $nb) { diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index cdf9873e791df..b42bc90d8fb43 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -215,6 +215,8 @@ $invoice->note_private=$note; $invoice->cond_reglement_id=$cond_reglement_id; $invoice->mode_reglement_id=$mode_reglement_id; + $invoice->module_source = 'cashdesk'; + $invoice->pos_source = '0'; //print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit; // Si paiement differe ... diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ab0030cc92d4a..98222fafc0099 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -126,6 +126,12 @@ class Facture extends CommonInvoice public $close_note; //! 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) public $paye; + //! key of module source when invoice generated from a dedicated module ('cashdesk', 'takepos', ...) + public $module_source; + //! key of pos source ('0', '1', ...) + public $pos_source; + //! id of template invoice when generated from a template invoice + public $fk_fac_rec_source; //! id of source invoice if replacement invoice or credit note public $fk_facture_source; public $linked_objects=array(); @@ -443,7 +449,7 @@ function create(User $user, $notrigger=0, $forceduedate=0) $sql.= ", note_public"; $sql.= ", ref_client, ref_int"; $sql.= ", fk_account"; - $sql.= ", fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet"; + $sql.= ", module_source, pos_source, fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet"; $sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf"; $sql.= ", situation_cycle_ref, situation_counter, situation_final"; $sql.= ", fk_incoterms, location_incoterms"; @@ -467,6 +473,8 @@ function create(User $user, $notrigger=0, $forceduedate=0) $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); + $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); + $sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql.= ", ".($this->fk_fac_rec_source?"'".$this->db->escape($this->fk_fac_rec_source)."'":"null"); $sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null"); $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); @@ -1213,7 +1221,7 @@ function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $moretitle='', $n if (! empty($this->total_tva)) $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000' - $label.= '
eee' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_localtax2) && $this->total_localtax2 != 0) $label.= '
' . $langs->trans('LT2') . ': ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 3331a7718fd59..96f20fdaf67a8 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -107,7 +107,6 @@ 'c.ref_customer'=>'RefCustomer', 'c.ref_supplier'=>'RefSupplier', 's.nom'=>"ThirdParty", - 'cd.description'=>'Description', 'c.note_public'=>'NotePublic', ); if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; @@ -252,7 +251,7 @@ $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } if ($search_name) $sql .= natural_search('s.nom', $search_name); -if ($search_email) $sql .= natural_search('s.email', $search_name); +if ($search_email) $sql .= natural_search('s.email', $search_email); if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer); if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 57483848c4eb2..364903c9cd7ad 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -53,6 +53,12 @@ $arrayresult=array(); // Define $searchform + +if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) +{ + $arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); +} + if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) { $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); @@ -63,11 +69,6 @@ $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); } -if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) -{ - $arrayresult['searchintomember']=array('position'=>20, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); -} - if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a12e496b58731..018e2e3f1b3c6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -663,15 +663,16 @@ function initCheckForSelect(mode) /* mode is 0 during init of page or click all, * @param string $htmloption Options html on select object * @param integer $maxlength Max length for labels (0=no limit) * @param string $morecss More css class - * @param string $usecodeaskey 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key + * @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key * @param int $showempty Show empty choice - * @param int $disablefavorites Disable favorites + * @param int $disablefavorites 1=Disable favorites, + * @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...) * @return string HTML string with select */ - function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0) + function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0, $addspecialentries=0) { // phpcs:enable - global $conf,$langs; + global $conf,$langs,$mysoc; $langs->load("dict"); @@ -713,9 +714,25 @@ function select_country($selected='', $htmlname='country_id', $htmloption='', $m if (empty($disablefavorites)) array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray); else $countryArray = dol_sort_array($countryArray, 'label'); + if ($showempty) + { + $out.=''."\n"; + } + + if ($addspecialentries) // Add dedicated entries for groups of countries + { + //if ($showempty) $out.= ''; + $out.= ''; + $out.= ''; + if ($mysoc->isInEEC()) $out.= ''; + $out.= ''; + $out.= ''; + } + foreach ($countryArray as $row) { - if (empty($showempty) && empty($row['rowid'])) continue; + //if (empty($showempty) && empty($row['rowid'])) continue; + if (empty($row['rowid'])) continue; if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++; if (empty($row['favorite']) && $atleastonefavorite) @@ -6512,7 +6529,7 @@ function showLinkToObjectBlock($object, $restrictlinksto=array(), $excludelinkst * @param int $useempty 1=Add empty line * @return string See option */ - function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty='') + function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty=0) { global $langs; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 5736fcba68167..7ff5c9100f854 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -742,6 +742,4 @@ function send($notifcode, $object, $filename_list=array(), $mimetype_list=array( if (! $error) return $num; else return -1 * $error; } - } - diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index c6c6b8914a197..9f680ef499055 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -294,12 +294,11 @@ function dumpDatabase($compression='none', $type='auto', $usedefault=1, $file='a if ($handle) { - $execmethod=1; if (! empty($conf->global->MAIN_EXEC_USE_POPEN)) $execmethod=$conf->global->MAIN_EXEC_USE_POPEN; if (empty($execmethod)) $execmethod=1; $ok=0; - dol_syslog("Run command with method ".$execmethod." with ".$fullcommandcrypted); + dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_DEBUG); // TODO Replace with executeCLI function if ($execmethod == 1) @@ -322,7 +321,7 @@ function dumpDatabase($compression='none', $type='auto', $usedefault=1, $file='a { $i++; // output line number if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; - fwrite($handle,$read); + fwrite($handle, $read.($execmethod == 2 ? '' : "\n")); if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1; } @@ -410,13 +409,13 @@ function dumpDatabase($compression='none', $type='auto', $usedefault=1, $file='a if ($compression == 'gz' or $compression == 'bz') { - $this->backup_tables($outputfiletemp); + $this->backupTables($outputfiletemp); dol_compress_file($outputfiletemp, $outputfile, $compression); unlink($outputfiletemp); } else { - $this->backup_tables($outputfile); + $this->backupTables($outputfile); } $this->output = ""; @@ -836,7 +835,7 @@ function compressSyslogs() * @param string $tables Table name or '*' for all * @return int <0 if KO, >0 if OK */ - function backup_tables($outputfile, $tables='*') + function backupTables($outputfile, $tables='*') { global $db, $langs; global $errormsg; @@ -996,4 +995,4 @@ function backup_tables($outputfile, $tables='*') return 1; } -} \ No newline at end of file +} diff --git a/htdocs/core/modules/modDataPolicies.class.php b/htdocs/core/modules/modDataPolicies.class.php index 94b9cf7da9fd4..f8727d46f83fa 100644 --- a/htdocs/core/modules/modDataPolicies.class.php +++ b/htdocs/core/modules/modDataPolicies.class.php @@ -43,7 +43,8 @@ class modDataPolicies extends DolibarrModules { * * @param DoliDB $db Database handler */ - public function __construct($db) { + public function __construct($db) + { global $langs, $conf; $this->db = $db; @@ -221,7 +222,8 @@ public function __construct($db) { * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - public function init($options = '') { + public function init($options = '') + { global $langs; $this->_load_tables('/datapolicies/sql/'); @@ -268,10 +270,10 @@ public function init($options = '') { * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - public function remove($options = '') { + public function remove($options = '') + { $sql = array(); return $this->_remove($sql, $options); } - } diff --git a/htdocs/datapolicies/admin/setupmail.php b/htdocs/datapolicies/admin/setupmail.php index 4728298a09e4d..a6560c1f7d527 100644 --- a/htdocs/datapolicies/admin/setupmail.php +++ b/htdocs/datapolicies/admin/setupmail.php @@ -1,7 +1,8 @@ - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -23,12 +24,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; require_once '../lib/datapolicies.lib.php'; -//require_once "../class/myclass.class.php"; // Translations -$langs->load('admin'); -$langs->load('companies'); -$langs->load('members'); -$langs->load('datapolicies@datapolicies'); +$langs->loadLangs(array('admin', 'companies', 'members', 'datapolicies')); // Parameters @@ -121,32 +118,32 @@ $content = 'DATAPOLICIESCONTENT_' . $l; $acc = 'DATAPOLICIESACCEPT_' . $l; $ref = 'DATAPOLICIESREFUSE_' . $l; -print ''; +print ''; print $langs->trans('DATAPOLICIESSUBJECTMAIL') . ''; print ''; print ''; -print ''; +print ''; print $langs->trans('DATAPOLICIESCONTENTMAIL').''; print $langs->trans('DATAPOLICIESSUBSITUTION');echo'__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__'; $doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70); $doleditor->Create(); print ''; -print ''; +print ''; print $langs->trans('TXTLINKDATAPOLICIESACCEPT') . ''; print ''; print ''; -print ''; +print ''; print $langs->trans('TXTLINKDATAPOLICIESREFUSE') . ''; print ''; print ''; -print ''; +print ''; print $langs->trans('DATAPOLICIESACCEPT').''; $doleditor = new DolEditor($acc, $conf->global->$acc, '', 250, 'Full', '', false, true, 1, 200, 70); $doleditor->Create(); print ''; -print ''; +print ''; print $langs->trans('DATAPOLICIESREFUSE').''; print $langs->trans(''); diff --git a/htdocs/datapolicies/class/actions_datapolicies.class.php b/htdocs/datapolicies/class/actions_datapolicies.class.php index 1240b18ebd08c..839d3f8ae079a 100644 --- a/htdocs/datapolicies/class/actions_datapolicies.class.php +++ b/htdocs/datapolicies/class/actions_datapolicies.class.php @@ -1,5 +1,6 @@ * * 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 @@ -54,7 +55,7 @@ class ActionsDatapolicies /** * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ public function __construct($db) { @@ -64,10 +65,10 @@ public function __construct($db) /** * Execute action * - * @param array $parameters Array of parameters - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action 'add', 'update', 'view' - * @return int <0 if KO, + * @param array $parameters Array of parameters + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, * =0 if OK but we want to process standard actions too, * >0 if OK and we want to replace standard actions. */ @@ -97,8 +98,8 @@ public function doActions($parameters, &$object, &$action, $hookmanager) $object->fetch(GETPOST('socid')); } - // FIXME Removed had coded id, use codes - if ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'anonymiser' && ($object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8)) { + // FIXME Removed hard coded id, use codes + if ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'anonymiser' && (in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8)) { // on verifie si l'objet est utilisé if ($object->isObjectUsed(GETPOST('socid'))) { $object->name = $langs->trans('ANONYME'); @@ -202,19 +203,19 @@ public function doActions($parameters, &$object, &$action, $hookmanager) } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicies') { $object->fetch(GETPOST('id')); - dol_include_once('/contact/class/contact.class.php'); - dol_include_once('/datapolicies/class/datapolicies.class.php'); + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; DataPolicies::sendMailDataPoliciesContact($object); } elseif ($parameters['currentcontext'] == 'membercard' && $action == 'send_datapolicies') { $object->fetch(GETPOST('id')); - dol_include_once('/adherents/class/adherent.class.php'); - dol_include_once('/datapolicies/class/datapolicies.class.php'); + require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; DataPolicies::sendMailDataPoliciesAdherent($object); } elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'send_datapolicies') { $object->fetch(GETPOST('socid')); - dol_include_once('/societe/class/societe.class.php'); - dol_include_once('/datapolicies/class/datapolicies.class.php'); + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; DataPolicies::sendMailDataPoliciesCompany($object); } @@ -245,11 +246,12 @@ public function doMassActions($parameters, &$object, &$action, $hookmanager) $error = 0; // Error counter /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' - foreach ($parameters['toselect'] as $objectid) { - // Do action on each object id - } - } + //if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { + // // do something only for the context 'somecontext1' or 'somecontext2' + // foreach ($parameters['toselect'] as $objectid) { + // // Do action on each object id + // } + //} if (!$error) { $this->results = array('myreturn' => 999); @@ -292,7 +294,7 @@ public function addMoreMassActions($parameters, &$object, &$action, $hookmanager /** * Execute action * - * @param array $parameters Array of parameters + * @param array $parameters Array of parameters * @param Object $object Object output on PDF * @param string $action 'add', 'update', 'view' * @return int <0 if KO, @@ -387,14 +389,14 @@ function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) } ); '; echo $dialog; - if ($parameters['currentcontext'] == 'thirdpartycard' && $object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8) { + if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { echo ''; } elseif ($parameters['currentcontext'] == 'membercard') { echo ''; } elseif ($parameters['currentcontext'] == 'contactcard') { echo ''; } - if (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'thirdpartycard' && $object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8) { + if (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { echo ''; } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'membercard') { echo ''; @@ -435,7 +437,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); // On vérifie si il est utilisé - if (($societe->forme_juridique_code == 11 || $societe->forme_juridique_code == 12 || $societe->forme_juridique_code == 13 || $societe->forme_juridique_code == 15 || $societe->forme_juridique_code == 17 || $societe->forme_juridique_code == 18 || $societe->forme_juridique_code == 19 || $societe->forme_juridique_code == 35 || $societe->forme_juridique_code == 60 || $societe->forme_juridique_code == 200 || $societe->forme_juridique_code == 311 || $societe->forme_juridique_code == 312 || $societe->forme_juridique_code == 316 || $societe->forme_juridique_code == 401 || $societe->forme_juridique_code == 600 || $societe->forme_juridique_code == 700 || $societe->forme_juridique_code == 1005 || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { + if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; $form = new Form($this->db); @@ -448,7 +450,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); - if ($societe->forme_juridique_code != 11 && $societe->forme_juridique_code != 12 && $societe->forme_juridique_code != 13 && $societe->forme_juridique_code != 15 && $societe->forme_juridique_code != 17 && $societe->forme_juridique_code != 18 && $societe->forme_juridique_code != 19 && $societe->forme_juridique_code != 35 && $societe->forme_juridique_code != 60 && $societe->forme_juridique_code != 200 && $societe->forme_juridique_code != 311 && $societe->forme_juridique_code != 312 && $societe->forme_juridique_code != 316 && $societe->forme_juridique_code != 401 && $societe->forme_juridique_code != 600 && $societe->forme_juridique_code != 700 && $societe->forme_juridique_code != 1005 && $societe->typent_id != 8) { + if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; $jsscript .= '