Merge remote-tracking branch 'upstream/develop' into 16p10-reconcilev2

This commit is contained in:
Alexandre SPANGARO 2022-10-06 17:30:38 +02:00
commit b47f5cd19d
202 changed files with 1369 additions and 833 deletions

View File

@ -25,6 +25,7 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. * Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
* All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead

View File

@ -53,7 +53,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { // If we can read accounting records, we should be able to see fiscal year. if (!$user->hasRight('accounting', 'fiscalyear', 'write')) { // If we can read accounting records, we should be able to see fiscal year.
accessforbidden(); accessforbidden();
} }

View File

@ -35,7 +35,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden(); accessforbidden();
} }

View File

@ -34,7 +34,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden(); accessforbidden();
} }

View File

@ -45,7 +45,7 @@ $langs->loadLangs(array("companies", "compta", "accountancy", "products"));
if (!isModEnabled('accounting')) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->bind->write)) { if (!$user->hasRight('accounting', 'bind', 'write')) {
accessforbidden(); accessforbidden();
} }

View File

@ -150,7 +150,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }

View File

@ -86,7 +86,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }

View File

@ -155,7 +155,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$form = new Form($db); $form = new Form($db);
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) { if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
@ -221,7 +221,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -434,7 +434,7 @@ if (empty($reshook)) {
$param .= '&search_import_key='.urlencode($search_import_key); $param .= '&search_import_key='.urlencode($search_import_key);
} }
//if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { //if ($action == 'delbookkeepingyearconfirm' && !$user->hasRight('accounting', 'mouvements', 'supprimer_tous')) {
// $delmonth = GETPOST('delmonth', 'int'); // $delmonth = GETPOST('delmonth', 'int');
// $delyear = GETPOST('delyear', 'int'); // $delyear = GETPOST('delyear', 'int');
// if ($delyear == -1) { // if ($delyear == -1) {
@ -486,7 +486,7 @@ if (empty($reshook)) {
$uploaddir = $conf->societe->dir_output; $uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if (!$error && $action == 'deletebookkeepingwritingauto' && $confirm == "yes" && $user->rights->accounting->mouvements->supprimer) { if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
$db->begin(); $db->begin();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
@ -539,7 +539,7 @@ if (empty($reshook)) {
} }
// others mass actions // others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if ($massaction == 'letteringauto') { if ($massaction == 'letteringauto') {
$lettering = new Lettering($db); $lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
@ -689,7 +689,7 @@ if (!empty($sortfield)) {
// Export into a file with format defined into setup (FEC, CSV, ...) // Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql // Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) { if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export. // TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export.
// Replace this with the query($sql) and loop on each line to export them. // Replace this with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1)); $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
@ -889,7 +889,7 @@ if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting-
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual'); $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual'); $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
} }
if ($user->rights->accounting->mouvements->supprimer) { if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
@ -925,8 +925,8 @@ if (empty($reshook)) {
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>'; $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
if (!empty($user->rights->accounting->mouvements->export)) { if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
} }
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
@ -937,7 +937,7 @@ if (empty($reshook)) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->hasRight('accounting', 'mouvements', 'creer'));
} }
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -194,7 +194,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -401,7 +401,7 @@ if (empty($reshook)) {
$uploaddir = $conf->societe->dir_output; $uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->rights->accounting->mouvements->supprimer) { if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
$db->begin(); $db->begin();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
@ -454,7 +454,7 @@ if (empty($reshook)) {
} }
// others mass actions // others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if ($massaction == 'letteringauto') { if ($massaction == 'letteringauto') {
$lettering = new Lettering($db); $lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
@ -616,13 +616,13 @@ print $formconfirm;
// List of mass actions available // List of mass actions available
$arrayofmassactions = array(); $arrayofmassactions = array();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto'); $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto'); $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual'); $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual'); $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
} }
if ($user->rights->accounting->mouvements->supprimer) { if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {

View File

@ -441,26 +441,40 @@ class AccountingJournal extends CommonObject
$langs->loadLangs(array("assets")); $langs->loadLangs(array("assets"));
// Clean parameters // Clean parameters
if (empty($type)) $type = 'view'; if (empty($type)) {
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; $type = 'view';
}
if (empty($in_bookkeeping)) {
$in_bookkeeping = 'notyet';
}
$sql = ""; $sql = "";
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
$sql .= " SELECT DISTINCT fk_docdet"; $sql .= " SELECT DISTINCT fk_docdet";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE doc_type = 'asset'"; $sql .= " WHERE doc_type = 'asset'";
$sql .= ")"; $sql .= ")";
} }*/
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { // FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
} }*/
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
// Compatibility with Mysql 5.7
if ($in_bookkeeping == 'already') {
$sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
} elseif ($in_bookkeeping == 'notyet') {
$sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
}
$sql .= " AND ad.ref != ''"; // not reversal lines $sql .= " AND ad.ref != ''"; // not reversal lines
if ($date_start && $date_end) { if ($date_start && $date_end) {
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'";
@ -470,9 +484,10 @@ class AccountingJournal extends CommonObject
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
} }
// Already in bookkeeping or not // Already in bookkeeping or not
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { // FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL"; $sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
} }*/
$sql .= " ORDER BY ad.depreciation_date"; $sql .= " ORDER BY ad.depreciation_date";
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -64,7 +64,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden(); accessforbidden();
} }

View File

@ -44,7 +44,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -54,7 +54,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if ($action == 'ventil' && $user->rights->accounting->bind->write) { if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
if (!$cancel) { if (!$cancel) {
if ($codeventil < 0) { if ($codeventil < 0) {
$codeventil = 0; $codeventil = 0;

View File

@ -47,7 +47,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->bind->write)) { if (!$user->hasRight('accounting', 'bind', 'write')) {
accessforbidden(); accessforbidden();
} }
@ -84,7 +84,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -93,7 +93,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database by removing binding done on non existing or no more existing accounts // Clean database by removing binding done on non existing or no more existing accounts
$db->begin(); $db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";

View File

@ -91,7 +91,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -126,7 +126,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_tvaintra = ''; $search_tvaintra = '';
} }
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
$error = 0; $error = 0;
if (!(GETPOST('account_parent', 'int') >= 0)) { if (!(GETPOST('account_parent', 'int') >= 0)) {

View File

@ -110,7 +110,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }

View File

@ -417,7 +417,7 @@ if ($result) {
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>'; print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Accounting account affected // Accounting account affected
print '<td class="center">'; print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();

View File

@ -290,6 +290,7 @@ print '<td class="right">' . $langs->trans("Debit") . '</td>';
print '<td class="right">' . $langs->trans("Credit") . '</td>'; print '<td class="right">' . $langs->trans("Credit") . '</td>';
print "</tr>\n"; print "</tr>\n";
if (is_array($journal_data) && !empty($journal_data)) {
foreach ($journal_data as $element_id => $element) { foreach ($journal_data as $element_id => $element) {
foreach ($element['blocks'] as $lines) { foreach ($element['blocks'] as $lines) {
foreach ($lines as $line) { foreach ($lines as $line) {
@ -306,6 +307,7 @@ foreach ($journal_data as $element_id => $element) {
} }
} }
} }
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -640,6 +640,7 @@ print '</form>';
/* /*
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. // Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
// TODO Must be implemented by PDF templates
// Ask for payment bank during order // Ask for payment bank during order
if ($conf->banque->enabled) { if ($conf->banque->enabled) {

View File

@ -128,6 +128,8 @@ if ($action == 'updateMask') {
if ($ret > 0) { if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} elseif ($action == 'unsetdoc') {
dolibarr_del_const($db, "CONTRACT_ADDON_PDF", $conf->entity);
} elseif ($action == 'setmod') { } elseif ($action == 'setmod') {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
@ -152,7 +154,16 @@ if ($action == 'updateMask') {
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == "allowonlinesign") {
if (!dolibarr_set_const($db, "CONTRACT_ALLOW_ONLINESIGN", $value, 0, 'int', $conf->entity)) {
$error++;
} }
} elseif ($action == "allowexternaldownload") {
if (!dolibarr_set_const($db, "CONTRACT_ALLOW_EXTERNAL_DOWNLOAD", $value, 0, 'int', $conf->entity)) {
$error++;
}
}
/* /*
@ -369,9 +380,9 @@ foreach ($dirmodels as $reldir) {
// Defaut // Defaut
print '<td class="center">'; print '<td class="center">';
if ($conf->global->CONTRACT_ADDON_PDF == $name) { if ($conf->global->CONTRACT_ADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on'); print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&amp;scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@ -469,6 +480,37 @@ print $form->selectyesno("activate_hideClosedServiceByDefault", (!empty($conf->g
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Allow online signing
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnlineSign").'</td>';
print '<td class="center">';
if ($conf->global->CONTRACT_ALLOW_ONLINESIGN) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activited"), 'switch_on');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
print '</tr>';
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
print '<td class="center">';
if ($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowexternaldownload&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activited"), 'switch_on');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowexternaldownload&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
print '</tr>';
print '</table>'; print '</table>';
print $form->buttonsSaveCancel("Save", ''); print $form->buttonsSaveCancel("Save", '');

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
@ -30,11 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('companies', 'products', 'admin')); $langs->loadLangs(array('companies', 'products', 'admin'));
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$currencycode = GETPOST('currencycode', 'alpha'); $currencycode = GETPOST('currencycode', 'alpha');
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
@ -49,25 +46,36 @@ $mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$cu
$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int'); $valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int');
$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int'); $valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int');
$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int'); $valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2); $valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
if ($action == 'update') { if (!$user->admin) {
$error = 0; accessforbidden();
$MAXDEC = 8;
if ($_POST[$mainmaxdecimalsunit] > $MAXDEC
|| $_POST[$mainmaxdecimalstot] > $MAXDEC
|| $_POST[$mainmaxdecimalsshown] > $MAXDEC) {
$error++;
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
} }
if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0
|| $_POST[$mainmaxdecimalstot] < 0 /*
|| $_POST[$mainmaxdecimalsshown] < 0) { * Actions
*/
if ($action == 'update' && !$cancel) {
$error = 0;
$MAXDEC = 8;
if ($valmainmaxdecimalsunit > $MAXDEC
|| $valmainmaxdecimalstot > $MAXDEC
|| $valmainmaxdecimalsshown > $MAXDEC) {
$error++;
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
$action = 'edit';
}
if ($valmainmaxdecimalsunit < 0
|| $valmainmaxdecimalstot < 0
|| $valmainmaxdecimalsshown < 0) {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
$action = 'edit';
} }
if ($valmainroundingruletot) { if ($valmainroundingruletot) {
@ -75,9 +83,23 @@ if ($action == 'update') {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
$action = 'edit';
} }
} }
if ((float) $valmainmaxdecimalsshown == 0) {
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
$action = 'edit';
}
if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorValueForTooLow", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
$action = 'edit';
}
if (!$error) { if (!$error) {
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
@ -144,24 +166,25 @@ if ($action == 'edit') {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'"></td></tr>'; print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainmaxdecimalstot.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'"></td></tr>'; print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
print '<td><input class="flat" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'"></td></tr>'; print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'"></td></tr>'; print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
print '</table>'; print '</table>';
print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">'; print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
@ -170,7 +193,7 @@ if ($action == 'edit') {
} else { } else {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
@ -191,7 +214,7 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().''.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@ -350,7 +350,7 @@ if (empty($reshook)) {
} }
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
$action = 'add'; $action = 'create';
} }
} }
@ -424,7 +424,7 @@ if (empty($reshook)) {
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
$action = 'add'; $action = 'create';
} }
} }
@ -654,7 +654,7 @@ $linkback = '';
$titlepicto = 'title_setup'; $titlepicto = 'title_setup';
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add&token='.newToken(); $url = DOL_URL_ROOT.'/admin/mails_templates.php?action=create';
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); $newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
@ -685,10 +685,11 @@ if ($action == 'delete') {
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
if ($action == 'add') { if ($action == 'create') {
// Form to add a new line // Form to add a new line
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -739,7 +740,6 @@ if ($action == 'add') {
if ($fieldlist[$field] == 'content_lines') { if ($fieldlist[$field] == 'content_lines') {
$valuetoshow = ''; $valuetoshow = '';
} }
if ($valuetoshow != '') { if ($valuetoshow != '') {
print '<th class="'.$align.'">'; print '<th class="'.$align.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
@ -820,16 +820,15 @@ if ($action == 'add') {
// Input field // Input field
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '').'">';
} elseif ($tmpfieldlist == 'joinfiles') { } elseif ($tmpfieldlist == 'joinfiles') {
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">'; print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
} else { } else {
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(!empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended = true; $okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$okforextended = false; $okforextended = false;
} }
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%'); $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
} }
print '</td>'; print '</td>';
@ -917,7 +916,7 @@ foreach ($fieldlist as $field => $value) {
print '</td>'; print '</td>';
} elseif ($value == 'fk_user') { } elseif ($value == 'fk_user') {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150'); print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150', 1);
print '</td>'; print '</td>';
} elseif ($value == 'topic') { } elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
@ -1024,7 +1023,7 @@ if ($num) {
$reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors; $error = $hookmanager->error; $errors = $hookmanager->errors;
// Show fields // Show main fields
if (empty($reshook)) { if (empty($reshook)) {
fieldList($fieldlist, $obj, $tabname[$id], 'edit'); fieldList($fieldlist, $obj, $tabname[$id], 'edit');
} }
@ -1045,7 +1044,7 @@ if ($num) {
foreach ($fieldsforcontent as $tmpfieldlist) { foreach ($fieldsforcontent as $tmpfieldlist) {
$showfield = 1; $showfield = 1;
$align = "left"; $align = "left";
$valuetoshow = $obj->{$tmpfieldlist}; $valuetoshow = $obj->$tmpfieldlist;
$class = 'tddict'; $class = 'tddict';
// Show value for field // Show value for field
@ -1059,7 +1058,7 @@ if ($num) {
} }
if ($tmpfieldlist == 'joinfiles') { if ($tmpfieldlist == 'joinfiles') {
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
} }
// If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email). // If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email).
@ -1204,7 +1203,7 @@ if ($num) {
if ($value == 'joinfiles') { if ($value == 'joinfiles') {
$align = "center"; $align = "center";
if ($valuetoshow) { if ($valuetoshow) {
$valuetoshow = 1; $valuetoshow = yn(1);
} else { } else {
$valuetoshow = ''; $valuetoshow = '';
} }
@ -1311,7 +1310,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if ($value == 'fk_user') { if ($value == 'fk_user') {
print '<td>'; print '<td>';
if ($user->admin) { if ($user->admin) {
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth300'); print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth200');
} else { } else {
if ($context == 'add') { // I am not admin and we show the add form if ($context == 'add') { // I am not admin and we show the add form
print $user->getNomUrl(1); // Me print $user->getNomUrl(1); // Me
@ -1335,29 +1334,29 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (getDolGlobalInt('MAIN_MULTILANGS')) { if (getDolGlobalInt('MAIN_MULTILANGS')) {
$selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang; $selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang;
if ($context == 'edit') { if ($context == 'edit') {
$selectedlang = $obj->{$value}; $selectedlang = $obj->lang;
} }
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
} else { } else {
if (!empty($obj->{$value})) { if (!empty($obj->lang)) {
print $obj->{$value}.' - '.$langs->trans('Language_'.$obj->{$value}); print $obj->lang.' - '.$langs->trans('Language_'.$obj->lang);
} }
$keyname = $value; $keyname = $value;
if ($keyname == 'lang') { if ($keyname == 'lang') {
$keyname = 'langcode'; // Avoid conflict with lang param $keyname = 'langcode'; // Avoid conflict with lang param
} }
print '<input type="hidden" value="'.(empty($obj->{$value}) ? '' : $obj->{$value}).'" name="'.$keyname.'">'; print '<input type="hidden" value="'.(empty($obj->lang) ? '' : $obj->lang).'" name="'.$keyname.'">';
} }
print '</td>'; print '</td>';
} elseif ($value == 'type_template') { } elseif ($value == 'type_template') {
// Le type de template // Le type de template
print '<td class="center">'; print '<td class="center">';
if ($context == 'edit' && !empty($obj->{$value}) && !in_array($obj->{$value}, array_keys($elementList))) { if ($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
// Current template type is an unknown type, so we must keep it as it is. // Current template type is an unknown type, so we must keep it as it is.
print '<input type="hidden" name="type_template" value="'.$obj->{$value}.'">'; print '<input type="hidden" name="type_template" value="'.$obj->type_template.'">';
print $obj->{$value}; print $obj->type_template;
} else { } else {
print $form->selectarray('type_template', $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1); print $form->selectarray('type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
} }
print '</td>'; print '</td>';
} elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
@ -1378,7 +1377,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$class = 'maxwidth50'; $classtd = 'center'; $class = 'maxwidth50'; $classtd = 'center';
} }
if ($value == 'position') { if ($value == 'position') {
$class = 'maxwidth50'; $classtd = 'center'; $class = 'maxwidth50 center'; $classtd = 'center';
} }
if ($value == 'libelle') { if ($value == 'libelle') {
$class = 'quatrevingtpercent'; $class = 'quatrevingtpercent';
@ -1395,7 +1394,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (empty($user->admin)) { if (empty($user->admin)) {
print $form->selectyesno($value, '1', 1); print $form->selectyesno($value, '1', 1);
} else { } else {
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1); print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1);
} }
} else { } else {

View File

@ -85,7 +85,11 @@ if ($action == 'update') {
} }
} }
if (GETPOSTISSET($constvalue.'_SCOPE')) { if (GETPOSTISSET($constvalue.'_SCOPE')) {
if (is_array(GETPOST($constvalue.'_SCOPE'))) {
$scopestring = implode(',', GETPOST($constvalue.'_SCOPE')); $scopestring = implode(',', GETPOST($constvalue.'_SCOPE'));
} else {
$scopestring = GETPOST($constvalue.'_SCOPE');
}
if (!dolibarr_set_const($db, $constvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, $constvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
@ -97,6 +101,7 @@ if ($action == 'update') {
} }
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null); setEventMessages($langs->trans("SetupSaved"), null);
} else { } else {
@ -104,6 +109,48 @@ if ($action == 'update') {
} }
} }
if ($action == 'confirm_delete') {
$provider = GETPOST('provider', 'aZ09');
$label = GETPOST('label');
$globalkey = empty($provider) ? $label : $label.'-'.$provider;
if (getDolGlobalString($globalkey.'_ID') && getDolGlobalString($globalkey.'_SECRET')) { // If ID and secret exist, we delete first the token
$backtourl = DOL_URL_ROOT.'/admin/oauth.php?action=delete_entry&provider='.$provider.'&label='.$label.'&token='.newToken();
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
$callbacktodel = $urlwithroot;
if ($label == 'OAUTH_GOOGLE') {
$callbacktodel .= '/core/modules/oauth/google_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
} elseif ($label == 'OAUTH_GITHUB') {
$callbacktodel .= '/core/modules/oauth/github_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
} elseif ($label == 'OAUTH_STRIPE_LIVE') {
$callbacktodel .= '/core/modules/oauth/stripelive_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
} elseif ($label == 'OAUTH_STRIPE_TEST') {
$callbacktodel .= '/core/modules/oauth/stripetest_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
} elseif ($label == 'OAUTH_OTHER') {
$callbacktodel .= '/core/modules/oauth/generic_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
}
header("Location: ".$callbacktodel);
exit;
} else {
$action = 'delete_entry';
}
}
if ($action == 'delete_entry') {
$provider = GETPOST('provider', 'aZ09');
$label = GETPOST('label');
$globalkey = empty($provider) ? $label : $label.'-'.$provider;
if (!dolibarr_del_const($db, $globalkey.'_NAME', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_ID', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_SECRET', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_URLAUTHORIZE', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_SCOPE', $conf->entity)) {
setEventMessages($langs->trans("ErrorInEntryDeletion"), null, 'errors');
$error++;
} else {
setEventMessages($langs->trans("EntryDeleted"), null);
}
}
/* /*
* View * View
@ -112,6 +159,13 @@ if ($action == 'update') {
llxHeader(); llxHeader();
$form = new Form($db); $form = new Form($db);
// Confirmation of action process
if ($action == 'delete') {
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?provider='.GETPOST('provider').'&label='.GETPOST('label'), $langs->trans('OAuthServiceConfirmDeleteTitle'), $langs->trans('OAuthServiceConfirmDeleteMessage'), 'confirm_delete', $formquestion, 0, 1, 220);
print $formconfirm;
}
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup'); print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
@ -227,6 +281,18 @@ if (count($listinsetup) > 0) {
print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']); print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
} }
print '</td>'; print '</td>';
print '<td>';
$label = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&provider='.$keyforprovider.'&label='.$label.'">';
print img_picto('', 'delete');
print '</a>';
print '</form>';
print '</td>';
print '</tr>'; print '</tr>';
if ($supported) { if ($supported) {

View File

@ -291,6 +291,14 @@ if ($mode == 'setup' && $user->admin) {
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Scopes
print '<tr class="oddeven">';
print '<td>'.$langs->trans("Scopes").'</td>';
print '<td colspan="2">';
$currentscopes = getDolGlobalString($key[4]);
print $currentscopes;
print '</td></tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>'; print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
//var_dump($key); //var_dump($key);

View File

@ -445,7 +445,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled)) { || isModEnabled('mrp')) {
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs. $virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
} }

View File

@ -388,7 +388,7 @@ foreach ($dirmodels as $reldir) {
if (in_array($name, $def)) { if (in_array($name, $def)) {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
} else { } else {
@ -397,17 +397,16 @@ foreach ($dirmodels as $reldir) {
print "</td>"; print "</td>";
} else { } else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&amp;scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
} }
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") {
// print img_picto($langs->trans("Default"), 'on'); print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@ -425,7 +424,7 @@ foreach ($dirmodels as $reldir) {
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -122,7 +122,7 @@ if (empty($conf->global->MAIN_MODULE_API)) {
// Test if explorer is not disabled // Test if explorer is not disabled
if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) { if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) {
$langs->load("admin"); $langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled"); dol_syslog("Call Dolibarr API interfaces with module API REST disabled");
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>'; print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
//session_destroy(); //session_destroy();
exit(0); exit(0);
@ -155,6 +155,10 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
$refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false); $refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) { if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
$refreshcache = true; $refreshcache = true;
if (!is_writable($conf->api->dir_temp)) {
print 'Erreur temp dir api/temp not writable';
exit(0);
}
} }
$api = new DolibarrApi($db, '', $refreshcache); $api = new DolibarrApi($db, '', $refreshcache);

View File

@ -356,7 +356,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) { if (empty($reshook)) {
// Send // Send
if (empty($user->socid)) { if (empty($user->socid)) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
} }
if ($object->status == $object::STATUS_DRAFT) { if ($object->status == $object::STATUS_DRAFT) {

View File

@ -1673,10 +1673,10 @@ class Categorie extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Deplace fichier uploade sous le nom $files dans le repertoire sdir * Deplace fichier uploade sous le nom $file dans le repertoire sdir
* *
* @param string $sdir Repertoire destination finale * @param string $sdir Final destination directory
* @param string $file Nom du fichier uploade * @param array $file Uploaded file name
* @return void * @return void
*/ */
public function add_photo($sdir, $file) public function add_photo($sdir, $file)

View File

@ -227,13 +227,13 @@ if (empty($reshook)) {
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid; $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid;
$onlinepaymentenabled = 0; $onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) { if (isModEnabled('paypal')) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if (!empty($conf->paybox->enabled)) { if (isModEnabled('paybox')) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if (!empty($conf->stripe->enabled)) { if (isModEnabled('stripe')) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
@ -263,7 +263,7 @@ if (empty($reshook)) {
$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" rel="noopener noreferrer" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>'; $substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" rel="noopener noreferrer" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>';
} }
/* For backward compatibility, deprecated */ /* For backward compatibility, deprecated */
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) { if (isModEnabled('paypal') && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {
$substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) { if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {

View File

@ -119,6 +119,15 @@ class AdvanceTargetingMailing extends CommonObject
'3' => $langs->trans('ThirdParty'), '3' => $langs->trans('ThirdParty'),
'4' => $langs->trans('ContactsWithThirdpartyFilter') '4' => $langs->trans('ContactsWithThirdpartyFilter')
); );
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
$customerStatic = new Client($this->db);
$customerStatic->loadCacheOfProspStatus();
if (!empty($customerStatic->cacheprospectstatus)) {
foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) {
$this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label'];
}
} else {
$this->type_statuscommprospect = array( $this->type_statuscommprospect = array(
-1 => $langs->trans("StatusProspect-1"), -1 => $langs->trans("StatusProspect-1"),
0 => $langs->trans("StatusProspect0"), 0 => $langs->trans("StatusProspect0"),
@ -127,6 +136,7 @@ class AdvanceTargetingMailing extends CommonObject
3 => $langs->trans("StatusProspect3") 3 => $langs->trans("StatusProspect3")
); );
} }
}
/** /**
* Create object into database * Create object into database

View File

@ -355,7 +355,7 @@ class FormAdvTargetEmailing extends Form
$out = ''; $out = '';
$sql = "SELECT c.rowid, c.name, c.fk_element"; $sql = "SELECT c.rowid, c.name, c.fk_element";
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as c";
$sql .= " WHERE type_element = '".$this->db->escape($type_element)."'"; $sql .= " WHERE type_element = '".$this->db->escape($type_element)."'";
$sql .= " ORDER BY c.name"; $sql .= " ORDER BY c.name";

View File

@ -61,10 +61,10 @@ if (isModEnabled('variants')) {
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings', 'other')); $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings', 'other'));
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$langs->load('incoterm'); $langs->load('incoterm');
} }
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$langs->load('margins'); $langs->load('margins');
} }
@ -375,7 +375,7 @@ if (empty($reshook)) {
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) { } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) {
// Set incoterm // Set incoterm
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} elseif ($action == 'add' && $usercancreate) { } elseif ($action == 'add' && $usercancreate) {
@ -1048,7 +1048,7 @@ if (empty($reshook)) {
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter); $result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
if ($result) { if ($result) {
// If there is some prices specific to the customer // If there is some prices specific to the customer
if (count($prodcustprice->lines) > 0) { if (count($prodcustprice->lines) > 0) {
@ -1870,7 +1870,7 @@ if ($action == 'create') {
} }
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
print '<tr class="field_incoterm_id">'; print '<tr class="field_incoterm_id">';
print '<td class="titlefieldcreate"><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>'; print '<td class="titlefieldcreate"><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
print '<td class="valuefieldcreate maxwidthonsmartphone">'; print '<td class="valuefieldcreate maxwidthonsmartphone">';
@ -2655,7 +2655,7 @@ if ($action == 'create') {
} }
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
print '<tr><td>'; print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>'; print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel'); print $langs->trans('IncotermLabel');
@ -2737,7 +2737,7 @@ if ($action == 'create') {
print '</table>'; print '</table>';
// Margin Infos // Margin Infos
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$formmargin->displayMarginInfos($object); $formmargin->displayMarginInfos($object);
} }
@ -2855,11 +2855,7 @@ if ($action == 'create') {
// Send // Send
if (empty($user->socid)) { if (empty($user->socid)) {
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($usercansend) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '', $usercansend);
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('SendMail').'</a>';
}
} }
} }

View File

@ -1412,7 +1412,7 @@ class Propal extends CommonObject
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$prodcustprice = new Productcustomerprice($this->db); $prodcustprice = new Productcustomerprice($this->db);
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id); $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter); $result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
if ($result) { if ($result) {
// If there is some prices specific to the customer // If there is some prices specific to the customer
if (count($prodcustprice->lines) > 0) { if (count($prodcustprice->lines) > 0) {

View File

@ -312,7 +312,7 @@ if (isModEnabled("propal") && $user->rights->propale->lire) {
*/ */
/* /*
if (!empty($conf->propal->enabled)) if (isModEnabled('propal'))
{ {
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid";
$sql.=" FROM ".MAIN_DB_PREFIX."propal as c"; $sql.=" FROM ".MAIN_DB_PREFIX."propal as c";
@ -387,7 +387,7 @@ if (!empty($conf->propal->enabled))
*/ */
/* /*
if (!empty($conf->propal->enabled)) if (isModEnabled('propal'))
{ {
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";

View File

@ -536,7 +536,7 @@ $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formpropal = new FormPropal($db); $formpropal = new FormPropal($db);
$formmargin = null; $formmargin = null;
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$formmargin = new FormMargin($db); $formmargin = new FormMargin($db);
} }
$companystatic = new Societe($db); $companystatic = new Societe($db);
@ -1573,7 +1573,7 @@ if ($resql) {
$typenArray = null; $typenArray = null;
$with_margin_info = false; $with_margin_info = false;
if (!empty($conf->margin->enabled) && ( if (isModEnabled('margin') && (
!empty($arrayfields['total_pa']['checked']) !empty($arrayfields['total_pa']['checked'])
|| !empty($arrayfields['total_margin']['checked']) || !empty($arrayfields['total_margin']['checked'])
|| !empty($arrayfields['total_margin_rate']['checked']) || !empty($arrayfields['total_margin_rate']['checked'])

View File

@ -790,7 +790,7 @@ if (empty($reshook)) {
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter); $result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
if ($result >= 0) { if ($result >= 0) {
if (count($prodcustprice->lines) > 0) { if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price); $pu_ht = price($prodcustprice->lines[0]->price);
@ -2793,7 +2793,7 @@ if ($action == 'create' && $usercancreate) {
if (empty($user->socid)) { if (empty($user->socid)) {
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($usercansend) { if ($usercansend) {
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&amp;token='.newToken().'&amp;id='.$object->id.'&amp;mode=init#formmailbeforetitle', ''); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
} else { } else {
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
} }

View File

@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
} }
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -80,6 +80,7 @@ $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha
$search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha');
$search_company = GETPOST('search_company', 'alpha'); $search_company = GETPOST('search_company', 'alpha');
$search_company_alias = GETPOST('search_company_alias', 'alpha'); $search_company_alias = GETPOST('search_company_alias', 'alpha');
$search_parent_name = trim(GETPOST('search_parent_name', 'alphanohtml'));
$search_town = GETPOST('search_town', 'alpha'); $search_town = GETPOST('search_town', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST('search_state', 'alpha'); $search_state = GETPOST('search_state', 'alpha');
@ -178,6 +179,7 @@ $arrayfields = array(
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>25), 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>25),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31), 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31),
's2.nom'=>array('label'=>'ParentCompany', 'position'=>32, 'checked'=>0),
's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35), 's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35),
's.zip'=>array('label'=>"Zip", 'checked'=>-1, 'position'=>40), 's.zip'=>array('label'=>"Zip", 'checked'=>-1, 'position'=>40),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>45), 'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>45),
@ -199,10 +201,10 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
@ -253,6 +255,7 @@ if (empty($reshook)) {
$search_ref_customer = ''; $search_ref_customer = '';
$search_company = ''; $search_company = '';
$search_company_alias = ''; $search_company_alias = '';
$search_parent_name = '';
$search_town = ''; $search_town = '';
$search_zip = ""; $search_zip = "";
$search_state = ""; $search_state = "";
@ -778,10 +781,11 @@ $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formmargin = null; $formmargin = null;
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$formmargin = new FormMargin($db); $formmargin = new FormMargin($db);
} }
$companystatic = new Societe($db); $companystatic = new Societe($db);
$company_url_list = array();
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$projectstatic = new Project($db); $projectstatic = new Project($db);
@ -793,6 +797,8 @@ if ($sall || $search_product_category > 0 || $search_user > 0) {
$sql = 'SELECT DISTINCT'; $sql = 'SELECT DISTINCT';
} }
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,';
$sql .= " s.parent as fk_parent,";
$sql .= " s2.nom as name2,";
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " country.code as country_code,"; $sql .= " country.code as country_code,";
@ -820,6 +826,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
@ -937,6 +944,9 @@ if ($search_company) {
if ($search_company_alias) { if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias); $sql .= natural_search('s.name_alias', $search_company_alias);
} }
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
}
if ($search_sale > 0) { if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
} }
@ -1121,6 +1131,9 @@ if ($resql) {
if ($search_company_alias) { if ($search_company_alias) {
$param .= '&search_company_alias='.urlencode($search_company_alias); $param .= '&search_company_alias='.urlencode($search_company_alias);
} }
if ($search_parent_name != '') {
$param .= '&search_parent_name='.urlencode($search_parent_name);
}
if ($search_ref_customer) { if ($search_ref_customer) {
$param .= '&search_ref_customer='.urlencode($search_ref_customer); $param .= '&search_ref_customer='.urlencode($search_ref_customer);
} }
@ -1451,6 +1464,12 @@ if ($resql) {
print '<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'">'; print '<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'">';
print '</td>'; print '</td>';
} }
// Parent company
if (!empty($arrayfields['s2.nom']['checked'])) {
print '<td class="liste_titre center">';
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).'">';
print '</td>';
}
// Town // Town
if (!empty($arrayfields['s.town']['checked'])) { if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>'; print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
@ -1707,6 +1726,9 @@ if ($resql) {
if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['s.name_alias']['checked'])) {
print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['s2.nom']['checked'])) {
print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER['PHP_SELF'], 's2.nom', '', $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['s.town']['checked'])) { if (!empty($arrayfields['s.town']['checked'])) {
print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
} }
@ -1850,7 +1872,7 @@ if ($resql) {
$i = 0; $i = 0;
$with_margin_info = false; $with_margin_info = false;
if (!empty($conf->margin->enabled) && ( if (isModEnabled('margin') && (
!empty($arrayfields['total_pa']['checked']) !empty($arrayfields['total_pa']['checked'])
|| !empty($arrayfields['total_margin']['checked']) || !empty($arrayfields['total_margin']['checked'])
|| !empty($arrayfields['total_margin_rate']['checked']) || !empty($arrayfields['total_margin_rate']['checked'])
@ -2008,6 +2030,27 @@ if ($resql) {
} }
} }
// Parent company
if (!empty($arrayfields['s2.nom']['checked'])) {
print '<td class="center tdoverflowmax100">';
if ($obj->fk_parent > 0) {
if (!isset($company_url_list[$obj->fk_parent])) {
$companyparent = new Societe($db);
$res = $companyparent->fetch($obj->fk_parent);
if ($res > 0) {
$company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
}
}
if (isset($company_url_list[$obj->fk_parent])) {
print $company_url_list[$obj->fk_parent];
}
}
print "</td>";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Town // Town
if (!empty($arrayfields['s.town']['checked'])) { if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';

View File

@ -1385,6 +1385,7 @@ if (empty($reshook)) {
$object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_public = trim(GETPOST('note_public', 'restricthtml'));
$object->note_private = trim(GETPOST('note_private', 'restricthtml')); $object->note_private = trim(GETPOST('note_private', 'restricthtml'));
$object->ref_client = GETPOST('ref_client'); $object->ref_client = GETPOST('ref_client');
$object->ref_customer = GETPOST('ref_client');
$object->model_pdf = GETPOST('model'); $object->model_pdf = GETPOST('model');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id')); $object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
@ -5460,7 +5461,6 @@ if ($action == 'create') {
if (empty($reshook)) { if (empty($reshook)) {
$params = array( $params = array(
'attr' => array( 'attr' => array(
'title' => '',
'class' => 'classfortooltip' 'class' => 'classfortooltip'
) )
); );
@ -5535,9 +5535,9 @@ if ($action == 'create') {
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>'; print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
} else { } else {
if ($usercansend) { if ($usercansend) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
} else { } else {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
} }
} }
} }
@ -5802,7 +5802,7 @@ if ($action == 'create') {
// Show online payment link // Show online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); $useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
print '<br><!-- Link to pay -->'."\n"; print '<br><!-- Link to pay -->'."\n";

View File

@ -245,10 +245,10 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>292), 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>295), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>296), // Not enabled by default because slow 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502),
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))), 'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),

View File

@ -757,14 +757,14 @@ class BonPrelevement extends CommonObject
$error = 0; $error = 0;
$datetimeprev = time(); $datetimeprev = dol_now('gmt');
//Choice the date of the execution direct debit //Choice the date of the execution direct debit
if (!empty($executiondate)) { if (!empty($executiondate)) {
$datetimeprev = $executiondate; $datetimeprev = $executiondate;
} }
$month = strftime("%m", $datetimeprev); $month = dol_print_date($datetimeprev, "%m", 'gmt');
$year = strftime("%Y", $datetimeprev); $year = dol_print_date($datetimeprev, "%Y", 'gmt');
$this->invoice_in_error = array(); $this->invoice_in_error = array();
$this->thirdparty_in_error = array(); $this->thirdparty_in_error = array();
@ -1709,7 +1709,7 @@ class BonPrelevement extends CommonObject
{ {
global $langs; global $langs;
$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation) $pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); return $pre.($row_code_client ? '-'.$row_code_client : '').'-'.$row_drum.'-'.date('U', $row_datec);
} }
@ -1743,8 +1743,8 @@ class BonPrelevement extends CommonObject
// Date d'echeance C1 // Date d'echeance C1
fputs($this->file, " "); fputs($this->file, " ");
fputs($this->file, strftime("%d%m", $this->date_echeance)); fputs($this->file, dol_print_date($this->date_echeance, "%d%m", 'gmt'));
fputs($this->file, substr(strftime("%y", $this->date_echeance), 1)); fputs($this->file, substr(dol_print_date($this->date_echeance, "%y", 'gmt'), 1));
// Raison Sociale Destinataire C2 // Raison Sociale Destinataire C2
@ -1823,8 +1823,8 @@ class BonPrelevement extends CommonObject
$Rowing = sprintf("%010d", $row_idfac); $Rowing = sprintf("%010d", $row_idfac);
// Define value for RUM // Define value for RUM
// Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId) // Example: RUM-CustomerCode-CustomerBankAccountId-01424448606 (note: Date is the timestamp of the date of creation of CustomerBankAccountId)
$Rum = empty($row_rum) ? $this->buildRumNumber($row_code_client, $row_datec, $row_drum) : $row_rum; $Rum = (empty($row_rum) ? $this->buildRumNumber($row_code_client, $row_datec, $row_drum) : $row_rum);
// Define date of RUM signature // Define date of RUM signature
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
@ -1969,8 +1969,8 @@ class BonPrelevement extends CommonObject
// Date d'echeance C1 // Date d'echeance C1
fputs($this->file, " "); fputs($this->file, " ");
fputs($this->file, strftime("%d%m", $this->date_echeance)); fputs($this->file, dol_print_date($this->date_echeance, "%d%m", 'gmt'));
fputs($this->file, substr(strftime("%y", $this->date_echeance), 1)); fputs($this->file, substr(dol_print_date($this->date_echeance, "%y", 'gmt'), 1));
// Raison Sociale C2 // Raison Sociale C2

View File

@ -1228,6 +1228,15 @@ class Contact extends CommonObject
$this->db->begin(); $this->db->begin();
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) { if (!$error) {
// Get all rowid of element_contact linked to a type that is link to llx_socpeople // Get all rowid of element_contact linked to a type that is link to llx_socpeople
$sql = "SELECT ec.rowid"; $sql = "SELECT ec.rowid";
@ -1318,15 +1327,6 @@ class Contact extends CommonObject
} }
} }
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) { if (!$error) {
$this->db->commit(); $this->db->commit();
return 1; return 1;

View File

@ -498,7 +498,7 @@ if (empty($reshook)) {
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter); $result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
if ($result) { if ($result) {
if (count($prodcustprice->lines) > 0) { if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price); $pu_ht = price($prodcustprice->lines[0]->price);
@ -1476,7 +1476,7 @@ if ($action == 'create') {
$productstatic = new Product($db); $productstatic = new Product($db);
$usemargins = 0; $usemargins = 0;
if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) { if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) {
$usemargins = 1; $usemargins = 1;
} }
@ -1522,7 +1522,7 @@ if ($action == 'create') {
print '<td width="30" class="left">'.$langs->trans("Unit").'</td>'; print '<td width="30" class="left">'.$langs->trans("Unit").'</td>';
} }
print '<td width="50" class="right">'.$langs->trans("ReductionShort").'</td>'; print '<td width="50" class="right">'.$langs->trans("ReductionShort").'</td>';
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
print '<td width="50" class="right">'.$langs->trans("BuyingPrice").'</td>'; print '<td width="50" class="right">'.$langs->trans("BuyingPrice").'</td>';
} }
print '<td width="30">&nbsp;</td>'; print '<td width="30">&nbsp;</td>';
@ -1592,7 +1592,7 @@ if ($action == 'create') {
} }
// Margin // Margin
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
print '<td class="right nowraponall">'.price($objp->pa_ht).'</td>'; print '<td class="right nowraponall">'.price($objp->pa_ht).'</td>';
} }
@ -1749,7 +1749,7 @@ if ($action == 'create') {
print '</tr>'; print '</tr>';
$colspan = 6; $colspan = 6;
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
$colspan++; $colspan++;
} }
if (!empty($conf->global->PRODUCT_USE_UNITS)) { if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -2092,9 +2092,9 @@ if ($action == 'create') {
if (empty($user->socid)) { if (empty($user->socid)) {
if ($object->statut == 1) { if ($object->statut == 1) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
} else { } else {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
} }
} }
} }
@ -2206,12 +2206,21 @@ if ($action == 'create') {
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show online signature link
if ($object->statut != Contrat::STATUS_DRAFT && $conf->global->CONTRACT_ALLOW_ONLINESIGN) {
print '<br><!-- Link to sign -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
print showOnlineSignatureUrl('contract', $object->ref).'<br>';
}
print '</div><div class="fichehalfright">'; print '</div><div class="fichehalfright">';
$MAXEVENT = 10; $MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id); $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id);
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db); $formactions = new FormActions($db);
@ -2237,7 +2246,7 @@ $db->close();
?> ?>
<?php <?php
if (!empty($conf->margin->enabled) && $action == 'editline') { if (isModEnabled('margin') && $action == 'editline') {
// TODO Why this ? To manage margin on contracts ? // TODO Why this ? To manage margin on contracts ?
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -663,7 +663,7 @@ class Contrat extends CommonObject
$sql .= " fk_user_author,"; $sql .= " fk_user_author,";
$sql .= " fk_projet as fk_project,"; $sql .= " fk_projet as fk_project,";
$sql .= " fk_commercial_signature, fk_commercial_suivi,"; $sql .= " fk_commercial_signature, fk_commercial_suivi,";
$sql .= " note_private, note_public, model_pdf, extraparams"; $sql .= " note_private, note_public, model_pdf, last_main_doc, extraparams";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat";
if (!$id) { if (!$id) {
$sql .= " WHERE entity IN (".getEntity('contract').")"; $sql .= " WHERE entity IN (".getEntity('contract').")";
@ -717,7 +717,7 @@ class Contrat extends CommonObject
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->fk_soc = $obj->fk_soc; $this->fk_soc = $obj->fk_soc;
$this->last_main_doc = $obj->last_main_doc;
$this->extraparams = (array) json_decode($obj->extraparams, true); $this->extraparams = (array) json_decode($obj->extraparams, true);
$this->db->free($resql); $this->db->free($resql);

View File

@ -841,7 +841,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
} }
$pdf->SetFont(pdf_getPDFFont($outputlangs)); $pdf->SetFont(pdf_getPDFFont($outputlangs));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }

View File

@ -28,9 +28,10 @@ if (!defined('NOREQUIREHTML')) {
if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1'); define('NOREQUIREAJAX', '1');
} }
if (!defined('NOREQUIRESOC')) { // Needed to create other objects with workflow
/*if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1'); define('NOREQUIRESOC', '1');
} }*/
// Do not check anti CSRF attack test // Do not check anti CSRF attack test
if (!defined('NOREQUIREMENU')) { if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1'); define('NOREQUIREMENU', '1');
@ -224,6 +225,95 @@ if ($action == "importSignature") {
$response = "error sql"; $response = "error sql";
} }
} }
} elseif ($mode == 'contract') {
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
$object = new Contrat($db);
$object->fetch(0, $ref);
$upload_dir = !empty($conf->contrat->multidir_output[$object->entity])?$conf->contrat->multidir_output[$object->entity]:$conf->contrat->dir_output;
$upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/';
$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
$filename = "signatures/".$date."_signature.png";
if (!is_dir($upload_dir."signatures/")) {
if (!dol_mkdir($upload_dir."signatures/")) {
$response ="Error mkdir. Failed to create dir ".$upload_dir."signatures/";
$error++;
}
}
if (!$error) {
$return = file_put_contents($upload_dir.$filename, $data);
if ($return == false) {
$error++;
$response = 'Error file_put_content: failed to create signature file.';
}
}
if (!$error) {
// Defined modele of doc
$last_main_doc_file = $object->last_main_doc;
$directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc
if (preg_match('/\.pdf/i', $last_main_doc_file)) {
// TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
$sourcefile = $upload_dir.$ref.".pdf";
if (dol_is_file($sourcefile)) {
// We build the new PDF
$pdf = pdf_getInstance();
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($langs));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);
}
//$pdf->Open();
$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
$s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297);
for ($i=1; $i<($pagecount+1); $i++) {
try {
$tppl = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tppl);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tppl);
} catch (Exception $e) {
dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR);
$response = $e->getMessage();
$error++;
}
}
// A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF
// TODO Get position of box from PDF template
$xforimgstart = 5;
$yforimgstart = (empty($s['h']) ? 240 : $s['h'] - 65);
$wforimg = $s['w']/2 - $xforimgstart;
$pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4));
//$pdf->Close();
$pdf->Output($newpdffilename, "F");
// Index the new file and update the last_main_doc property of object.
$object->indexFile($newpdffilename, 1);
}
if (!$error) {
$response = "success";
}
} elseif (preg_match('/\.odt/i', $last_main_doc_file)) {
// Adding signature on .ODT not yet supported
// TODO
} else {
// Document format not supported to insert online signature.
// We should just create an image file with the signature.
}
}
} }
} else { } else {
$error++; $error++;

View File

@ -110,10 +110,10 @@ class box_graph_product_distribution extends ModeleBoxes
if (!isModEnabled('facture') || empty($user->rights->facture->lire)) { if (!isModEnabled('facture') || empty($user->rights->facture->lire)) {
$showinvoicenb = 0; $showinvoicenb = 0;
} }
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) { if (isModEnabled('propal') || empty($user->rights->propale->lire)) {
$showpropalnb = 0; $showpropalnb = 0;
} }
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) { if (!isModEnabled('commande') || empty($user->rights->commande->lire)) {
$showordernb = 0; $showordernb = 0;
} }

View File

@ -1276,7 +1276,7 @@ abstract class CommonInvoice extends CommonObject
dol_syslog("The payment has been created for invoice id " . $this->id); dol_syslog("The payment has been created for invoice id " . $this->id);
} }
if (!$errorforinvoice && !empty($conf->banque->enabled)) { if (!$errorforinvoice && isModEnabled('banque')) {
dol_syslog('* Add payment to bank'); dol_syslog('* Add payment to bank');
$bankaccountid = 0; $bankaccountid = 0;

View File

@ -1534,7 +1534,6 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return array with list of possible values for type of contacts * Return array with list of possible values for type of contacts
* *
@ -1548,7 +1547,6 @@ abstract class CommonObject
*/ */
public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '') public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '')
{ {
// phpcs:enable
global $langs, $conf; global $langs, $conf;
$langs->loadLangs(array('bills', 'contracts', 'interventions', 'orders', 'projects', 'propal', 'ticket', 'agenda')); $langs->loadLangs(array('bills', 'contracts', 'interventions', 'orders', 'projects', 'propal', 'ticket', 'agenda'));
@ -2072,7 +2070,7 @@ abstract class CommonObject
if ($resql) { if ($resql) {
if ($trigkey) { if ($trigkey) {
// call trigger with updated object values // call trigger with updated object values
if (empty($this->fields) && method_exists($this, 'fetch')) { if (method_exists($this, 'fetch')) {
$result = $this->fetch($id); $result = $this->fetch($id);
} else { } else {
$result = $this->fetchCommon($id); $result = $this->fetchCommon($id);
@ -3550,7 +3548,7 @@ abstract class CommonObject
if (!empty($conf->global->$MODULE)) { if (!empty($conf->global->$MODULE)) {
$modsactivated = explode(',', $conf->global->$MODULE); $modsactivated = explode(',', $conf->global->$MODULE);
foreach ($modsactivated as $mod) { foreach ($modsactivated as $mod) {
if ($conf->$mod->enabled) { if (isModEnabled($mod)) {
return 1; // update was disabled by specific setup return 1; // update was disabled by specific setup
} }
} }
@ -4105,7 +4103,7 @@ abstract class CommonObject
} }
// Here $module, $classfile and $classname are set, we can use them. // Here $module, $classfile and $classname are set, we can use them.
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { if (isModEnabled($module) && (($element != $this->element) || $alsosametype)) {
if ($loadalsoobjects && (is_numeric($loadalsoobjects) || ($loadalsoobjects === $objecttype))) { if ($loadalsoobjects && (is_numeric($loadalsoobjects) || ($loadalsoobjects === $objecttype))) {
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
//print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname); //print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname);
@ -4883,7 +4881,7 @@ abstract class CommonObject
// Define usemargins // Define usemargins
$usemargins = 0; $usemargins = 0;
if (!empty($conf->margin->enabled) && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) { if (isModEnabled('margin') && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) {
$usemargins = 1; $usemargins = 1;
} }
@ -9139,7 +9137,7 @@ abstract class CommonObject
// Clean and check mandatory // Clean and check mandatory
foreach ($keys as $key) { foreach ($keys as $key) {
// If field is an implicit foreign key field // If field is an implicit foreign key field (so type = 'integer:...')
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') { if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') {
$values[$key] = ''; $values[$key] = '';
} }
@ -9159,7 +9157,7 @@ abstract class CommonObject
$values[$key] = $this->quote($this->fields[$key]['default'], $this->fields[$key]); $values[$key] = $this->quote($this->fields[$key]['default'], $this->fields[$key]);
} }
// If field is an implicit foreign key field // If field is an implicit foreign key field (so type = 'integer:...')
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) { if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) {
if (isset($this->fields[$key]['default'])) { if (isset($this->fields[$key]['default'])) {
$values[$key] = ((int) $this->fields[$key]['default']); $values[$key] = ((int) $this->fields[$key]['default']);

View File

@ -1929,14 +1929,14 @@ class Form
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css * @param string $morecss More css
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @param int $notdisabled Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
* @param int $outputmode 0=HTML select string, 1=Array * @param int $outputmode 0=HTML select string, 1=Array
* @param bool $multiple add [] in the name of element and add 'multiple' attribut * @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param int $forcecombo Force the component to be a simple combo box without ajax * @param int $forcecombo Force the component to be a simple combo box without ajax
* @return string HTML select string * @return string HTML select string
* @see select_dolgroups() * @see select_dolgroups()
*/ */
public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false, $forcecombo = 0) public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $notdisabled = 0, $outputmode = 0, $multiple = false, $forcecombo = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $user, $langs, $hookmanager; global $conf, $user, $langs, $hookmanager;
@ -2005,7 +2005,7 @@ class Form
if ($includeUsers) { if ($includeUsers) {
$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
} }
if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) { if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $notdisabled) {
$sql .= " AND u.statut <> 0"; $sql .= " AND u.statut <> 0";
} }
if (!empty($morefilter)) { if (!empty($morefilter)) {
@ -2065,7 +2065,7 @@ class Form
$disableline = ($enableonlytext ? $enableonlytext : '1'); $disableline = ($enableonlytext ? $enableonlytext : '1');
} }
$labeltoshow = ''; $labeltoshow = ''; $labeltoshowhtml = '';
// $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0) // $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0)
$fullNameMode = 0; $fullNameMode = 0;
@ -2073,37 +2073,50 @@ class Form
$fullNameMode = 1; //Firstname+lastname $fullNameMode = 1; //Firstname+lastname
} }
$labeltoshow .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength); $labeltoshow .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
$labeltoshowhtml .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
if (empty($obj->firstname) && empty($obj->lastname)) { if (empty($obj->firstname) && empty($obj->lastname)) {
$labeltoshow .= $obj->login; $labeltoshow .= $obj->login;
$labeltoshowhtml .= $obj->login;
} }
// Complete name with more info // Complete name with a more info string like: ' (info1 - info2 - ...)'
$moreinfo = ''; $moreinfo = ''; $moreinfohtml = '';
if (!empty($conf->global->MAIN_SHOW_LOGIN)) { if (!empty($conf->global->MAIN_SHOW_LOGIN)) {
$moreinfo .= ($moreinfo ? ' - ' : ' (').$obj->login; $moreinfo .= ($moreinfo ? ' - ' : ' (');
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(');
$moreinfo .= $obj->login;
$moreinfohtml .= $obj->login;
} }
if ($showstatus >= 0) { if ($showstatus >= 0) {
if ($obj->status == 1 && $showstatus == 1) { if ($obj->status == 1 && $showstatus == 1) {
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
} }
if ($obj->status == 0 && $showstatus == 1) { if ($obj->status == 0 && $showstatus == 1) {
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
} }
} }
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
if (!$obj->entity) { if (!$obj->entity) {
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
} else { } else {
if ($obj->entity != $conf->entity) { if ($obj->entity != $conf->entity) {
$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
} }
} }
} }
$moreinfo .= ($moreinfo ? ')' : ''); $moreinfo .= ($moreinfo ? ')' : '');
$moreinfohtml .= ($moreinfohtml ? ')' : '');
if ($disableline && $disableline != '1') { if ($disableline && $disableline != '1') {
$moreinfo .= ' - '.$disableline; // This is text from $enableonlytext parameter // Add text from $enableonlytext parameter
$moreinfo .= ' - '.$disableline;
$moreinfohtml .= ' - '.$disableline;
} }
$labeltoshow .= $moreinfo; $labeltoshow .= $moreinfo;
$labeltoshowhtml .= $moreinfohtml;
$out .= '<option value="'.$obj->rowid.'"'; $out .= '<option value="'.$obj->rowid.'"';
if ($disableline) { if ($disableline) {
@ -2120,7 +2133,7 @@ class Form
if ($showstatus >= 0 && $obj->status == 0) { if ($showstatus >= 0 && $obj->status == 0) {
$outhtml .= '<strike class="opacitymediumxxx">'; $outhtml .= '<strike class="opacitymediumxxx">';
} }
$outhtml .= $labeltoshow; $outhtml .= $labeltoshowhtml;
if ($showstatus >= 0 && $obj->status == 0) { if ($showstatus >= 0 && $obj->status == 0) {
$outhtml .= '</strike>'; $outhtml .= '</strike>';
} }
@ -9439,7 +9452,7 @@ class Form
} }
} }
if (!empty($conf->gravatar->enabled) && $email && empty($noexternsourceoverwrite)) { if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
// see https://gravatar.com/site/implement/images/php/ // see https://gravatar.com/site/implement/images/php/
$ret .= '<!-- Put link to gravatar -->'; $ret .= '<!-- Put link to gravatar -->';
$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash

View File

@ -521,7 +521,8 @@ class FormMail extends Form
))) { ))) {
// If list of template is empty // If list of template is empty
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n"; $out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out .= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy. $out .= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> ';
$out .= '<select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy.
if ($user->admin) { if ($user->admin) {
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')), 1); $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')), 1);
} }
@ -750,7 +751,7 @@ class FormMail extends Form
} }
// Ask delivery receipt // Ask delivery receipt
if (!empty($this->withdeliveryreceipt)) { if (!empty($this->withdeliveryreceipt) && getDolGlobalInt('MAIN_EMAIL_SUPPORT_ACK')) {
$out .= $this->getHtmlForDeliveryReceipt(); $out .= $this->getHtmlForDeliveryReceipt();
} }
@ -1619,13 +1620,13 @@ class FormMail extends Form
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
$onlinepaymentenabled = 0; $onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) { if (isModEnabled('paypal')) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if (!empty($conf->paybox->enabled)) { if (isModEnabled('paybox')) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if (!empty($conf->stripe->enabled)) { if (isModEnabled('stripe')) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {

View File

@ -164,7 +164,7 @@ class Utils
} }
// Update cachenbofdoc // Update cachenbofdoc
if (!empty($conf->ecm->enabled) && $choice == 'allfiles') { if (isModEnabled('ecm') && $choice == 'allfiles') {
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$ecmdirstatic = new EcmDirectory($this->db); $ecmdirstatic = new EcmDirectory($this->db);
$result = $ecmdirstatic->refreshcachenboffile(1); $result = $ecmdirstatic->refreshcachenboffile(1);

View File

@ -64,9 +64,10 @@ interface Database
/** /**
* Start transaction * Start transaction
* *
* @param string $textinlog Add a small text into log. '' by default.
* @return int 1 if transaction successfuly opened or already opened, 0 if error * @return int 1 if transaction successfuly opened or already opened, 0 if error
*/ */
public function begin(); public function begin($textinlog = '');
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**

View File

@ -150,15 +150,16 @@ abstract class DoliDB implements Database
/** /**
* Start transaction * Start transaction
* *
* @param string $textinlog Add a small text into log. '' by default.
* @return int 1 if transaction successfuly opened or already opened, 0 if error * @return int 1 if transaction successfuly opened or already opened, 0 if error
*/ */
public function begin() public function begin($textinlog = '')
{ {
if (!$this->transaction_opened) { if (!$this->transaction_opened) {
$ret = $this->query("BEGIN"); $ret = $this->query("BEGIN");
if ($ret) { if ($ret) {
$this->transaction_opened++; $this->transaction_opened++;
dol_syslog("BEGIN Transaction", LOG_DEBUG); dol_syslog("BEGIN Transaction".($textinlog ? ' '.$textinlog : ''), LOG_DEBUG);
dol_syslog('', 0, 1); dol_syslog('', 0, 1);
} }
return $ret; return $ret;

View File

@ -99,13 +99,21 @@ function first_execution() {
function check_events() { function check_events() {
if (Notification.permission === "granted") if (Notification.permission === "granted")
{ {
var newToken = 'notrequired';
const allMeta = document.getElementsByTagName("meta");
for (let i = 0; i < allMeta.length; i++) {
if (allMeta[i].getAttribute("name") == 'anti-csrf-token') {
newToken = allMeta[i].getAttribute('content');
console.log("newToken in page = "+newToken);
}
}
time_js_next_test += time_auto_update; time_js_next_test += time_auto_update;
console.log("Call ajax to check_events with time_js_next_test = "+time_js_next_test); console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test);
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php'; ?>", { $.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php'; ?>", {
type: "post", // Usually post or get type: "post", // Usually post or get
async: true, async: true,
data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: 'notrequired' }, data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: newToken },
dataType: "json", dataType: "json",
success: function (result) { success: function (result) {
//console.log(result); //console.log(result);
@ -173,7 +181,7 @@ function check_events() {
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php?action=stopreminder&listofreminderids='; ?>"+listofreminderids, { $.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php?action=stopreminder&listofreminderids='; ?>"+listofreminderids, {
type: "POST", // Usually post or get type: "POST", // Usually post or get
async: true, async: true,
data: { time_js_next_test: time_js_next_test, token: 'notrequired' } data: { time_js_next_test: time_js_next_test, token: newToken }
}); });
} else { } else {
console.log("No reminder to do found, next search at "+time_js_next_test); console.log("No reminder to do found, next search at "+time_js_next_test);

View File

@ -962,7 +962,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$sortfield = "t.lastname"; $sortfield = "t.lastname";
} }
if (!empty($conf->clicktodial->enabled)) { if (isModEnabled('clicktodial')) {
$user->fetch_clicktodial(); // lecture des infos de clicktodial du user $user->fetch_clicktodial(); // lecture des infos de clicktodial du user
} }

View File

@ -3385,11 +3385,11 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
} }
} }
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone if ($conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
$newphoneform = $newphone; $newphoneform = $newphone;
$newphone = '<a href="tel:'.$phone.'"'; $newphone = '<a href="tel:'.$phone.'"';
$newphone .= '>'.$newphoneform.'</a>'; $newphone .= '>'.$newphoneform.'</a>';
} elseif (!empty($conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url } elseif (isModEnabled('clicktodial') && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url
if (empty($user->clicktodial_loaded)) { if (empty($user->clicktodial_loaded)) {
$user->fetch_clicktodial(); $user->fetch_clicktodial();
} }
@ -6371,7 +6371,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. // Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
if (($seller_country_code == $buyer_country_code) if (($seller_country_code == $buyer_country_code)
|| (in_array($seller_country_code, array('FR,MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined
//print 'VATRULE 2'; //print 'VATRULE 2';
return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice);
} }
@ -10461,12 +10461,12 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
/** /**
* Function dolGetButtonAction * Function dolGetButtonAction
* *
* @param string $label label or tooltip of button. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. * @param string $label Label or tooltip of button. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text.
* @param string $text optional : short label on button. Can be escaped HTML content or full simple text. * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text.
* @param string $actionType default, delete, danger * @param string $actionType 'default', 'delete', 'danger'
* @param string $url the url for link * @param string $url Url for link
* @param string $id attribute id of button * @param string $id Attribute id of button
* @param int $userRight user action right * @param int|boolean $userRight User action right
* // phpcs:disable * // phpcs:disable
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments * @param array $params = [ // Various params for future : recommended rather than adding more function arguments
* 'attr' => [ // to add or override button attributes * 'attr' => [ // to add or override button attributes
@ -10511,19 +10511,20 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
$text = $label; $text = $label;
$attr['title'] = ''; // if html not set, leave label on title is redundant $attr['title'] = ''; // if html not set, leave label on title is redundant
} else { } else {
$attr['title'] = $label;
$attr['aria-label'] = $label; $attr['aria-label'] = $label;
} }
if (empty($userRight)) { if (empty($userRight)) {
$attr['class'] = 'butActionRefused'; $attr['class'] = 'butActionRefused';
$attr['href'] = ''; $attr['href'] = '';
$attr['title'] = $langs->trans('NotEnoughPermissions');
} }
if (!empty($id)) { if (!empty($id)) {
$attr['id'] = $id; $attr['id'] = $id;
} }
// Override attr // Override attr
if (!empty($params['attr']) && is_array($params['attr'])) { if (!empty($params['attr']) && is_array($params['attr'])) {
foreach ($params['attr'] as $key => $value) { foreach ($params['attr'] as $key => $value) {

View File

@ -2236,7 +2236,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
$module='facture'; $module='facture';
} }
if (!empty($conf->$module->enabled)) { if (isModEnabled($module)) {
$res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
if ($res) { if ($res) {
if (class_exists($classname)) { if (class_exists($classname)) {

View File

@ -753,7 +753,10 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result .= '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>'; $result .= '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>';
$result .= '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>'; $result .= '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>';
$result .= '<td class="right amount">'.price($obj->total_ttc).'</td>'; $result .= '<td class="right amount">'.price($obj->total_ttc).'</td>';
$result .= '<td class="right">'.$objectstatic->getLibStatut(5).'</td>';
// Load amount of existing payment of invoice (needed for complete status)
$payment = $objectstatic->getSommePaiement();
$result .= '<td class="right">'.$objectstatic->getLibStatut(5, $payment).'</td>';
$result .= '</tr>'; $result .= '</tr>';

View File

@ -239,7 +239,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
} }
$pdf->SetFont(pdf_getPDFFont($langs)); $pdf->SetFont(pdf_getPDFFont($langs));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
//$pdf->SetCompression(false); //$pdf->SetCompression(false);

View File

@ -27,7 +27,7 @@
$supportedoauth2array = array( $supportedoauth2array = array(
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'availablescopes'=> 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print,admin_directory_user,gmail_full'), 'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'availablescopes'=> 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print,admin_directory_user,gmail_full'),
); );
if (!empty($conf->stripe->enabled)) { if (isModEnabled('stripe')) {
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'availablescopes'=>'read_write'); $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'availablescopes'=>'read_write');
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write'); $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write');
} }

View File

@ -150,15 +150,15 @@ function getValidOnlinePaymentMethods($paymentmethod = '')
$validpaymentmethod = array(); $validpaymentmethod = array();
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) { if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) {
$langs->load("paypal"); $langs->load("paypal");
$validpaymentmethod['paypal'] = 'valid'; $validpaymentmethod['paypal'] = 'valid';
} }
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) { if ((empty($paymentmethod) || $paymentmethod == 'paybox') && isModEnabled('paybox')) {
$langs->load("paybox"); $langs->load("paybox");
$validpaymentmethod['paybox'] = 'valid'; $validpaymentmethod['paybox'] = 'valid';
} }
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) { if ((empty($paymentmethod) || $paymentmethod == 'stripe') && isModEnabled('stripe')) {
$langs->load("stripe"); $langs->load("stripe");
$validpaymentmethod['stripe'] = 'valid'; $validpaymentmethod['stripe'] = 'valid';
} }

View File

@ -1281,9 +1281,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
} }
// Show page nb only on iso languages (so default Helvetica font) // Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') {
$pdf->SetXY($dims['wk'] - $dims['rm'] - 15, -$posy); $pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
$pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0);
} }
// Show Draft Watermark // Show Draft Watermark
@ -1567,7 +1567,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$productCustomerPriceStatic = new Productcustomerprice($db); $productCustomerPriceStatic = new Productcustomerprice($db);
$filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid); $filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid);
$nbCustomerPrices = $productCustomerPriceStatic->fetch_all('', '', 1, 0, $filter); $nbCustomerPrices = $productCustomerPriceStatic->fetchAll('', '', 1, 0, $filter);
if ($nbCustomerPrices > 0) { if ($nbCustomerPrices > 0) {
$productCustomerPrice = $productCustomerPriceStatic->lines[0]; $productCustomerPrice = $productCustomerPriceStatic->lines[0];

View File

@ -60,9 +60,9 @@ function product_prepare_head($object)
$h++; $h++;
} }
if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
if ((((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->fournisseur->lire) if ((((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->fournisseur->lire)
|| (!empty($conf->margin->enabled) && $user->hasRight("margin", "liretous")) || (isModEnabled('margin') && $user->hasRight("margin", "liretous"))
) { ) {
if ($usercancreadprice) { if ($usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
@ -570,7 +570,7 @@ function show_stats_for_company($product, $socid)
} }
// MO // MO
if (!empty($conf->mrp->enabled) && !empty($user->rights->mrp->read)) { if (isModEnabled('mrp') && !empty($user->rights->mrp->read)) {
$nblines++; $nblines++;
$ret = $product->load_stats_mo($socid); $ret = $product->load_stats_mo($socid);
if ($ret < 0) { if ($ret < 0) {

View File

@ -168,7 +168,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (isModEnabled("expedition")) { if (isModEnabled("expedition")) {
$nbElements += $project->getElementCount('shipping', 'expedition'); $nbElements += $project->getElementCount('shipping', 'expedition');
} }
if (!empty($conf->mrp->enabled)) { if (isModEnabled('mrp')) {
$nbElements += $project->getElementCount('mrp', 'mrp_mo', 'fk_project'); $nbElements += $project->getElementCount('mrp', 'mrp_mo', 'fk_project');
} }
if (isModEnabled('deplacement')) { if (isModEnabled('deplacement')) {

View File

@ -181,7 +181,7 @@ function getCustomerProposalPieChart($socid = 0)
$result= ''; $result= '';
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) { if (!isModEnabled('propal') || empty($user->rights->propal->lire)) {
return ''; return '';
} }

View File

@ -116,6 +116,21 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
$out .= '&hashp='.$hashp; $out .= '&hashp='.$hashp;
} }
}*/ }*/
} elseif ($type == 'contract') {
$securekeyseed = isset($conf->global->CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
$out = $urltouse.'/public/onlinesign/newonlinesign.php?source=contract&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'contract_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</span>' : '');
if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + contract_ref)";
} else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
}
} }
// For multicompany // For multicompany

View File

@ -99,7 +99,7 @@ function user_prepare_head(User $object)
$h++; $h++;
} }
if (!empty($conf->clicktodial->enabled)) { if (isModEnabled('clicktodial')) {
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
$head[$h][1] = $langs->trans("ClickToDial"); $head[$h][1] = $langs->trans("ClickToDial");
$head[$h][2] = 'clicktodial'; $head[$h][2] = 'clicktodial';

View File

@ -347,7 +347,7 @@ class pdf_standard_asset extends ModelePDFAsset
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -383,10 +383,10 @@ class pdf_standard_asset extends ModelePDFAsset
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90 + $top_shift; $tab_top = 90 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
$tab_height = 130 - $top_shift; $tab_height = 130 - $top_shift;
$tab_height_newpage = 150; $tab_height_newpage = 150;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$tab_height_newpage -= $top_shift; $tab_height_newpage -= $top_shift;
} }
@ -430,7 +430,7 @@ class pdf_standard_asset extends ModelePDFAsset
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
// $this->_pagefoot($pdf,$object,$outputlangs,1); // $this->_pagefoot($pdf,$object,$outputlangs,1);
@ -488,7 +488,7 @@ class pdf_standard_asset extends ModelePDFAsset
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$height_note = $posyafter - $tab_top_newpage; $height_note = $posyafter - $tab_top_newpage;
@ -510,7 +510,7 @@ class pdf_standard_asset extends ModelePDFAsset
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
@ -748,7 +748,7 @@ class pdf_standard_asset extends ModelePDFAsset
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -766,7 +766,7 @@ class pdf_standard_asset extends ModelePDFAsset
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1170,8 +1170,7 @@ class pdf_standard_asset extends ModelePDFAsset
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }

View File

@ -170,7 +170,7 @@ class pdf_ban extends ModeleBankAccountDoc
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("BAN")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("BAN"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }

View File

@ -182,7 +182,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -654,9 +654,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -155,7 +155,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number);
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -407,7 +407,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
{ {
global $conf; global $conf;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
// Line of free text // Line of free text
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);

View File

@ -323,7 +323,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -359,11 +359,11 @@ class pdf_einstein extends ModelePDFCommandes
$tab_top = 90 + $top_shift; $tab_top = 90 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -456,7 +456,7 @@ class pdf_einstein extends ModelePDFCommandes
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -608,7 +608,7 @@ class pdf_einstein extends ModelePDFCommandes
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -628,7 +628,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1535,8 +1535,7 @@ class pdf_einstein extends ModelePDFCommandes
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }
} }

View File

@ -365,7 +365,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -392,13 +392,13 @@ class pdf_eratosthene extends ModelePDFCommandes
$tab_top = 90 + $top_shift; $tab_top = 90 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -466,7 +466,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
// $this->_pagefoot($pdf,$object,$outputlangs,1); // $this->_pagefoot($pdf,$object,$outputlangs,1);
@ -524,7 +524,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$height_note = $posyafter - $tab_top_newpage; $height_note = $posyafter - $tab_top_newpage;
@ -546,7 +546,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
@ -642,7 +642,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
} }
} else { } else {
@ -832,7 +832,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -852,7 +852,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1720,8 +1720,7 @@ class pdf_eratosthene extends ModelePDFCommandes
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }

View File

@ -256,7 +256,7 @@ class pdf_strato extends ModelePDFContract
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -274,7 +274,7 @@ class pdf_strato extends ModelePDFContract
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
// Display notes // Display notes
if (!empty($object->note_public)) { if (!empty($object->note_public)) {
@ -390,7 +390,7 @@ class pdf_strato extends ModelePDFContract
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -783,8 +783,7 @@ class pdf_strato extends ModelePDFContract
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -324,7 +324,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -343,7 +343,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -351,7 +351,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -445,7 +445,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
@ -485,7 +485,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -571,7 +571,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -591,7 +591,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -921,8 +921,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }

View File

@ -284,7 +284,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -322,13 +322,13 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -401,7 +401,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -495,7 +495,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -515,7 +515,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -920,8 +920,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -312,7 +312,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -330,7 +330,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift: 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift: 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -338,7 +338,7 @@ class pdf_espadon extends ModelePdfExpedition
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -428,7 +428,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->AddPage(); $pdf->AddPage();
$pagenb++; $pagenb++;
if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
// $this->_pagefoot($pdf,$object,$outputlangs,1); // $this->_pagefoot($pdf,$object,$outputlangs,1);
$pdf->setTopMargin($tab_top_newpage); $pdf->setTopMargin($tab_top_newpage);
// The only function to edit the bottom margin of current page to set it. // The only function to edit the bottom margin of current page to set it.
@ -482,7 +482,7 @@ class pdf_espadon extends ModelePdfExpedition
// apply note frame to last page // apply note frame to last page
$pdf->setPage($pageposafternote); $pdf->setPage($pageposafternote);
if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$height_note = $posyafter - $tab_top_newpage; $height_note = $posyafter - $tab_top_newpage;
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
} else // No pagebreak } else // No pagebreak
@ -500,7 +500,7 @@ class pdf_espadon extends ModelePdfExpedition
$pageposafternote++; $pageposafternote++;
$pdf->setPage($pageposafternote); $pdf->setPage($pageposafternote);
if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$posyafter = $tab_top_newpage; $posyafter = $tab_top_newpage;
} }
@ -554,7 +554,7 @@ class pdf_espadon extends ModelePdfExpedition
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
@ -596,7 +596,7 @@ class pdf_espadon extends ModelePdfExpedition
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
} }
} else { } else {
@ -705,7 +705,7 @@ class pdf_espadon extends ModelePdfExpedition
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -725,7 +725,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1197,8 +1197,7 @@ class pdf_espadon extends ModelePdfExpedition
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }

View File

@ -266,7 +266,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -281,7 +281,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 52; $tab_top = 52;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;

View File

@ -337,7 +337,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -355,13 +355,13 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -465,7 +465,7 @@ class pdf_rouget extends ModelePdfExpedition
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
@ -510,7 +510,7 @@ class pdf_rouget extends ModelePdfExpedition
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -611,7 +611,7 @@ class pdf_rouget extends ModelePdfExpedition
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -631,7 +631,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1142,8 +1142,7 @@ class pdf_rouget extends ModelePdfExpedition
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }
} }

View File

@ -268,7 +268,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Trips")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Trips"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -286,7 +286,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 95; $tab_top = 95;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 65 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 65 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -361,7 +361,7 @@ class pdf_standard extends ModeleExpenseReport
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -390,7 +390,7 @@ class pdf_standard extends ModeleExpenseReport
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -447,7 +447,7 @@ class pdf_standard extends ModeleExpenseReport
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -467,7 +467,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1129,8 +1129,7 @@ class pdf_standard extends ModeleExpenseReport
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'EXPENSEREPORT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'EXPENSEREPORT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -373,7 +373,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : ''));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -448,7 +448,7 @@ class pdf_crabe extends ModelePDFFactures
// $tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) // $tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
$tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases) $tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
// You can add more thing under header here, if you increase $extra_under_address_shift too. // You can add more thing under header here, if you increase $extra_under_address_shift too.
$extra_under_address_shift = 0; $extra_under_address_shift = 0;
@ -491,7 +491,7 @@ class pdf_crabe extends ModelePDFFactures
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -578,7 +578,7 @@ class pdf_crabe extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
@ -621,7 +621,7 @@ class pdf_crabe extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -797,7 +797,7 @@ class pdf_crabe extends ModelePDFFactures
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -817,7 +817,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -942,7 +942,7 @@ class pdf_crabe extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($current_page); $pdf->setPage($current_page);
@ -1004,7 +1004,7 @@ class pdf_crabe extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($current_page); $pdf->setPage($current_page);
@ -1180,13 +1180,13 @@ class pdf_crabe extends ModelePDFFactures
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0; $useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {
if (!empty($conf->paypal->enabled)) { if (isModEnabled('paypal')) {
$useonlinepayment++; $useonlinepayment++;
} }
if (!empty($conf->stripe->enabled)) { if (isModEnabled('stripe')) {
$useonlinepayment++; $useonlinepayment++;
} }
if (!empty($conf->paybox->enabled)) { if (isModEnabled('paybox')) {
$useonlinepayment++; $useonlinepayment++;
} }
} }
@ -2062,8 +2062,7 @@ class pdf_crabe extends ModelePDFFactures
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }
} }

View File

@ -400,7 +400,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : ''));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -457,7 +457,7 @@ class pdf_sponge extends ModelePDFFactures
// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) // $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
$this->tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases) $this->tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
$this->tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
// You can add more thing under header here, if you increase $extra_under_address_shift too. // You can add more thing under header here, if you increase $extra_under_address_shift too.
$extra_under_address_shift = 0; $extra_under_address_shift = 0;
@ -506,7 +506,7 @@ class pdf_sponge extends ModelePDFFactures
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$this->tab_top -= 2; $this->tab_top -= 2;
@ -575,7 +575,7 @@ class pdf_sponge extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
} }
// $this->_pagefoot($pdf,$object,$outputlangs,1); // $this->_pagefoot($pdf,$object,$outputlangs,1);
@ -633,7 +633,7 @@ class pdf_sponge extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
} }
$height_note = $posyafter - $this->tab_top_newpage; $height_note = $posyafter - $this->tab_top_newpage;
@ -655,7 +655,7 @@ class pdf_sponge extends ModelePDFFactures
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
} }
@ -957,7 +957,7 @@ class pdf_sponge extends ModelePDFFactures
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -978,7 +978,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
} }
} }
@ -1290,13 +1290,13 @@ class pdf_sponge extends ModelePDFFactures
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0; $useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {
if (!empty($conf->paypal->enabled)) { if (isModEnabled('paypal')) {
$useonlinepayment++; $useonlinepayment++;
} }
if (!empty($conf->stripe->enabled)) { if (isModEnabled('stripe')) {
$useonlinepayment++; $useonlinepayment++;
} }
if (!empty($conf->paybox->enabled)) { if (isModEnabled('paybox')) {
$useonlinepayment++; $useonlinepayment++;
} }
} }
@ -1472,7 +1472,7 @@ class pdf_sponge extends ModelePDFFactures
if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) { if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) {
$this->_pagefoot($pdf, $object, $outputlangs, 1); $this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage(); $pdf->addPage();
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
$pdf->setY($this->tab_top_newpage); $pdf->setY($this->tab_top_newpage);
} else { } else {
@ -1539,7 +1539,7 @@ class pdf_sponge extends ModelePDFFactures
if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) { if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) {
$pdf->addPage(); $pdf->addPage();
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
$pdf->setY($this->tab_top_newpage); $pdf->setY($this->tab_top_newpage);
} else { } else {
@ -1562,7 +1562,7 @@ class pdf_sponge extends ModelePDFFactures
// Total remise // Total remise
$total_line_remise = 0; $total_line_remise = 0;
foreach ($object->lines as $i => $line) { foreach ($object->lines as $i => $line) {
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib $total_line_remise += (float) pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative // Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) { if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht; $total_line_remise += -$line->total_ht;
@ -2328,8 +2328,7 @@ class pdf_sponge extends ModelePDFFactures
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }

View File

@ -258,7 +258,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -275,7 +275,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -378,7 +378,7 @@ class pdf_soleil extends ModelePDFFicheinter
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -415,7 +415,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -435,7 +435,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -741,8 +741,7 @@ class pdf_soleil extends ModelePDFFicheinter
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }
} }

View File

@ -412,7 +412,7 @@ class pdf_standard extends CommonStickerGenerator
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($keywords); $pdf->SetKeyWords($keywords);
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }

View File

@ -211,7 +211,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $usenpr) { if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
} }
if (isModEnabled('stock')) { if (isModEnabled('stock')) {
@ -625,7 +625,7 @@ class modProduct extends DolibarrModules
)); ));
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
} }
if (is_object($mysoc) && $usenpr) { if (is_object($mysoc) && $usenpr) {
@ -718,7 +718,7 @@ class modProduct extends DolibarrModules
'p.desiredstock' => '' 'p.desiredstock' => ''
)); ));
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$import_sample = array_merge($import_sample, array('p.cost_price'=>'90')); $import_sample = array_merge($import_sample, array('p.cost_price'=>'90'));
} }
if (is_object($mysoc) && $usenpr) { if (is_object($mysoc) && $usenpr) {

View File

@ -176,7 +176,7 @@ class modService extends DolibarrModules
if (is_object($mysoc) && $usenpr) { if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
} }
if (isModEnabled('stock')) { if (isModEnabled('stock')) {
@ -572,7 +572,7 @@ class modService extends DolibarrModules
)); ));
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
} }
if (is_object($mysoc) && $usenpr) { if (is_object($mysoc) && $usenpr) {
@ -663,7 +663,7 @@ class modService extends DolibarrModules
'p.desiredstock' => '' 'p.desiredstock' => ''
)); ));
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$import_sample = array_merge($import_sample, array('p.cost_price'=>'90')); $import_sample = array_merge($import_sample, array('p.cost_price'=>'90'));
} }
if (is_object($mysoc) && $usenpr) { if (is_object($mysoc) && $usenpr) {

View File

@ -447,7 +447,7 @@ class pdf_standard extends ModelePDFMovement
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -466,7 +466,7 @@ class pdf_standard extends ModelePDFMovement
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 42; $tab_top = 42;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -537,7 +537,7 @@ class pdf_standard extends ModelePDFMovement
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -672,7 +672,7 @@ class pdf_standard extends ModelePDFMovement
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -692,7 +692,7 @@ class pdf_standard extends ModelePDFMovement
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1160,8 +1160,7 @@ class pdf_standard extends ModelePDFMovement
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -286,7 +286,7 @@ class pdf_vinci extends ModelePDFMo
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Mo")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Mo")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -306,7 +306,7 @@ class pdf_vinci extends ModelePDFMo
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90 + $top_shift; $tab_top = 90 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -350,7 +350,7 @@ class pdf_vinci extends ModelePDFMo
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
// $this->_pagefoot($pdf,$object,$outputlangs,1); // $this->_pagefoot($pdf,$object,$outputlangs,1);
@ -408,7 +408,7 @@ class pdf_vinci extends ModelePDFMo
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$height_note = $posyafter - $tab_top_newpage; $height_note = $posyafter - $tab_top_newpage;
@ -430,7 +430,7 @@ class pdf_vinci extends ModelePDFMo
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
@ -486,7 +486,7 @@ class pdf_vinci extends ModelePDFMo
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
@ -532,7 +532,7 @@ class pdf_vinci extends ModelePDFMo
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
} else { } else {
// We found a page break // We found a page break
@ -584,7 +584,7 @@ class pdf_vinci extends ModelePDFMo
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
} else { } else {
// We found a page break // We found a page break
@ -1353,8 +1353,7 @@ class pdf_vinci extends ModelePDFMo
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }

View File

@ -294,7 +294,7 @@ class pdf_standardlabel extends CommonStickerGenerator
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($keywords); $pdf->SetKeyWords($keywords);
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }

View File

@ -317,7 +317,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($keywords); $pdf->SetKeyWords($keywords);
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }

View File

@ -213,7 +213,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -233,7 +233,7 @@ class pdf_standard extends ModelePDFProduct
$tab_top = 42; $tab_top = 42;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -352,7 +352,7 @@ class pdf_standard extends ModelePDFProduct
{ {
$pdf->AddPage('','',true); $pdf->AddPage('','',true);
if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1); $pdf->setPage($pageposafter+1);
} }
} }
@ -484,7 +484,7 @@ class pdf_standard extends ModelePDFProduct
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{ {
@ -501,7 +501,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->AddPage(); $pdf->AddPage();
if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (!empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -816,8 +816,7 @@ class pdf_standard extends ModelePDFProduct
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -67,7 +67,9 @@ if (isModEnabled('deplacement')) {
if (isModEnabled('agenda')) { if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
} }
if (isModEnabled('expedition')) {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
}
/** /**
* Class to build documents using ODF templates generator * Class to build documents using ODF templates generator

View File

@ -266,7 +266,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -284,7 +284,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 50; $tab_top = 50;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -360,7 +360,7 @@ class pdf_baleine extends ModelePDFProjects
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -385,7 +385,7 @@ class pdf_baleine extends ModelePDFProjects
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -467,7 +467,7 @@ class pdf_baleine extends ModelePDFProjects
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -487,7 +487,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -695,8 +695,7 @@ class pdf_baleine extends ModelePDFProjects
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -315,7 +315,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -333,7 +333,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 50; $tab_top = 50;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -587,7 +587,7 @@ class pdf_beluga extends ModelePDFProjects
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -612,7 +612,7 @@ class pdf_beluga extends ModelePDFProjects
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -740,7 +740,7 @@ class pdf_beluga extends ModelePDFProjects
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -895,8 +895,7 @@ class pdf_beluga extends ModelePDFProjects
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -266,7 +266,7 @@ class pdf_timespent extends ModelePDFProjects
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -284,7 +284,7 @@ class pdf_timespent extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 50; $tab_top = 50;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -364,7 +364,7 @@ class pdf_timespent extends ModelePDFProjects
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -389,7 +389,7 @@ class pdf_timespent extends ModelePDFProjects
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -470,7 +470,7 @@ class pdf_timespent extends ModelePDFProjects
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -490,7 +490,7 @@ class pdf_timespent extends ModelePDFProjects
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -691,8 +691,7 @@ class pdf_timespent extends ModelePDFProjects
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -243,8 +243,8 @@ class pdf_azur extends ModelePDFPropales
} }
// Show Draft Watermark // Show Draft Watermark
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->PROPALE_DRAFT_WATERMARK))) { if ($object->statut == $object::STATUS_DRAFT && getDolGlobalString('PROPALE_DRAFT_WATERMARK')) {
$this->watermark = $conf->global->PROPALE_DRAFT_WATERMARK; $this->watermark = getDolGlobalString('PROPALE_DRAFT_WATERMARK');
} }
$nblines = count($object->lines); $nblines = count($object->lines);
@ -373,7 +373,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -419,11 +419,11 @@ class pdf_azur extends ModelePDFPropales
$tab_top = 90 + $top_shift; $tab_top = 90 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -522,7 +522,7 @@ class pdf_azur extends ModelePDFPropales
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
@ -566,7 +566,7 @@ class pdf_azur extends ModelePDFPropales
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -723,7 +723,7 @@ class pdf_azur extends ModelePDFPropales
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -743,7 +743,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1731,8 +1731,7 @@ class pdf_azur extends ModelePDFPropales
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }

View File

@ -217,8 +217,8 @@ class pdf_cyan extends ModelePDFPropales
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
// Show Draft Watermark // Show Draft Watermark
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->PROPALE_DRAFT_WATERMARK))) { if ($object->statut == $object::STATUS_DRAFT && getDolGlobalString('PROPALE_DRAFT_WATERMARK')) {
$this->watermark = $conf->global->PROPALE_DRAFT_WATERMARK; $this->watermark = getDolGlobalString('PROPALE_DRAFT_WATERMARK');
} }
global $outputlangsbis; global $outputlangsbis;
@ -360,7 +360,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -394,12 +394,12 @@ class pdf_cyan extends ModelePDFPropales
$tab_top = 90 + $top_shift; $tab_top = 90 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -481,7 +481,7 @@ class pdf_cyan extends ModelePDFPropales
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
// $this->_pagefoot($pdf,$object,$outputlangs,1); // $this->_pagefoot($pdf,$object,$outputlangs,1);
@ -539,7 +539,7 @@ class pdf_cyan extends ModelePDFPropales
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$height_note = $posyafter - $tab_top_newpage; $height_note = $posyafter - $tab_top_newpage;
@ -561,7 +561,7 @@ class pdf_cyan extends ModelePDFPropales
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
@ -847,7 +847,7 @@ class pdf_cyan extends ModelePDFPropales
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -868,7 +868,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -1819,8 +1819,7 @@ class pdf_cyan extends ModelePDFPropales
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }

View File

@ -303,7 +303,7 @@ class pdf_paiement
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
//$pdf->SetKeyWords(); //$pdf->SetKeyWords();
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }

View File

@ -251,7 +251,7 @@ class pdf_squille extends ModelePdfReception
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Reception")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Reception"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -269,13 +269,13 @@ class pdf_squille extends ModelePdfReception
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
$tab_top -= 2; $tab_top -= 2;
@ -381,7 +381,7 @@ class pdf_squille extends ModelePdfReception
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
@ -439,7 +439,7 @@ class pdf_squille extends ModelePdfReception
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -1078,8 +1078,7 @@ class pdf_squille extends ModelePdfReception
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'RECEPTION_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); return pdf_pagefoot($pdf, $outputlangs, 'RECEPTION_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
} }
} }

View File

@ -251,7 +251,7 @@ class pdf_standard extends ModelePDFStock
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -270,7 +270,7 @@ class pdf_standard extends ModelePDFStock
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 65 + $top_shift; $tab_top = 65 + $top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -353,7 +353,7 @@ class pdf_standard extends ModelePDFStock
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
$pdf->setPage($pageposafter + 1); $pdf->setPage($pageposafter + 1);
@ -457,7 +457,7 @@ class pdf_standard extends ModelePDFStock
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
if (!empty($tplidx)) { if (!empty($tplidx)) {
@ -477,7 +477,7 @@ class pdf_standard extends ModelePDFStock
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
$pagenb++; $pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs); $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }
@ -891,8 +891,7 @@ class pdf_standard extends ModelePDFStock
*/ */
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

Some files were not shown because too many files have changed in this diff Show More