29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
36$langs->loadLangs(array(
"admin",
"companies",
"bills",
"other",
"banks"));
42$action =
GETPOST(
'action',
'aZ09');
43$value =
GETPOST(
'value',
'alpha');
46if (empty($conf->global->CHEQUERECEIPTS_ADDON)) {
47 $conf->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipts_mint.php';
56if ($action ==
'updateMask') {
57 $maskconstchequereceipts =
GETPOST(
'maskconstchequereceipts',
'aZ09');
58 $maskchequereceipts =
GETPOST(
'maskchequereceipts',
'alpha');
59 if ($maskconstchequereceipts && preg_match(
'/_MASK$/', $maskconstchequereceipts)) {
60 $res =
dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts,
'chaine', 0,
'', $conf->entity);
74if ($action ==
'setmod') {
75 dolibarr_set_const($db,
"CHEQUERECEIPTS_ADDON", $value,
'chaine', 0,
'', $conf->entity);
78if ($action ==
'set_BANK_CHEQUERECEIPT_FREE_TEXT') {
79 $freetext =
GETPOST(
'BANK_CHEQUERECEIPT_FREE_TEXT',
'restricthtml');
81 $res =
dolibarr_set_const($db,
"BANK_CHEQUERECEIPT_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
98$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
99llxHeader(
"", $langs->trans(
"BankSetupModule"));
101$form =
new Form($db);
103$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
104print
load_fiche_titre($langs->trans(
"BankSetupModule"), $linkback,
'title_setup');
107print
dol_get_fiche_head($head,
'checkreceipts', $langs->trans(
"BankSetupModule"), -1,
'account');
113print
load_fiche_titre($langs->trans(
"ChequeReceiptsNumberingModule"),
'',
'');
115print
'<table class="noborder centpercent">';
116print
'<tr class="liste_titre">';
117print
'<td>'.$langs->trans(
"Name").
'</td>';
118print
'<td>'.$langs->trans(
"Description").
'</td>';
119print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
120print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
121print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
126foreach ($dirmodels as $reldir) {
129 $handle = opendir($dir);
130 if (is_resource($handle)) {
131 while (($file = readdir($handle)) !==
false) {
132 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)) {
138 $filebis = $file.
"/".$file.
".modules.php";
139 $classname =
"mod_chequereceipt_".$file;
142 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
143 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) {
147 $classname = preg_replace(
'/\-.*$/',
'', $classname);
148 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) {
158 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
162 if ($module->isEnabled()) {
163 print
'<tr class="oddeven"><td width="100">';
164 print (empty($module->name) ? $name : $module->
name);
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') {
178 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
184 print
'<td class="center">';
185 if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.
'.php' == $file) {
186 print
img_picto($langs->trans(
"Activated"),
'switch_on');
188 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>';
193 $chequereceipts->initAsSpecimen();
197 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
198 $nextval = $module->getNextValue($mysoc, $chequereceipts);
199 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
200 $htmltooltip .= $langs->trans(
"NextValue").
': ';
202 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
203 $nextval = $langs->trans($nextval);
205 $htmltooltip .= $nextval.
'<br>';
207 $htmltooltip .= $langs->trans($module->error).
'<br>';
211 print
'<td class="center">';
212 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
215 if (!empty($module->error)) {
242print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
243print
'<input type="hidden" name="token" value="'.newToken().
'">';
244print
'<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
246print
'<table class="noborder centpercent">';
247print
'<tr class="liste_titre">';
248print
'<td>'.$langs->trans(
"Parameters").
'</td>';
249print
'<td class="center" width="60"> </td>';
250print
'<td width="80"> </td>';
254$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
255$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
256foreach ($substitutionarray as $key => $val) {
257 $htmltext .= $key.
'<br>';
261print
'<tr class="oddeven"><td colspan="2">';
262print $form->textwithpicto($langs->trans(
"FreeLegalTextOnChequeReceipts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
263$variablename =
'BANK_CHEQUERECEIPT_FREE_TEXT';
264if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
265 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
267 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
269 print $doleditor->Create();
271print
'</td><td class="right">';
272print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
277print
'</table>'.
"\n";
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()
Empty header.
bank_admin_prepare_head($object)
Prepare array with list of tabs.
Class to manage a WYSIWYG editor.
Class to manage cheque delivery receipts.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
$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.