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",
"errors",
"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 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
150 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
152} elseif ($action ==
'setparams') {
159 setEventMessages($langs->trans(
"Error"),
null,
'errors');
162 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
171$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
173llxHeader(
'', $langs->trans(
"SupplierPaymentSetup"),
'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur',
'', 0, 0,
'',
'',
'',
'mod-admin page-supplier_payment');
175$form =
new Form($db);
178$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>';
180print
load_fiche_titre($langs->trans(
"SuppliersSetup"), $linkback,
'title_setup');
189print
dol_get_fiche_head($head,
'supplierpayment', $langs->trans(
"Suppliers"), -1,
'company');
196 $conf->global->SUPPLIER_PAYMENT_ADDON =
'mod_supplier_payment_bronan';
204$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
205$sql .=
" WHERE type = '".$db->escape($type).
"'";
206$sql .=
" AND entity = ".((int)
$conf->entity);
207$resql = $db->query($sql);
210 $num_rows = $db->num_rows($resql);
211 while ($i < $num_rows) {
212 $array = $db->fetch_array($resql);
213 if (is_array($array)) {
214 array_push($def, $array[0]);
219 dol_print_error($db);
222print
'<table class="noborder centpercent">';
223print
'<tr class="liste_titre">';
224print
'<td>'.$langs->trans(
"Name").
'</td>';
225print
'<td>'.$langs->trans(
"Description").
'</td>';
226print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
227print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
228print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
233foreach ($dirmodels as $reldir) {
234 $dir =
dol_buildpath($reldir.
"core/modules/supplier_payment/");
236 $handle = opendir($dir);
237 if (is_resource($handle)) {
238 while (($file = readdir($handle)) !==
false) {
239 if (!is_dir($dir.$file) || (
dol_substr($file, 0, 1) !=
'.' &&
dol_substr($file, 0, 3) !=
'CVS')) {
241 $classname = preg_replace(
'/\.php$/',
'', $file);
243 if (!is_file($dir.$filebis)) {
244 $filebis = $file.
"/".$file.
".modules.php";
245 $classname =
"mod_supplier_payment_".$file;
249 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
250 if (!empty($reg[2]) && $reg[2] != strtoupper(
$mysoc->country_code)) {
254 $classname = preg_replace(
'/\-.*$/',
'', $classname);
255 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') {
257 require_once $dir.$filebis;
261 '@phan-var-force ModeleNumRefSupplierPayments $module';
272 print
'<tr class="oddeven"><td width="100">';
273 echo preg_replace(
'/\-.*$/',
'', preg_replace(
'/mod_supplier_payment_/',
'', preg_replace(
'/\.php$/',
'', $file)));
281 print
'<td class="nowrap">';
283 if (preg_match(
'/^Error/', $tmp)) {
284 $langs->load(
"errors");
285 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
286 } elseif ($tmp ==
'NotConfigured') {
287 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
293 print
'<td class="center">';
295 print img_picto($langs->trans(
"Activated"),
'switch_on');
297 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>';
302 $payment->initAsSpecimen();
306 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
308 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
309 $htmltooltip .= $langs->trans(
"NextValue").
': ';
311 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
312 $nextval = $langs->trans($nextval);
314 $htmltooltip .= $nextval.
'<br>';
316 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
320 print
'<td class="center">';
321 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
351print
'<table class="noborder centpercent">'.
"\n";
352print
'<tr class="liste_titre">'.
"\n";
353print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
354print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
355print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
356print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
357print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
358print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
363foreach ($dirmodels as $reldir) {
364 $realpath = $reldir.
"core/modules/supplier_payment/doc";
368 $handle = opendir($dir);
371 if (is_resource($handle)) {
372 while (($file = readdir($handle)) !==
false) {
373 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
377 require_once $dir.
'/'.$file;
379 '@phan-var-force ModelePDFSuppliersPayments $module';
381 print
'<tr class="oddeven">'.
"\n";
386 if (method_exists(
$module,
'info')) {
395 if (in_array($name, $def)) {
396 print
'<td class="center">'.
"\n";
400 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.$name.
'&scandir='.
$module->scandir.
'&label='.urlencode(
$module->name).
'&type=SUPPLIER_PAYMENT">';
401 print img_picto($langs->trans(
"Enabled"),
'switch_on');
410 print
'<td class="center">'.
"\n";
411 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>';
416 print
'<td class="center">';
420 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>';
422 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>';
427 $htmltooltip =
''.$langs->trans(
"Name").
': '.
$module->name;
428 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.(
$module->type ?
$module->type : $langs->trans(
"Unknown"));
429 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.
$module->page_largeur.
'/'.
$module->page_hauteur;
430 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
432 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
433 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.yn(
$module->option_logo, 1, 1);
434 print
'<td class="center">';
435 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
437 print
'<td class="center">';
438 print
'<a href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'specimen',
'module' => $name],
true).
'">'.img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
460print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
461print
'<input type="hidden" name="token" value="'.newToken().
'" />';
462print
'<input type="hidden" name="action" value="setparams" />';
464print
'<div class="div-table-responsive-no-min">';
465print
'<table class="noborder centpercent">';
466print
'<tr class="liste_titre">';
467print
'<td>'.$langs->trans(
"Parameter").
'</td>';
468print
'<td align="center" width="60"></td>';
469print
'<td width="80"> </td>';
473print
'<tr class="oddeven"><td>';
474print $langs->trans(
"GroupPaymentsByModOnReports");
475print
'</td><td width="60" align="center">';
476print $form->selectyesno(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD",
getDolGlobalString(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD"), 1);
477print
'</td><td class="right">';
485print
'<div class="center">';
486print
'<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.
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')
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.