diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 9a0c34aea2b..1af4b25bb27 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -498,7 +498,10 @@ if ($mode == 'feature') { if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { $i = 0; foreach ($objMod->boxes as $val) { - $text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]); + $boxstring = (empty($val['file']) ? (empty($val[0]) ? '' : $val[0]) : $val['file']); + if ($boxstring) { + $text .= ($i ? ', ' : '').$boxstring; + } $i++; } } else { diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 28909470701..d8fb57b49f5 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -632,7 +632,7 @@ if ($id) { // Active print ''; - print ''.$actl[($obj->status ? 1 : 0)].''; + print ''.$actl[($obj->status ? 1 : 0)].''; print ""; // Modify link diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 743fd4c0506..e49f06034aa 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -335,7 +335,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { - $vars[$code] = $det['NP']; + $vars[$code] = empty($det['NP']) ? 0 : $det['NP']; } $result = strtr($formula, $vars); @@ -355,12 +355,16 @@ if ($modecompta == 'CREANCES-DETTES') { // Year N $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) - $sommes[$code]['NP'] += $r; + if (empty($sommes[$code]['NP'])) { + $sommes[$code]['NP'] = $r; + } else { + $sommes[$code]['NP'] += $r; + } // Current fiscal year (N) if (is_array($sommes) && !empty($sommes)) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['N']; + $vars[$code] = empty($det['N']) ? 0 : $det['N']; } } @@ -371,13 +375,17 @@ if ($modecompta == 'CREANCES-DETTES') { $r = dol_eval($result, 1, 1, '1'); print ''.price($r).''; - $sommes[$code]['N'] += $r; + if (empty($sommes[$code]['N'])) { + $sommes[$code]['N'] = $r; + } else { + $sommes[$code]['N'] += $r; + } // Detail by month foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; + $vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; } $result = strtr($formula, $vars); $result = str_replace('--', '+', $result); @@ -386,14 +394,18 @@ if ($modecompta == 'CREANCES-DETTES') { $r = dol_eval($result, 1, 1, '1'); print ''.price($r).''; - $sommes[$code]['M'][$k] += $r; + if (empty($sommes[$code]['M'][$k])) { + $sommes[$code]['M'][$k] = $r; + } else { + $sommes[$code]['M'][$k] += $r; + } } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; + $vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; } $result = strtr($formula, $vars); $result = str_replace('--', '+', $result); @@ -402,7 +414,11 @@ if ($modecompta == 'CREANCES-DETTES') { $r = dol_eval($result, 1, 1, '1'); print ''.price($r).''; - $sommes[$code]['M'][$k] += $r; + if (empty($sommes[$code]['M'][$k])) { + $sommes[$code]['M'][$k] = $r; + } else { + $sommes[$code]['M'][$k] += $r; + } } } @@ -429,14 +445,14 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) { // Loop on each account. - if (!is_null($cpt['account_number'])) { + if (isset($cpt['account_number'])) { $arrayofaccountforfilter[] = $cpt['account_number']; } } // N-1 if (!empty($arrayofaccountforfilter)) { - $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc'] ? $cat['dc'] : 0); + $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, empty($cat['dc']) ? 0 : $cat['dc']); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultNP = 0; @@ -444,8 +460,16 @@ if ($modecompta == 'CREANCES-DETTES') { foreach ($cpts as $i => $cpt) { // Loop on each account found $resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']]) ? 0 : $AccCat->sdcperaccount[$cpt['account_number']]; - $totCat['NP'] += $resultNP; - $sommes[$code]['NP'] += $resultNP; + if (empty($totCat['NP'])) { + $totCat['NP'] = $resultNP; + } else { + $totCat['NP'] += $resultNP; + } + if (empty($sommes[$code]['NP'])) { + $sommes[$code]['NP'] = $resultNP; + } else { + $sommes[$code]['NP'] += $resultNP; + } $totPerAccount[$cpt['account_number']]['NP'] = $resultNP; } } @@ -467,23 +491,47 @@ if ($modecompta == 'CREANCES-DETTES') { } //var_dump($monthtoprocess.'_'.$yeartoprocess); - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc'] ? $cat['dc'] : 0, 'nofilter', $monthtoprocess, $yeartoprocess); - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultM = 0; + if (isset($cpt['account_number'])) { + $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, empty($cat['dc']) ? 0 : $cat['dc'], 'nofilter', $monthtoprocess, $yeartoprocess); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultM = 0; + } else { + $resultM = $AccCat->sdc; + } } else { - $resultM = $AccCat->sdc; + $resultM = 0; + } + if (empty($totCat['M'][$k])) { + $totCat['M'][$k] = $resultM; + } else { + $totCat['M'][$k] += $resultM; + } + if (empty($sommes[$code]['M'][$k])) { + $sommes[$code]['M'][$k] = $resultM; + } else { + $sommes[$code]['M'][$k] += $resultM; + } + if (isset($cpt['account_number'])) { + $totPerAccount[$cpt['account_number']]['M'][$k] = $resultM; } - $totCat['M'][$k] += $resultM; - $sommes[$code]['M'][$k] += $resultM; - $totPerAccount[$cpt['account_number']]['M'][$k] = $resultM; $resultN += $resultM; } - $totCat['N'] += $resultN; - $sommes[$code]['N'] += $resultN; - $totPerAccount[$cpt['account_number']]['N'] = $resultN; + if (empty($totCat)) { + $totCat['N'] = $resultN; + } else { + $totCat['N'] += $resultN; + } + if (empty($sommes[$code]['N'])) { + $sommes[$code]['N'] = $resultN; + } else { + $sommes[$code]['N'] += $resultN; + } + if (isset($cpt['account_number'])) { + $totPerAccount[$cpt['account_number']]['N'] = $resultN; + } } @@ -543,16 +591,26 @@ if ($modecompta == 'CREANCES-DETTES') { // Loop on detail of all accounts to output the detail if ($showaccountdetail != 'no') { foreach ($cpts as $i => $cpt) { - $resultNP = $totPerAccount[$cpt['account_number']]['NP']; - $resultN = $totPerAccount[$cpt['account_number']]['N']; + if (isset($cpt['account_number'])) { + $resultNP = $totPerAccount[$cpt['account_number']]['NP']; + $resultN = $totPerAccount[$cpt['account_number']]['N']; + } else { + $resultNP = 0; + $resultN = 0; + } if ($showaccountdetail == 'all' || $resultN != 0) { print ''; print ''; - print ''; - print '     '.length_accountg($cpt['account_number']); - print ' - '; - print $cpt['account_label']; + + if (isset($cpt['account_number'])) { + $labeldetail = '     '.length_accountg($cpt['account_number']).' - '.$cpt['account_label']; + } else { + $labeldetail = '-'; + } + + print ''; + print dol_escape_htmltag($labeldetail); print ''; print ''.price($resultNP).''; print ''.price($resultN).''; @@ -560,13 +618,21 @@ if ($modecompta == 'CREANCES-DETTES') { // Make one call for each month foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth) { - $resultM = $totPerAccount[$cpt['account_number']]['M'][$k]; + if (isset($cpt['account_number'])) { + $resultM = $totPerAccount[$cpt['account_number']]['M'][$k]; + } else { + $resultM = 0; + } print ''.price($resultM).''; } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { - $resultM = $totPerAccount[$cpt['account_number']]['M'][$k]; + if (isset($cpt['account_number'])) { + $resultM = empty($totPerAccount[$cpt['account_number']]['M'][$k]) ? 0 : $totPerAccount[$cpt['account_number']]['M'][$k]; + } else { + $resultM = 0; + } print ''.price($resultM).''; } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e2094402ced..67b3ce2a38a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1789,6 +1789,8 @@ class Contact extends CommonObject $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; + $sql .= " ON sc.fk_socpeople = sp.rowid AND sp.statut = 1"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index d58854ed9d0..0241431c8b7 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -34,6 +34,9 @@ class Utils */ public $db; + public $error; + public $errors; + public $output; // Used by Cron method to return message public $result; // Used by Cron method to return data diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index afc19a12e92..4027fb0cbf2 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -976,8 +976,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $tmp = json_decode($obj->note, true); } return array( - 'authorid' => $tmp['authorid'], - 'ip' => $tmp['ip'], + 'authorid' => empty($tmp['authorid']) ? '' : $tmp['authorid'], + 'ip' => empty($tmp['ip']) ? '' : $tmp['ip'], 'lastactivationdate' => $this->db->jdate($obj->tms), 'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'), ); diff --git a/htdocs/core/modules/action/rapport.class.php b/htdocs/core/modules/action/rapport.class.php index 8c0964b1378..d91b748d7d5 100644 --- a/htdocs/core/modules/action/rapport.class.php +++ b/htdocs/core/modules/action/rapport.class.php @@ -40,6 +40,11 @@ class CommActionRapport */ public $db; + public $error; + + public $errors; + + /** * @var string description */ diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 97e494a8a2e..b8810a2696d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -4509,7 +4509,7 @@ if ($module == 'initmodule') { print ''; print ''; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; - print ' '.img_picto($langs->trans("Delete"), 'delete').''; + print ' '.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index c5b27a00c20..b91ae62f663 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -147,7 +147,6 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('stock').')'; if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid'; } @@ -168,6 +167,7 @@ if (!empty($search_categ) && $search_categ != '-1') { } $sql .= ")"; } +$sql .= " AND EXISTS (SELECT e.rowid FROM ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (".getEntity('stock')."))"; if ($sall) { $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); } @@ -363,6 +363,13 @@ if ($resql) { // Fields title search print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + } print ''; print ''; print ''; @@ -391,14 +398,20 @@ if ($resql) { $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + } print ''; //Line for column titles print ""; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); + } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { @@ -429,7 +442,10 @@ if ($resql) { $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre(''); + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); + } print "\n"; while ($i < min($num, $limit)) { @@ -440,6 +456,10 @@ if ($resql) { $product->load_stock(); print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } print ''; print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); @@ -504,7 +524,11 @@ if ($resql) { $parameters = array('obj'=>$objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $product); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + print "\n"; $i++; } diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 40c8fcf4292..c07f0785e2c 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -227,7 +227,7 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_pro $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key -$sql .= " WHERE p.entity IN (".getEntity('product').")"; +$sql .= " WHERE p.entity IN (".getEntity('product').") AND e.entity IN (".getEntity('stock').")"; if (!empty($search_categ) && $search_categ != '-1') { $sql .= " AND "; if ($search_categ == -2) { @@ -514,6 +514,13 @@ print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''; @@ -571,6 +578,10 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); +} print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { @@ -591,7 +602,9 @@ print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", print_liste_field_titre(''); print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre(''); +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); +} print "\n"; $product_static = new Product($db); @@ -648,6 +661,11 @@ while ($i < $imaxinloop) { print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + // Ref print ''; - print ''; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } print "\n"; $i++; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 7931c6a37c1..943280d6e2d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -46,9 +46,6 @@ if (!defined('NOLOGIN')) { if (!defined('NOCSRFCHECK')) { define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. } -if (!defined('NOIPCHECK')) { - define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -} if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index de6b27cba90..c47bbd7f734 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -549,6 +549,8 @@ if ($action == "dosign" && empty($cancel)) { $("#signbutton").attr("disabled",false); if(!$._data($("#signbutton")[0], "events")){ $("#signbutton").on("click",function(){ + console.log("We click on button sign"); + $("#signbutton").val(\''.dol_escape_js($langs->transnoentities('PleaseBePatient')).'\'); var signature = $("#signature").jSignature("getData", "image"); $.ajax({ type: "POST", diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 8724e65ca4f..4f82139656c 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -252,7 +252,7 @@ if (is_array($results)) { } } print ''; - print $tmpuser->getFullName(); + print $tmpuser->getFullName($langs); print '   '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope'); print ''; print '
'; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index ec1fbd293d6..cf3f1897638 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -71,6 +71,8 @@ if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) { $conf->global->MAILING_LIMIT_SENDBYCLI = 0; } +$langs->loadLangs(array("main", "mails")); + /* * Main
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; print ''; print '
'; print $product_static->getNomUrl(1, '', 16); @@ -711,7 +729,10 @@ while ($i < $imaxinloop) { print ''.$product_static->LibStatut($objp->tobuy, 5, 1).'