30require
'../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
43 require_once DOL_DOCUMENT_ROOT .
'/core/lib/supplier_invoice.lib.php';
45 require_once DOL_DOCUMENT_ROOT .
'/core/lib/fourn.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
50$langs->loadLangs(array(
"admin",
"other",
"bills",
"orders"));
56$action =
GETPOST(
'action',
'aZ09');
57$value =
GETPOST(
'value',
'alpha');
58$modulepart =
GETPOST(
'modulepart',
'aZ09');
60$label =
GETPOST(
'label',
'alpha');
61$scandir =
GETPOST(
'scandir',
'alpha');
62$type =
'supplier_payment';
69include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
71if ($action ==
'updateMask') {
72 $maskconstsupplierpayment =
GETPOST(
'maskconstsupplierpayment',
'aZ09');
73 $masksupplierpayment =
GETPOST(
'masksupplierpayment',
'alpha');
77 if ($maskconstsupplierpayment && preg_match(
'/_MASK$/', $maskconstsupplierpayment)) {
78 $res =
dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment,
'chaine', 0,
'',
$conf->entity);
86 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
88 setEventMessages($langs->trans(
"Error"),
null,
'errors');
90} elseif ($action ==
'setmod') {
92} elseif ($action ==
'set') {
95} elseif ($action ==
'del') {
102} elseif ($action ==
'setdoc') {
107 $conf->global->FACTURE_ADDON_PDF = $value;
115} elseif ($action ==
'unsetdoc') {
117} elseif ($action ==
'specimen') {
118 $modele =
GETPOST(
'module',
'alpha');
121 $paiementFourn->initAsSpecimen();
126 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
127 foreach ($dirmodels as $reldir) {
128 $file =
dol_buildpath($reldir.
"core/modules/supplier_payment/doc/pdf_".$modele.
".modules.php", 0);
129 if (file_exists($file)) {
130 $classname =
"pdf_".$modele;
135 if ($classname !==
'') {
139 '@phan-var-force ModelePDFSuppliersPayments $module';
141 if (
$module->write_file($paiementFourn, $langs) > 0) {
142 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf");
149 $langs->load(
'errors');
150 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
151 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
153} elseif ($action ==
'setparams') {
160 setEventMessages($langs->trans(
"Error"),
null,
'errors');
163 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
172$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
174llxHeader(
'', $langs->trans(
"SupplierPaymentSetup"),
'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur',
'', 0, 0,
'',
'',
'',
'mod-admin page-supplier_payment');
176$form =
new Form($db);
179$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
181print
load_fiche_titre($langs->trans(
"SuppliersSetup"), $linkback,
'title_setup');
188print
dol_get_fiche_head($head,
'supplierpayment', $langs->trans(
"Suppliers"), -1,
'company');
195 $conf->global->SUPPLIER_PAYMENT_ADDON =
'mod_supplier_payment_bronan';
203$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
204$sql .=
" WHERE type = '".$db->escape($type).
"'";
205$sql .=
" AND entity = ".((int)
$conf->entity);
206$resql = $db->query($sql);
209 $num_rows = $db->num_rows($resql);
210 while ($i < $num_rows) {
211 $array = $db->fetch_array($resql);
212 if (is_array($array)) {
213 array_push($def, $array[0]);
218 dol_print_error($db);
221print
'<table class="noborder centpercent">';
222print
'<tr class="liste_titre">';
223print
'<td>'.$langs->trans(
"Name").
'</td>';
224print
'<td>'.$langs->trans(
"Description").
'</td>';
225print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
226print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
227print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
232foreach ($dirmodels as $reldir) {
233 $dir =
dol_buildpath($reldir.
"core/modules/supplier_payment/");
235 $handle = opendir($dir);
236 if (is_resource($handle)) {
237 while (($file = readdir($handle)) !==
false) {
238 if (!is_dir($dir.$file) || (
dol_substr($file, 0, 1) !=
'.' &&
dol_substr($file, 0, 3) !=
'CVS')) {
240 $classname = preg_replace(
'/\.php$/',
'', $file);
242 if (!is_file($dir.$filebis)) {
243 $filebis = $file.
"/".$file.
".modules.php";
244 $classname =
"mod_supplier_payment_".$file;
248 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
249 if (!empty($reg[2]) && $reg[2] != strtoupper(
$mysoc->country_code)) {
253 $classname = preg_replace(
'/\-.*$/',
'', $classname);
254 if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/', $filebis) || preg_match(
'/mod_/', $classname)) &&
dol_substr($filebis,
dol_strlen($filebis) - 3, 3) ==
'php') {
256 require_once $dir.$filebis;
260 '@phan-var-force ModeleNumRefSupplierPayments $module';
271 print
'<tr class="oddeven"><td width="100">';
272 echo preg_replace(
'/\-.*$/',
'', preg_replace(
'/mod_supplier_payment_/',
'', preg_replace(
'/\.php$/',
'', $file)));
280 print
'<td class="nowrap">';
282 if (preg_match(
'/^Error/', $tmp)) {
283 $langs->load(
"errors");
284 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
285 } elseif ($tmp ==
'NotConfigured') {
286 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
292 print
'<td class="center">';
294 print img_picto($langs->trans(
"Activated"),
'switch_on');
296 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.preg_replace(
'/\.php$/',
'', $file).
'&label='.urlencode(
$module->name).
'" alt="'.$langs->trans(
"Default").
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
301 $payment->initAsSpecimen();
305 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
307 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
308 $htmltooltip .= $langs->trans(
"NextValue").
': ';
310 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
311 $langs->load(
'errors');
312 $nextval = $langs->trans($nextval);
314 $htmltooltip .= $nextval.
'<br>';
316 $langs->load(
'errors');
317 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
321 print
'<td class="center">';
322 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
352print
'<table class="noborder centpercent">'.
"\n";
353print
'<tr class="liste_titre">'.
"\n";
354print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
355print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
356print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
357print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
358print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
359print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
364foreach ($dirmodels as $reldir) {
365 $realpath = $reldir.
"core/modules/supplier_payment/doc";
369 $handle = opendir($dir);
372 if (is_resource($handle)) {
373 while (($file = readdir($handle)) !==
false) {
374 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
378 require_once $dir.
'/'.$file;
380 '@phan-var-force ModelePDFSuppliersPayments $module';
382 print
'<tr class="oddeven">'.
"\n";
387 if (method_exists(
$module,
'info')) {
396 if (in_array($name, $def)) {
397 print
'<td class="center">'.
"\n";
401 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.$name.
'&scandir='.
$module->scandir.
'&label='.urlencode(
$module->name).
'&type=SUPPLIER_PAYMENT">';
402 print img_picto($langs->trans(
"Enabled"),
'switch_on');
411 print
'<td class="center">'.
"\n";
412 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.urlencode($name).
'&scandir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
417 print
'<td class="center">';
421 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetdoc&token='.
newToken().
'&value='.urlencode($name).
'&scandir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans(
"Disable").
'">'.img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
423 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.urlencode($name).
'&scandir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans(
"Default").
'">'.img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
428 $htmltooltip =
''.$langs->trans(
"Name").
': '.
$module->name;
429 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.(
$module->type ?
$module->type : $langs->trans(
"Unknown"));
430 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.
$module->page_largeur.
'/'.
$module->page_hauteur;
431 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
433 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
434 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.yn(
$module->option_logo, 1, 1);
435 print
'<td class="center">';
436 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
438 print
'<td class="center">';
439 print
'<a href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'specimen',
'module' => $name],
true).
'">'.img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
461print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
462print
'<input type="hidden" name="token" value="'.newToken().
'" />';
463print
'<input type="hidden" name="action" value="setparams" />';
465print
'<div class="div-table-responsive-no-min">';
466print
'<table class="noborder centpercent">';
467print
'<tr class="liste_titre">';
468print
'<td>'.$langs->trans(
"Parameter").
'</td>';
469print
'<td align="center" width="60"></td>';
470print
'<td width="80"> </td>';
474print
'<tr class="oddeven"><td>';
475print $langs->trans(
"GroupPaymentsByModOnReports");
476print
'</td><td width="60" align="center">';
477print $form->selectyesno(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD",
getDolGlobalString(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD"), 1);
478print
'</td><td class="right">';
486print
'<div class="center">';
487print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage payments for supplier invoices.
if(! $sortfield) if(! $sortorder) $module
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object information.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
supplier_invoice_admin_prepare_head()
Prepare array with list of tabs.