28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
35 $langs->loadLangs(array(
"admin",
"companies",
"bills",
"other",
"banks"));
40 $action =
GETPOST(
'action',
'aZ09');
41 $value =
GETPOST(
'value',
'alpha');
44 if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipts_mint.php';
52 if ($action ==
'updateMask')
54 $maskconstchequereceipts =
GETPOST(
'maskconstchequereceipts',
'alpha');
55 $maskchequereceipts =
GETPOST(
'maskchequereceipts',
'alpha');
56 if ($maskconstchequereceipts) $res =
dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts,
'chaine', 0,
'', $conf->entity);
58 if (!($res > 0)) $error++;
68 if ($action ==
'setmod')
70 dolibarr_set_const($db,
"CHEQUERECEIPTS_ADDON", $value,
'chaine', 0,
'', $conf->entity);
73 if ($action ==
'set_BANK_CHEQUERECEIPT_FREE_TEXT')
75 $freetext =
GETPOST(
'BANK_CHEQUERECEIPT_FREE_TEXT',
'restricthtml');
77 $res =
dolibarr_set_const($db,
"BANK_CHEQUERECEIPT_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
79 if (!($res > 0)) $error++;
93 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
94 llxHeader(
"", $langs->trans(
"BankSetupModule"));
96 $form =
new Form($db);
98 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
110 print '<table class="noborder centpercent">';
111 print
'<tr class="liste_titre">';
112 print
'<td>'.$langs->trans(
"Name").
'</td>';
113 print
'<td>'.$langs->trans(
"Description").
'</td>';
114 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
115 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
116 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
121 foreach ($dirmodels as $reldir)
126 $handle = opendir($dir);
127 if (is_resource($handle))
129 while (($file = readdir($handle)) !==
false)
131 if (!is_dir($dir.$file) || (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS'))
134 $name = substr($file, 4,
dol_strlen($file) - 16);
135 $classname = preg_replace(
'/\.php$/',
'', $file);
137 if (!is_file($dir.$filebis))
139 $filebis = $file.
"/".$file.
".modules.php";
140 $classname =
"mod_chequereceipt_".$file;
143 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
144 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code))
continue;
146 $classname = preg_replace(
'/\-.*$/',
'', $classname);
147 if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/', $filebis) || preg_match(
'/mod_/', $classname)) && substr($filebis,
dol_strlen($filebis) - 3, 3) ==
'php')
150 require_once $dir.$filebis;
152 $module =
new $classname($db);
155 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
156 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
158 if ($module->isEnabled())
160 print
'<tr class="oddeven"><td width="100">';
161 print (empty($module->name) ? $name : $module->name);
164 print $module->info();
169 print
'<td class="nowrap">';
170 $tmp = $module->getExample();
171 if (preg_match(
'/^Error/', $tmp)) {
172 $langs->load(
"errors");
173 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
174 } elseif ($tmp ==
'NotConfigured') print $langs->trans($tmp);
178 print '<td class="center">';
179 if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file)
181 print
img_picto($langs->trans(
"Activated"),
'switch_on');
183 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&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>';
188 $chequereceipts->initAsSpecimen();
192 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
193 $nextval = $module->getNextValue($mysoc, $chequereceipts);
194 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
195 $htmltooltip .= $langs->trans(
"NextValue").
': ';
197 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured')
198 $nextval = $langs->trans($nextval);
199 $htmltooltip .= $nextval.
'<br>';
201 $htmltooltip .= $langs->trans($module->error).
'<br>';
205 print
'<td class="center">';
206 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
208 if ($conf->global->CHEQUERECEIPTS_ADDON.
'.php' == $file)
235 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
236 print
'<input type="hidden" name="token" value="'.newToken().
'">';
237 print
'<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
239 print
'<table class="noborder centpercent">';
240 print
'<tr class="liste_titre">';
241 print
'<td>'.$langs->trans(
"Parameters").
'</td>';
242 print
'<td class="center" width="60"> </td>';
243 print
'<td width="80"> </td>';
247 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
248 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
249 foreach ($substitutionarray as $key => $val) $htmltext .= $key.
'<br>';
252 print
'<tr class="oddeven"><td colspan="2">';
253 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnChequeReceipts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
254 $variablename =
'BANK_CHEQUERECEIPT_FREE_TEXT';
255 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
257 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.$conf->global->$variablename.
'</textarea>';
259 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
260 $doleditor =
new DolEditor($variablename, $conf->global->$variablename,
'', 80,
'dolibarr_notes');
261 print $doleditor->Create();
263 print
'</td><td class="right">';
264 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
265 print
"</td></tr>\n";
269 print
'</table>'.
"\n";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
bank_admin_prepare_head($object)
Prepare array with list of tabs.
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.
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)
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 ...
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
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.
Class to manage a WYSIWYG editor.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
Class to manage cheque delivery receipts.