30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
37 $langs->loadLangs(array(
"admin",
"companies",
"bills",
"other",
"banks"));
43 $action =
GETPOST(
'action',
'aZ09');
44 $value =
GETPOST(
'value',
'alpha');
48 $conf->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipts_mint.php';
57 if ($action ==
'updateMask') {
58 $maskconstchequereceipts =
GETPOST(
'maskconstchequereceipts',
'aZ09');
59 $maskchequereceipts =
GETPOST(
'maskchequereceipts',
'alpha');
60 if ($maskconstchequereceipts && preg_match(
'/_MASK$/', $maskconstchequereceipts)) {
61 $res =
dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts,
'chaine', 0,
'', $conf->entity);
75 if ($action ==
'setmod') {
76 dolibarr_set_const($db,
"CHEQUERECEIPTS_ADDON", $value,
'chaine', 0,
'', $conf->entity);
79 if ($action ==
'set_BANK_CHEQUERECEIPT_FREE_TEXT') {
80 $freetext =
GETPOST(
'BANK_CHEQUERECEIPT_FREE_TEXT',
'restricthtml');
82 $res =
dolibarr_set_const($db,
"BANK_CHEQUERECEIPT_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
99 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
100 llxHeader(
"", $langs->trans(
"BankSetupModule"));
102 $form =
new Form($db);
104 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
105 print
load_fiche_titre($langs->trans(
"BankSetupModule"), $linkback,
'title_setup');
108 print
dol_get_fiche_head($head,
'checkreceipts', $langs->trans(
"BankSetupModule"), -1,
'account');
114 print
load_fiche_titre($langs->trans(
"ChequeReceiptsNumberingModule"),
'',
'');
116 print
'<div class="div-table-responsive-no-min">';
117 print
'<table class="noborder centpercent">';
118 print
'<tr class="liste_titre">';
119 print
'<td>'.$langs->trans(
"Name").
'</td>';
120 print
'<td>'.$langs->trans(
"Description").
'</td>';
121 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
122 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
123 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
128 foreach ($dirmodels as $reldir) {
131 $handle = opendir($dir);
132 if (is_resource($handle)) {
133 while (($file = readdir($handle)) !==
false) {
134 if (!is_dir($dir.$file) || (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS')) {
136 $name = substr($file, 4,
dol_strlen($file) - 16);
137 $classname = preg_replace(
'/\.php$/',
'', $file);
139 if (!is_file($dir.$filebis)) {
140 $filebis = $file.
"/".$file.
".modules.php";
141 $classname =
"mod_chequereceipt_".$file;
144 preg_match(
'/\-(.*)_(.*)$/', $classname, $reg);
145 if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) {
149 $classname = preg_replace(
'/\-.*$/',
'', $classname);
150 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);
155 '@phan-var-force ModeleNumRefChequeReceipts $module';
158 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
161 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
165 if ($module->isEnabled()) {
166 print
'<tr class="oddeven"><td width="100">';
167 print(empty($module->name) ? $name : $module->name);
170 print $module->info($langs);
175 print
'<td class="nowrap">';
176 $tmp = $module->getExample();
177 if (preg_match(
'/^Error/', $tmp)) {
178 $langs->load(
"errors");
179 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
180 } elseif ($tmp ==
'NotConfigured') {
181 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
187 print
'<td class="center">';
188 if ($conf->global->CHEQUERECEIPTS_ADDON == $file ||
getDolGlobalString(
'CHEQUERECEIPTS_ADDON') .
'.php' == $file) {
189 print
img_picto($langs->trans(
"Activated"),
'switch_on');
191 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.preg_replace(
'/\.php$/',
'', $file).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
196 $chequereceipts->initAsSpecimen();
200 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
201 $nextval = $module->getNextValue($mysoc, $chequereceipts);
202 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
203 $htmltooltip .= $langs->trans(
"NextValue").
': ';
205 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
206 $nextval = $langs->trans($nextval);
208 $htmltooltip .= $nextval.
'<br>';
210 $htmltooltip .= $langs->trans($module->error).
'<br>';
214 print
'<td class="center">';
215 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
218 if (!empty($module->error)) {
246 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
247 print
'<input type="hidden" name="token" value="'.newToken().
'">';
248 print
'<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
250 print
'<table class="noborder centpercent">';
251 print
'<tr class="liste_titre">';
252 print
'<td>'.$langs->trans(
"Parameters").
'</td>';
253 print
'<td class="center" width="60"> </td>';
254 print
'<td width="80"> </td>';
258 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
259 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
260 foreach ($substitutionarray as $key => $val) {
261 $htmltext .= $key.
'<br>';
265 print
'<tr class="oddeven"><td colspan="2">';
266 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnChequeReceipts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
267 $variablename =
'BANK_CHEQUERECEIPT_FREE_TEXT';
269 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
271 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
273 print $doleditor->Create();
275 print
'</td><td class="right">';
276 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
277 print
"</td></tr>\n";
281 print
'</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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
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 formatted 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).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.