29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
44$langs->loadLangs(array(
"admin",
"errors",
"other",
"bills",
"orders"));
50$action =
GETPOST(
'action',
'aZ09');
51$value =
GETPOST(
'value',
'alpha');
52$modulepart =
GETPOST(
'modulepart',
'aZ09');
54$label =
GETPOST(
'label',
'alpha');
55$scandir =
GETPOST(
'scandir',
'alpha');
56$type =
'supplier_payment';
63include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
65if ($action ==
'updateMask') {
66 $maskconstsupplierpayment =
GETPOST(
'maskconstsupplierpayment',
'aZ09');
67 $masksupplierpayment =
GETPOST(
'masksupplierpayment',
'alpha');
71 if ($maskconstsupplierpayment && preg_match(
'/_MASK$/', $maskconstsupplierpayment)) {
72 $res =
dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment,
'chaine', 0,
'',
$conf->entity);
84} elseif ($action ==
'setmod') {
86} elseif ($action ==
'set') {
89} elseif ($action ==
'del') {
96} elseif ($action ==
'setdoc') {
101 $conf->global->FACTURE_ADDON_PDF = $value;
109} elseif ($action ==
'unsetdoc') {
111} elseif ($action ==
'specimen') {
112 $modele =
GETPOST(
'module',
'alpha');
115 $paiementFourn->initAsSpecimen();
120 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
121 foreach ($dirmodels as $reldir) {
122 $file =
dol_buildpath($reldir.
"core/modules/supplier_payment/doc/pdf_".$modele.
".modules.php", 0);
123 if (file_exists($file)) {
124 $classname =
"pdf_".$modele;
129 if ($classname !==
'') {
132 $module =
new $classname($db);
133 '@phan-var-force ModelePDFSuppliersPayments $module';
135 if ($module->write_file($paiementFourn, $langs) > 0) {
136 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf");
144 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
146} elseif ($action ==
'setparams') {
165$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
167llxHeader(
'', $langs->trans(
"SupplierPaymentSetup"),
'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur',
'', 0, 0,
'',
'',
'',
'mod-admin page-supplier_payment');
169$form =
new Form($db);
172$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
173print
load_fiche_titre($langs->trans(
"SuppliersSetup"), $linkback,
'title_setup');
178print
dol_get_fiche_head($head,
'supplierpayment', $langs->trans(
"Suppliers"), -1,
'company');
185 $conf->global->SUPPLIER_PAYMENT_ADDON =
'mod_supplier_payment_bronan';
193$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
194$sql .=
" WHERE type = '".$db->escape($type).
"'";
195$sql .=
" AND entity = ".$conf->entity;
196$resql = $db->query($sql);
199 $num_rows = $db->num_rows($resql);
200 while ($i < $num_rows) {
201 $array = $db->fetch_array($resql);
202 if (is_array($array)) {
203 array_push($def, $array[0]);
211print
'<table class="noborder centpercent">';
212print
'<tr class="liste_titre">';
213print
'<td>'.$langs->trans(
"Name").
'</td>';
214print
'<td>'.$langs->trans(
"Description").
'</td>';
215print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
216print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
217print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
222foreach ($dirmodels as $reldir) {
223 $dir =
dol_buildpath($reldir.
"core/modules/supplier_payment/");
225 $handle = opendir($dir);
226 if (is_resource($handle)) {
227 while (($file = readdir($handle)) !==
false) {
228 if (!is_dir($dir.$file) || (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS')) {
230 $classname = preg_replace(
'/\.php$/',
'', $file);
232 if (!is_file($dir.$filebis)) {
233 $filebis = $file.
"/".$file.
".modules.php";
234 $classname =
"mod_supplier_payment_".$file;
238 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
239 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) {
243 $classname = preg_replace(
'/\-.*$/',
'', $classname);
244 if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/', $filebis) || preg_match(
'/mod_/', $classname)) && substr($filebis,
dol_strlen($filebis) - 3, 3) ==
'php') {
246 require_once $dir.$filebis;
248 $module =
new $classname($db);
250 '@phan-var-force ModeleNumRefSupplierPayments $module';
253 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
256 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
260 if ($module->isEnabled()) {
261 print
'<tr class="oddeven"><td width="100">';
262 echo preg_replace(
'/\-.*$/',
'', preg_replace(
'/mod_supplier_payment_/',
'', preg_replace(
'/\.php$/',
'', $file)));
265 print $module->info($langs);
270 print
'<td class="nowrap">';
271 $tmp = $module->getExample();
272 if (preg_match(
'/^Error/', $tmp)) {
273 $langs->load(
"errors");
274 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
275 } elseif ($tmp ==
'NotConfigured') {
276 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
282 print
'<td class="center">';
284 print
img_picto($langs->trans(
"Activated"),
'switch_on');
286 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>';
291 $payment->initAsSpecimen();
295 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
296 $nextval = $module->getNextValue($mysoc, $payment);
297 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
298 $htmltooltip .= $langs->trans(
"NextValue").
': ';
300 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
301 $nextval = $langs->trans($nextval);
303 $htmltooltip .= $nextval.
'<br>';
305 $htmltooltip .= $langs->trans($module->error).
'<br>';
309 print
'<td class="center">';
310 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
313 if (!empty($module->error)) {
340print
'<table class="noborder centpercent">'.
"\n";
341print
'<tr class="liste_titre">'.
"\n";
342print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
343print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
344print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
345print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
346print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
347print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
352foreach ($dirmodels as $reldir) {
353 $realpath = $reldir.
"core/modules/supplier_payment/doc";
357 $handle = opendir($dir);
360 if (is_resource($handle)) {
361 while (($file = readdir($handle)) !==
false) {
362 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
363 $name = substr($file, 4,
dol_strlen($file) - 16);
364 $classname = substr($file, 0,
dol_strlen($file) - 12);
366 require_once $dir.
'/'.$file;
367 $module =
new $classname($db);
368 '@phan-var-force ModelePDFSuppliersPayments $module';
370 print
'<tr class="oddeven">'.
"\n";
372 print(empty($module->name) ? $name : $module->
name);
375 if (method_exists($module,
'info')) {
376 print $module->info($langs);
378 print $module->description;
384 if (in_array($name, $def)) {
385 print
'<td class="center">'.
"\n";
389 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&value='.$name.
'&scandir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=SUPPLIER_PAYMENT">';
390 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
399 print
'<td class="center">'.
"\n";
400 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>';
405 print
'<td class="center">';
409 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>';
411 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>';
416 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
417 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
418 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
419 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
421 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
422 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
423 print
'<td class="center">';
424 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
426 print
'<td class="center">';
427 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
449print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
450print
'<input type="hidden" name="token" value="'.newToken().
'" />';
451print
'<input type="hidden" name="action" value="setparams" />';
453print
'<div class="div-table-responsive-no-min">';
454print
'<table class="noborder centpercent">';
455print
'<tr class="liste_titre">';
456print
'<td>'.$langs->trans(
"Parameter").
'</td>';
457print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
458print
'<td width="80"> </td>';
462print
'<tr class="oddeven"><td>';
463print $langs->trans(
"GroupPaymentsByModOnReports");
464print
'</td><td width="60" align="center">';
465print $form->selectyesno(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD",
getDolGlobalString(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD"), 1);
466print
'</td><td class="right">';
474print
'<div class="center">';
475print
'<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.
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.
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object information.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$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.