25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
31 $langs->loadLangs(array(
"admin",
"other",
"errors",
"bills"));
35 $action =
GETPOST(
'action',
'aZ09');
36 $value =
GETPOST(
'value',
'alpha');
37 $label =
GETPOST(
'label',
'alpha');
38 $scandir =
GETPOST(
'scan_dir',
'alpha');
41 if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON =
'mod_payment_cicada.php';
48 if ($action ==
'updateMask')
50 $maskconstpayment =
GETPOST(
'maskconstpayment',
'alpha');
51 $maskpayment =
GETPOST(
'maskpayment',
'alpha');
52 if ($maskconstpayment) $res =
dolibarr_set_const($db, $maskconstpayment, $maskpayment,
'chaine', 0,
'', $conf->entity);
54 if (!($res > 0)) $error++;
64 if ($action ==
'setmod')
69 if ($action ==
'setparams')
71 $freetext =
GETPOST(
'FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS',
'restricthtml');
72 $res =
dolibarr_set_const($db,
"FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext,
'chaine', 0,
'', $conf->entity);
73 if (!($res > 0)) $error++;
75 $res =
dolibarr_set_const($db,
"PAYMENTS_REPORT_GROUP_BY_MOD",
GETPOST(
'PAYMENTS_REPORT_GROUP_BY_MOD',
'int'),
'chaine', 0,
'', $conf->entity);
76 if (!($res > 0)) $error++;
93 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
95 llxHeader(
"", $langs->trans(
"BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura');
97 $form =
new Form($db);
100 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
112 print '<div class="div-table-responsive-no-min">';
113 print
'<table class="noborder centpercent">';
114 print
'<tr class="liste_titre">';
115 print
'<td>'.$langs->trans(
"Name").
'</td>';
116 print
'<td>'.$langs->trans(
"Description").
'</td>';
117 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
118 print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
119 print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
124 foreach ($dirmodels as $reldir)
129 $handle = opendir($dir);
130 if (is_resource($handle))
132 while (($file = readdir($handle)) !==
false)
134 if (!is_dir($dir.$file) || (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS'))
137 $classname = preg_replace(
'/\.php$/',
'', $file);
139 if (!is_file($dir.$filebis))
141 $filebis = $file.
"/".$file.
".modules.php";
142 $classname =
"mod_payment_".$file;
145 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
146 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code))
continue;
148 $classname = preg_replace(
'/\-.*$/',
'', $classname);
149 if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/', $filebis) || preg_match(
'/mod_/', $classname)) && substr($filebis,
dol_strlen($filebis) - 3, 3) ==
'php')
152 require_once $dir.$filebis;
154 $module =
new $classname($db);
157 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
158 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
160 if ($module->isEnabled())
163 print
'<tr class="oddeven"><td width="100">';
164 echo preg_replace(
'/\-.*$/',
'', preg_replace(
'/mod_payment_/',
'', preg_replace(
'/\.php$/',
'', $file)));
167 print $module->info();
172 print
'<td class="nowrap">';
173 $tmp = $module->getExample();
174 if (preg_match(
'/^Error/', $tmp)) {
175 $langs->load(
"errors");
176 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
177 } elseif ($tmp ==
'NotConfigured') print $langs->trans($tmp);
181 print '<td class="center">';
183 if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file)
185 print
img_picto($langs->trans(
"Activated"),
'switch_on');
187 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmo&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>';
192 $payment->initAsSpecimen();
196 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
197 $nextval = $module->getNextValue($mysoc, $payment);
198 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
199 $htmltooltip .= $langs->trans(
"NextValue").
': ';
201 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured')
202 $nextval = $langs->trans($nextval);
203 $htmltooltip .= $nextval.
'<br>';
205 $htmltooltip .= $langs->trans($module->error).
'<br>';
209 print
'<td class="center">';
210 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
212 if ($conf->global->PAYMENT_ADDON.
'.php' == $file)
236 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
237 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
238 print
'<input type="hidden" name="action" value="setparams" />';
240 print
'<div class="div-table-responsive-no-min">';
241 print
'<table class="noborder centpercent">';
242 print
'<tr class="liste_titre">';
243 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
244 print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
245 print
'<td width="80"> </td>';
249 print
'<tr class="oddeven"><td>';
250 print $langs->trans(
"PaymentOnDifferentThirdBills");
251 print
'</td><td width="60" align="center">';
252 print $form->selectyesno(
"FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS, 1);
253 print
'</td><td class="right">';
254 print
"</td></tr>\n";
257 print
'<tr class="oddeven"><td>';
258 print $langs->trans(
"GroupPaymentsByModOnReports");
259 print
'</td><td width="60" align="center">';
260 print $form->selectyesno(
"PAYMENTS_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_REPORT_GROUP_BY_MOD, 1);
261 print
'</td><td class="right">';
262 print
"</td></tr>\n";
270 print
'<div class="center">';
271 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'" />';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
invoice_admin_prepare_head()
Return array head with list of tabs to view object informations.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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)
Class to manage payments of customer invoices.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
print $_SERVER["PHP_SELF"] n
Edit parameters.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.