Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 17.0

This commit is contained in:
Laurent Destailleur 2023-02-22 16:07:39 +01:00
commit 57ba45d625
18 changed files with 109 additions and 82 deletions

View File

@ -202,7 +202,7 @@ if (!empty($triggers)) {
print '<td>'.$trigger['label'].'</td>';
print '<td class="right" width="40">';
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
$value = $conf->global->$key;
$value = getDolGlobalInt($key);
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action == 'selectall' || $value) && $action != "selectnone") ? ' checked' : '').'>';
print '</td></tr>'."\n";
}

View File

@ -203,7 +203,7 @@ print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span
print "<br>\n";
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT');
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
print "<table class=\"noborder\" width=\"100%\">";

View File

@ -328,7 +328,7 @@ print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltex
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
$tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW'));
print '</td></tr>'."\n";
// Manual or automatic
@ -390,7 +390,7 @@ print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
print '</td></tr>'."\n";
print '</table>';

View File

@ -39,6 +39,23 @@ $langs->loadLangs(array("admin", "other", "agenda"));
$def = array();
$actionsave = GETPOST('save', 'alpha');
$MAIN_AGENDA_XCAL_EXPORTKEY = getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY');
$MAIN_AGENDA_EXPORT_PAST_DELAY = getDolGlobalInt('MAIN_AGENDA_EXPORT_PAST_DELAY');
$MAIN_AGENDA_EXPORT_CACHE = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE');
$AGENDA_EXPORT_FIX_TZ = getDolGlobalString('AGENDA_EXPORT_FIX_TZ');
if (GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) {
$MAIN_AGENDA_XCAL_EXPORTKEY = trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha'));
}
if (GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) {
$MAIN_AGENDA_EXPORT_PAST_DELAY = intval(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'int'));
}
if (GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) {
$MAIN_AGENDA_EXPORT_CACHE = intval(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'int'));
}
if (GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) {
$AGENDA_EXPORT_FIX_TZ = trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha'));
}
// Sauvegardes parametres
if ($actionsave) {
@ -46,10 +63,10 @@ if ($actionsave) {
$db->begin();
$i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', $MAIN_AGENDA_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', $MAIN_AGENDA_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', $MAIN_AGENDA_EXPORT_CACHE, 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', $AGENDA_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity);
if ($i >= 4) {
$db->commit();
@ -98,7 +115,7 @@ print "</tr>";
print '<tr class="oddeven">';
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="'.(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha') ?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha') : $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY).'" size="40">';
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="'.dol_escape_htmltag($MAIN_AGENDA_XCAL_EXPORTKEY).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
}
@ -108,13 +125,13 @@ print "</tr>";
print '<tr class="oddeven">';
print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"".(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha') ?GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha') : $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)."\" size=\"10\"> ".$langs->trans("days")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"".$MAIN_AGENDA_EXPORT_PAST_DELAY."\" size=\"10\"> ".$langs->trans("days")."</td>";
print "<td>&nbsp;</td>";
print "</tr>";
print '<tr class="oddeven">';
print "<td>".$langs->trans("UseACacheDelay")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"".(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha') ?GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha') : $conf->global->MAIN_AGENDA_EXPORT_CACHE)."\" size=\"10\"></td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"".$MAIN_AGENDA_EXPORT_CACHE."\" size=\"10\"></td>";
print "<td>&nbsp;</td>";
print "</tr>";
@ -131,7 +148,7 @@ print "</tr>";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("FixTZ")."</td>";
print "<td>";
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.$conf->global->AGENDA_EXPORT_FIX_TZ.'">';
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.dol_escape_htmltag($AGENDA_EXPORT_FIX_TZ).'">';
print ' &nbsp; '.$langs->trans("FillThisOnlyIfRequired");
print "</td>";
print "</tr>";

View File

@ -43,7 +43,7 @@ $arrayofparameters = array(
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>isModEnabled('ecm'))
);
// To fix when dire does not exists
@ -124,6 +124,10 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val) {
if (isset($val['enabled']) && empty($val['enabled'])) {
continue;
}
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
$label = $langs->trans($key);

View File

@ -364,7 +364,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print '</td>';
@ -702,12 +702,14 @@ if (isModEnabled('banque')) {
}
print "</td></tr>";
$FACTURE_CHQ_NUMBER = getDolGlobalInt('FACTURE_CHQ_NUMBER');
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
print "<td>";
print '<select class="flat" name="chq" id="chq">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
print '<option value="-1"'.($FACTURE_CHQ_NUMBER == -1 ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
@ -723,7 +725,7 @@ if ($resql) {
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
print $FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
$i++;

View File

@ -190,7 +190,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print '</td>';
@ -257,7 +257,7 @@ print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("PaymentOnDifferentThirdBills");
print '</td><td width="60" align="center">';
print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS, 1);
print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", getDolGlobalInt('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'), 1);
print '</td><td class="right">';
print "</td></tr>\n";
@ -265,7 +265,7 @@ print "</td></tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("GroupPaymentsByModOnReports");
print '</td><td width="60" align="center">';
print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_REPORT_GROUP_BY_MOD, 1);
print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", getDolGlobalInt('PAYMENTS_REPORT_GROUP_BY_MOD'), 1);
print '</td><td class="right">';
print "</td></tr>\n";

View File

@ -35,6 +35,11 @@
*/
abstract class CommonDocGenerator
{
/**
* @var string Model name
*/
public $name = '';
/**
* @var string Error code (or message)
*/

View File

@ -449,6 +449,10 @@ class FormFile
$titletoshow = ($title == 'none' ? '' : $title);
}
$addcolumforpicto = ($delallowed || $printer || $morepicto);
$colspan = (4 + ($addcolumforpicto ? 1 : 0));
$colspanmore = 0;
// Show table
if ($genallowed) {
$modellist = array();
@ -700,10 +704,6 @@ class FormFile
$out .= '<tr class="liste_titre">';
$addcolumforpicto = ($delallowed || $printer || $morepicto);
$colspan = (4 + ($addcolumforpicto ? 1 : 0));
$colspanmore = 0;
$out .= '<th colspan="'.$colspan.'" class="formdoc liste_titre maxwidthonsmartphone center">';
// Model

View File

@ -53,7 +53,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
*/
public function info()
{
global $db, $conf, $langs;
global $db, $langs;
$langs->load("bills");
@ -137,35 +137,20 @@ class mod_facture_mercure extends ModeleNumRefFactures
*/
public function getNextValue($objsoc, $invoice, $mode = 'next')
{
global $db, $conf;
global $db;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Get Mask value
$mask = '';
if (is_object($invoice) && $invoice->type == 1) {
if (isset($conf->global->FACTURE_MERCURE_MASK_REPLACEMENT)) {
$mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT;
}
if (!$mask) {
if (isset($conf->global->FACTURE_MERCURE_MASK_INVOICE)) {
$mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
}
}
$mask = getDolGlobalString('FACTURE_MERCURE_MASK_REPLACEMENT', getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE'));
} elseif (is_object($invoice) && $invoice->type == 2) {
if (isset($conf->global->FACTURE_MERCURE_MASK_CREDIT)) {
$mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT;
}
$mask = getDolGlobalString('FACTURE_MERCURE_MASK_CREDIT');
} elseif (is_object($invoice) && $invoice->type == 3) {
if (isset($conf->global->FACTURE_MERCURE_MASK_DEPOSIT)) {
$mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT;
}
$mask = getDolGlobalString('FACTURE_MERCURE_MASK_DEPOSIT');
} else {
if (isset($conf->global->FACTURE_MERCURE_MASK_INVOICE)) {
$mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
} else {
$mask = '';
}
$mask = getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE');
}
if (!$mask) {
$this->error = 'NotConfigured';

View File

@ -61,7 +61,7 @@ class mod_payment_ant extends ModeleNumRefPayments
*/
public function info()
{
global $db, $conf, $langs;
global $db, $langs;
$langs->load("bills");
@ -82,7 +82,7 @@ class mod_payment_ant extends ModeleNumRefPayments
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskpayment" value="'.getDolGlobalString('PAYMENT_ANT_MASK').'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
@ -128,7 +128,7 @@ class mod_payment_ant extends ModeleNumRefPayments
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule
$mask = $conf->global->PAYMENT_ANT_MASK;
$mask = getDolGlobalString('PAYMENT_ANT_MASK');
if (!$mask) {
$this->error = 'NotConfigured';

View File

@ -117,13 +117,16 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$form = new Form($this->db);
$odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0;
$odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH'));
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="PROPALE_ADDON_PDF_ODT_PATH">';
if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) {
if ($odtChosen) {
$texte .= '<input type="hidden" name="param2" value="PROPALE_ADDON_PDF_ODT_DEFAULT">';
$texte .= '<input type="hidden" name="param3" value="PROPALE_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="PROPALE_ADDON_PDF_ODT_CLOSED">';
@ -133,7 +136,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROPALE_ADDON_PDF_ODT_PATH)));
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
@ -159,7 +162,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH;
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
@ -167,7 +170,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// Scan directories
$nbofiles = count($listoffiles);
if (!empty($conf->global->PROPALE_ADDON_PDF_ODT_PATH)) {
if (!empty($odtPath)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte .= count($listoffiles);
@ -187,26 +190,26 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texte .= '</div>';
// Set default template for different status of proposal
if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) {
if ($odtChosen) {
// Model for creation
$list = ModelePDFPropales::liste_modeles($this->db);
$texte .= '<table width="50%;">';
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT);
$texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL);
$texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED);
$texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED'));
$texte .= "</td></tr>";
$texte .= '</table>';
}

View File

@ -117,13 +117,16 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$form = new Form($this->db);
$odtChosen = getDolGlobalInt('MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT') > 0;
$odtPath = trim(getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH'));
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH">';
if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) {
if ($odtChosen) {
$texte .= '<input type="hidden" name="param2" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT">';
$texte .= '<input type="hidden" name="param3" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED">';
@ -133,7 +136,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)));
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
@ -159,7 +162,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH;
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
@ -167,7 +170,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
// Scan directories
$nbofiles = count($listoffiles);
if (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)) {
if (!empty($odtPath)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte .= count($listoffiles);
@ -185,26 +188,26 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
}
$texte .= '</div>';
if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) {
if ($odtChosen) {
// Model for creation
$list = ModelePDFSupplierProposal::liste_modeles($this->db);
$texte .= '<table width="50%;">';
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelSupplierProposalCreate").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value2', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT);
$texte .= $form->selectarray('value2', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelSupplierProposalToBill").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value3', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL);
$texte .= $form->selectarray('value3', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelSupplierProposalClosed").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value4', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED);
$texte .= $form->selectarray('value4', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED'));
$texte .= "</td></tr>";
$texte .= '</table>';
}

View File

@ -64,7 +64,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
*/
public function info()
{
global $conf, $langs, $db;
global $langs, $db;
$langs->load("bills");
@ -83,9 +83,11 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest"));
$tooltip .= $langs->trans("GenericMaskCodes5");
$mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK');
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="masksupplier_proposal" value="'.$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="masksupplier_proposal" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
@ -131,7 +133,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// On defini critere recherche compteur
$mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK;
$mask = empty($conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK) ? '' : $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK;
if (!$mask) {
$this->error = 'NotConfigured';

View File

@ -114,13 +114,16 @@ class doc_generic_user_odt extends ModelePDFUser
$form = new Form($this->db);
$odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0;
$odtPath = trim(getDolGlobalString('USER_ADDON_PDF_ODT_PATH'));
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="USER_ADDON_PDF_ODT_PATH">';
if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) {
if ($odtChosen) {
$texte .= '<input type="hidden" name="param2" value="USER_ADDON_PDF_ODT_DEFAULT">';
$texte .= '<input type="hidden" name="param3" value="USER_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="USER_ADDON_PDF_ODT_CLOSED">';
@ -130,7 +133,7 @@ class doc_generic_user_odt extends ModelePDFUser
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USER_ADDON_PDF_ODT_PATH)));
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
@ -156,7 +159,7 @@ class doc_generic_user_odt extends ModelePDFUser
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->USER_ADDON_PDF_ODT_PATH;
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
@ -166,26 +169,26 @@ class doc_generic_user_odt extends ModelePDFUser
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) {
if ($odtChosen) {
// Model for creation
$list = ModelePDFUser::liste_modeles($this->db);
$texte .= '<table width="50%;">';
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value2', $list, $conf->global->USER_ADDON_PDF_ODT_DEFAULT);
$texte .= $form->selectarray('value2', $list, getDolGlobalString('USER_ADDON_PDF_ODT_DEFAULT'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value3', $list, $conf->global->USER_ADDON_PDF_ODT_TOBILL);
$texte .= $form->selectarray('value3', $list, getDolGlobalString('USER_ADDON_PDF_ODT_TOBILL'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value4', $list, $conf->global->USER_ADDON_PDF_ODT_CLOSED);
$texte .= $form->selectarray('value4', $list, getDolGlobalString('USER_ADDON_PDF_ODT_CLOSED'));
$texte .= "</td></tr>";
$texte .= '</table>';
}

View File

@ -117,13 +117,16 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$form = new Form($this->db);
$odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0;
$odtPath = trim(getDolGlobalString('USERGROUP_ADDON_PDF_ODT_PATH'));
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="USERGROUP_ADDON_PDF_ODT_PATH">';
if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) {
if ($odtChosen) {
$texte .= '<input type="hidden" name="param2" value="USERGROUP_ADDON_PDF_ODT_DEFAULT">';
$texte .= '<input type="hidden" name="param3" value="USERGROUP_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="USERGROUP_ADDON_PDF_ODT_CLOSED">';
@ -133,7 +136,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH)));
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
@ -159,7 +162,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH;
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
@ -169,26 +172,26 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) {
if ($odtChosen) {
// Model for creation
$list = ModelePDFUserGroup::liste_modeles($this->db);
$texte .= '<table width="50%;">';
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value2', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT);
$texte .= $form->selectarray('value2', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_DEFAULT'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value3', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL);
$texte .= $form->selectarray('value3', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_TOBILL'));
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value4', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED);
$texte .= $form->selectarray('value4', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_CLOSED'));
$texte .= "</td></tr>";
$texte .= '</table>';
}

View File

@ -1101,7 +1101,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$ret = $actioncomm->create($user); // User creating action
if ($ret > 0 && !empty($conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)) {
if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
foreach ($object->attachedfiles['paths'] as $key => $filespath) {
$srcfile = $filespath;
$destdir = $conf->agenda->dir_output.'/'.$ret;

View File

@ -54,7 +54,7 @@ function dav_admin_prepare_head()
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/dav.php?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/admin/dav.php';
$head[$h][1] = $langs->trans("WebDAV");
$head[$h][2] = 'webdav';
$h++;