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',
'alpha');
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++;
70 if ($action ==
'setmod')
72 dolibarr_set_const($db,
"CHEQUERECEIPTS_ADDON",$value,
'chaine', 0,
'', $conf->entity);
75 if ($action ==
'set_BANK_CHEQUERECEIPT_FREE_TEXT')
77 $freetext =
GETPOST(
'BANK_CHEQUERECEIPT_FREE_TEXT',
'none');
79 $res =
dolibarr_set_const($db,
"BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,
'chaine',0,
'',$conf->entity);
81 if (! $res > 0) $error++;
97 $dirmodels=array_merge(array(
'/'),(array) $conf->modules_parts[
'models']);
98 llxHeader(
"",$langs->trans(
"BankSetupModule"));
102 $linkback=
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
106 dol_fiche_head($head,
'checkreceipts', $langs->trans(
"BankSetupModule"), -1,
'account');
114 print '<table class="noborder" width="100%">';
115 print
'<tr class="liste_titre">';
116 print
'<td>'.$langs->trans(
"Name").
'</td>';
117 print
'<td>'.$langs->trans(
"Description").
'</td>';
118 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
119 print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
120 print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
125 foreach ($dirmodels as $reldir)
130 $handle = opendir($dir);
131 if (is_resource($handle))
133 while (($file = readdir($handle))!==
false)
135 if (! is_dir($dir.$file) || (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS'))
138 $name = substr($file, 4,
dol_strlen($file) -16);
139 $classname = preg_replace(
'/\.php$/',
'',$file);
141 if (! is_file($dir.$filebis))
143 $filebis = $file.
"/".$file.
".modules.php";
144 $classname =
"mod_chequereceipt_".$file;
147 preg_match(
'/\-(.*)_(.*)$/',$classname,$reg);
148 if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code))
continue;
150 $classname = preg_replace(
'/\-.*$/',
'',$classname);
151 if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match(
'/mod_/',$filebis) || preg_match(
'/mod_/',$classname)) && substr($filebis,
dol_strlen($filebis)-3, 3) ==
'php')
154 require_once $dir.$filebis;
156 $module =
new $classname($db);
159 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
160 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
162 if ($module->isEnabled())
164 print
'<tr class="oddeven"><td width="100">';
165 print (empty($module->name)?$name:$module->name);
168 print $module->info();
173 print
'<td class="nowrap">';
174 $tmp=$module->getExample();
175 if (preg_match(
'/^Error/',$tmp)) print
'<div class="error">'.$langs->trans($tmp).
'</div>';
176 elseif ($tmp==
'NotConfigured') print $langs->trans($tmp);
180 print '<td align="center">';
181 if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file)
183 print
img_picto($langs->trans(
"Activated"),
'switch_on');
187 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&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 $chequereceipts->initAsSpecimen();
196 $htmltooltip.=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
197 $nextval=$module->getNextValue($mysoc,$chequereceipts);
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 align="center">';
210 print $form->textwithpicto(
'',$htmltooltip,1,0);
212 if ($conf->global->CHEQUERECEIPTS_ADDON.
'.php' == $file)
240 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
241 print
'<input type="hidden" name="token" value="'.$_SESSION[
'newtoken'].
'">';
242 print
'<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
244 print
'<table class="noborder" width="100%">';
245 print
'<tr class="liste_titre">';
246 print
'<td>'.$langs->trans(
"Parameters").
'</td>';
247 print
'<td align="center" width="60"> </td>';
248 print
'<td width="80"> </td>';
252 $substitutionarray[
'__(AnyTranslationKey)__']=$langs->trans(
"Translation");
253 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
254 foreach($substitutionarray as $key => $val) $htmltext.=$key.
'<br>';
257 print
'<tr class="oddeven"><td colspan="2">';
258 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnChequeReceipts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
259 $variablename=
'BANK_CHEQUERECEIPT_FREE_TEXT';
260 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
262 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.$conf->global->$variablename.
'</textarea>';
266 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
267 $doleditor=
new DolEditor($variablename, $conf->global->$variablename,
'',80,
'dolibarr_notes');
268 print $doleditor->Create();
270 print
'</td><td align="right">';
271 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
272 print
"</td></tr>\n";
276 print
'</table>'.
"\n";
bank_admin_prepare_head($object)
Prepare array with list of tabs.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
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.
if(! GETPOST('transkey', 'alphanohtml') &&! GETPOST('transphrase', 'alphanohtml')) else
View.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_fiche_end($notab=0)
Show tab footer of a card.
if(GETPOST('cancel', 'alpha')) if(! GETPOST( 'confirmmassaction', 'alpha') &&$massaction !='presend' &&$massaction !='confirm_presend')
Draft customers invoices.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
Class to manage a WYSIWYG editor.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Class to manage cheque delivery receipts.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).