27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
33$langs->loadLangs(array(
"admin",
"other",
"errors",
"bills"));
39$action =
GETPOST(
'action',
'aZ09');
40$value =
GETPOST(
'value',
'alpha');
41$label =
GETPOST(
'label',
'alpha');
42$scandir =
GETPOST(
'scan_dir',
'alpha');
46 $conf->global->PAYMENT_ADDON =
'mod_payment_cicada.php';
54if ($action ==
'updateMask') {
55 $maskconstpayment =
GETPOST(
'maskconstpayment',
'aZ09');
56 $maskpayment =
GETPOST(
'maskpayment',
'alpha');
60 if ($maskconstpayment && preg_match(
'/_MASK$/', $maskconstpayment)) {
61 $res =
dolibarr_set_const($db, $maskconstpayment, $maskpayment,
'chaine', 0,
'', $conf->entity);
75if ($action ==
'setmod') {
79if ($action ==
'setparams') {
80 $freetext =
GETPOST(
'FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS',
'restricthtml');
81 $res =
dolibarr_set_const($db,
"FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext,
'chaine', 0,
'', $conf->entity);
86 $res =
dolibarr_set_const($db,
"PAYMENTS_REPORT_GROUP_BY_MOD",
GETPOSTINT(
'PAYMENTS_REPORT_GROUP_BY_MOD'),
'chaine', 0,
'', $conf->entity);
104$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
106llxHeader(
'', $langs->trans(
"BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura',
'', 0, 0,
'',
'',
'',
'mod-admin page-payment');
108$form =
new Form($db);
111$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
112print
load_fiche_titre($langs->trans(
"BillsSetup"), $linkback,
'title_setup');
123print
'<div class="div-table-responsive-no-min">';
124print
'<table class="noborder centpercent">';
125print
'<tr class="liste_titre">';
126print
'<td>'.$langs->trans(
"Name").
'</td>';
127print
'<td>'.$langs->trans(
"Description").
'</td>';
128print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
129print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
130print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
135foreach ($dirmodels as $reldir) {
138 $handle = opendir($dir);
139 if (is_resource($handle)) {
140 while (($file = readdir($handle)) !==
false) {
141 if (!is_dir($dir.$file) || (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS')) {
143 $classname = preg_replace(
'/\.php$/',
'', $file);
145 if (!is_file($dir.$filebis)) {
146 $filebis = $file.
"/".$file.
".modules.php";
147 $classname =
"mod_payment_".$file;
150 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
151 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) {
155 $classname = preg_replace(
'/\-.*$/',
'', $classname);
156 if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/', $filebis) || preg_match(
'/mod_/', $classname)) && substr($filebis,
dol_strlen($filebis) - 3, 3) ==
'php') {
158 require_once $dir.$filebis;
160 $module =
new $classname($db);
161 '@phan-var-force ModeleNumRefPayments $module';
164 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
167 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
171 if ($module->isEnabled()) {
172 print
'<tr class="oddeven"><td width="100">';
173 echo preg_replace(
'/\-.*$/',
'', preg_replace(
'/mod_payment_/',
'', preg_replace(
'/\.php$/',
'', $file)));
176 print $module->info($langs);
181 print
'<td class="nowrap">';
182 $tmp = $module->getExample();
183 if (preg_match(
'/^Error/', $tmp)) {
184 $langs->load(
"errors");
185 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
186 } elseif ($tmp ==
'NotConfigured') {
187 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
193 print
'<td class="center">';
195 if ($conf->global->PAYMENT_ADDON == $file ||
getDolGlobalString(
'PAYMENT_ADDON') .
'.php' == $file) {
196 print
img_picto($langs->trans(
"Activated"),
'switch_on');
198 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.preg_replace(
'/\.php$/',
'', $file).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
203 $payment->initAsSpecimen();
207 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
208 $nextval = $module->getNextValue($mysoc, $payment);
209 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
210 $htmltooltip .= $langs->trans(
"NextValue").
': ';
212 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
213 $nextval = $langs->trans($nextval);
215 $htmltooltip .= $nextval.
'<br>';
217 $htmltooltip .= $langs->trans($module->error).
'<br>';
221 print
'<td class="center">';
222 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
225 if (!empty($module->error)) {
249print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
250print
'<input type="hidden" name="token" value="'.newToken().
'" />';
251print
'<input type="hidden" name="action" value="setparams" />';
253print
'<div class="div-table-responsive-no-min">';
254print
'<table class="noborder centpercent">';
255print
'<tr class="liste_titre">';
256print
'<td>'.$langs->trans(
"Parameter").
'</td>';
257print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
258print
'<td width="80"> </td>';
262print
'<tr class="oddeven"><td>';
263print $langs->trans(
"PaymentOnDifferentThirdBills");
264print
'</td><td width="60" align="center">';
265print $form->selectyesno(
"FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",
getDolGlobalInt(
'FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'), 1);
266print
'</td><td class="right">';
270print
'<tr class="oddeven"><td>';
271print $langs->trans(
"GroupPaymentsByModOnReports");
272print
'</td><td width="60" align="center">';
273print $form->selectyesno(
"PAYMENTS_REPORT_GROUP_BY_MOD",
getDolGlobalInt(
'PAYMENTS_REPORT_GROUP_BY_MOD'), 1);
274print
'</td><td class="right">';
282print $form->buttonsSaveCancel(
"Modify",
'');
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).
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 of customer invoices.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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'.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
invoice_admin_prepare_head()
Return array head with list of tabs to view object information.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.