27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
33$langs->loadLangs(array(
"admin",
"errors",
"other",
"bills",
"orders"));
39$action =
GETPOST(
'action',
'aZ09');
40$value =
GETPOST(
'value',
'alpha');
41$modulepart =
GETPOST(
'modulepart',
'aZ09');
43$label =
GETPOST(
'label',
'alpha');
44$scandir =
GETPOST(
'scandir',
'alpha');
45$type =
'supplier_payment';
52include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
54if ($action ==
'updateMask') {
55 $maskconstsupplierpayment =
GETPOST(
'maskconstsupplierpayment',
'aZ09');
56 $masksupplierpayment =
GETPOST(
'masksupplierpayment',
'alpha');
57 if ($maskconstsupplierpayment && preg_match(
'/_MASK$/', $maskconstsupplierpayment)) {
58 $res =
dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment,
'chaine', 0,
'', $conf->entity);
70} elseif ($action ==
'setmod') {
71 dolibarr_set_const($db,
"SUPPLIER_PAYMENT_ADDON", $value,
'chaine', 0,
'', $conf->entity);
72} elseif ($action ==
'set') {
75} elseif ($action ==
'del') {
82} elseif ($action ==
'setdoc') {
84 if (
dolibarr_set_const($db,
"SUPPLIER_PAYMENT_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
87 $conf->global->FACTURE_ADDON_PDF = $value;
95} elseif ($action ==
'unsetdoc') {
97} elseif ($action ==
'specimen') {
98 $modele =
GETPOST(
'module',
'alpha');
101 $paiementFourn->initAsSpecimen();
104 $file =
''; $classname =
''; $filefound = 0;
105 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
106 foreach ($dirmodels as $reldir) {
107 $file =
dol_buildpath($reldir.
"core/modules/supplier_payment/doc/pdf_".$modele.
".modules.php", 0);
108 if (file_exists($file)) {
110 $classname =
"pdf_".$modele;
118 $module =
new $classname($db);
120 if ($module->write_file($paiementFourn, $langs) > 0) {
121 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf");
129 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
131} elseif ($action ==
'setparams') {
132 $res =
dolibarr_set_const($db,
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD",
GETPOST(
'PAYMENTS_FOURN_REPORT_GROUP_BY_MOD',
'int'),
'chaine', 0,
'', $conf->entity);
149$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
151llxHeader(
"", $langs->trans(
"SupplierPaymentSetup"),
'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur');
153$form =
new Form($db);
156$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
157print
load_fiche_titre($langs->trans(
"SupplierPaymentSetup"), $linkback,
'title_setup');
162print
dol_get_fiche_head($head,
'supplierpayment', $langs->trans(
"Suppliers"), -1,
'company');
168if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) {
169 $conf->global->SUPPLIER_PAYMENT_ADDON =
'mod_supplier_payment_bronan';
177$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
178$sql .=
" WHERE type = '".$db->escape($type).
"'";
179$sql .=
" AND entity = ".$conf->entity;
180$resql = $db->query($sql);
183 $num_rows = $db->num_rows($resql);
184 while ($i < $num_rows) {
185 $array = $db->fetch_array($resql);
186 array_push($def, $array[0]);
193print
'<table class="noborder centpercent">';
194print
'<tr class="liste_titre">';
195print
'<td>'.$langs->trans(
"Name").
'</td>';
196print
'<td>'.$langs->trans(
"Description").
'</td>';
197print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
198print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
199print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
204foreach ($dirmodels as $reldir) {
205 $dir =
dol_buildpath($reldir.
"core/modules/supplier_payment/");
207 $handle = opendir($dir);
208 if (is_resource($handle)) {
209 while (($file = readdir($handle)) !==
false) {
210 if (!is_dir($dir.$file) || (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS')) {
212 $classname = preg_replace(
'/\.php$/',
'', $file);
214 if (!is_file($dir.$filebis)) {
215 $filebis = $file.
"/".$file.
".modules.php";
216 $classname =
"mod_supplier_payment_".$file;
219 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
220 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) {
224 $classname = preg_replace(
'/\-.*$/',
'', $classname);
225 if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/', $filebis) || preg_match(
'/mod_/', $classname)) && substr($filebis,
dol_strlen($filebis) - 3, 3) ==
'php') {
227 require_once $dir.$filebis;
229 $module =
new $classname($db);
232 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
235 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
239 if ($module->isEnabled()) {
240 print
'<tr class="oddeven"><td width="100">';
241 echo preg_replace(
'/\-.*$/',
'', preg_replace(
'/mod_supplier_payment_/',
'', preg_replace(
'/\.php$/',
'', $file)));
244 print $module->info();
249 print
'<td class="nowrap">';
250 $tmp = $module->getExample();
251 if (preg_match(
'/^Error/', $tmp)) {
252 $langs->load(
"errors");
253 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
254 } elseif ($tmp ==
'NotConfigured') {
255 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
261 print
'<td class="center">';
263 if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.
'.php' == $file) {
264 print
img_picto($langs->trans(
"Activated"),
'switch_on');
266 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.newToken().
'&value='.preg_replace(
'/\.php$/',
'', $file).(!empty($module->scandir) ?
'&scandir='.$module->scandir :
'').
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
271 $payment->initAsSpecimen();
275 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
276 $nextval = $module->getNextValue($mysoc, $payment);
277 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
278 $htmltooltip .= $langs->trans(
"NextValue").
': ';
280 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
281 $nextval = $langs->trans($nextval);
283 $htmltooltip .= $nextval.
'<br>';
285 $htmltooltip .= $langs->trans($module->error).
'<br>';
289 print
'<td class="center">';
290 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
293 if (!empty($module->error)) {
319print
'<table class="noborder centpercent">'.
"\n";
320print
'<tr class="liste_titre">'.
"\n";
321print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
322print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
323print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
324print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
325print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
326print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
331foreach ($dirmodels as $reldir) {
332 $realpath = $reldir.
"core/modules/supplier_payment/doc";
336 $handle = opendir($dir);
339 if (is_resource($handle)) {
340 while (($file = readdir($handle)) !==
false) {
341 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
342 $name = substr($file, 4,
dol_strlen($file) - 16);
343 $classname = substr($file, 0,
dol_strlen($file) - 12);
345 require_once $dir.
'/'.$file;
348 print
"<tr class=\"oddeven\">\n";
350 print (empty($module->name) ? $name : $module->
name);
353 require_once $dir.
'/'.$file;
354 $module =
new $classname($db,
new Societe($db));
355 if (method_exists($module,
'info')) {
356 print $module->info($langs);
358 print $module->description;
364 if (in_array($name, $def)) {
365 print
'<td class="center">'.
"\n";
369 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&value='.$name.
'&scandir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=SUPPLIER_PAYMENT">';
370 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
379 print
'<td class="center">'.
"\n";
380 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>';
385 print
'<td class="center">';
389 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>';
391 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>';
396 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
397 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
398 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
399 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
401 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
402 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
403 print
'<td class="center">';
404 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
406 print
'<td class="center">';
407 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
429print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
430print
'<input type="hidden" name="token" value="'.newToken().
'" />';
431print
'<input type="hidden" name="action" value="setparams" />';
433print
'<div class="div-table-responsive-no-min">';
434print
'<table class="noborder centpercent">';
435print
'<tr class="liste_titre">';
436print
'<td>'.$langs->trans(
"Parameter").
'</td>';
437print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
438print
'<td width="80"> </td>';
442print
'<tr class="oddeven"><td>';
443print $langs->trans(
"GroupPaymentsByModOnReports");
444print
'</td><td width="60" align="center">';
445print $form->selectyesno(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD",
getDolGlobalString(
"PAYMENTS_FOURN_REPORT_GROUP_BY_MOD"), 1);
446print
'</td><td class="right">';
454print
'<div class="center">';
455print
'<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()
Empty header.
Class to manage payments for supplier invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object informations.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$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.