27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
35 $langs->loadLangs(array(
"admin",
"companies",
"bills",
"other",
"banks"));
40 $action =
GETPOST(
'action',
'aZ09');
41 $actionsave =
GETPOST(
'save',
'alpha');
42 $value =
GETPOST(
'value',
'alpha');
43 $label =
GETPOST(
'label',
'alpha');
44 $scandir =
GETPOST(
'scan_dir',
'alpha');
45 $type =
'bankaccount';
53 if ($action ==
'setbankorder') {
56 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
64 if ($action ==
'setreportlastnumreleve') {
65 if (
dolibarr_set_const($db,
"BANK_REPORT_LAST_NUM_RELEVE", 1,
'chaine', 0,
'', $conf->entity) > 0)
67 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
72 } elseif ($action ==
'unsetreportlastnumreleve') {
73 if (
dolibarr_set_const($db,
"BANK_REPORT_LAST_NUM_RELEVE", 0,
'chaine', 0,
'', $conf->entity) > 0)
75 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
83 if ($action ==
'setbankcolorizemovement') {
84 if (
dolibarr_set_const($db,
"BANK_COLORIZE_MOVEMENT", 1,
'chaine', 0,
'', $conf->entity) > 0)
86 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
91 } elseif ($action ==
'unsetbankcolorizemovement') {
92 if (
dolibarr_set_const($db,
"BANK_COLORIZE_MOVEMENT", 0,
'chaine', 0,
'', $conf->entity) > 0)
94 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
105 $i = 1; $errorsaved = 0;
111 $color =
GETPOST(
'BANK_COLORIZE_MOVEMENT_COLOR'.$i,
'alpha');
112 if ($color ==
'-1') $color =
'';
114 $res =
dolibarr_set_const($db,
'BANK_COLORIZE_MOVEMENT_COLOR'.$i, $color,
'chaine', 0,
'', $conf->entity);
115 if (!($res > 0)) $error++;
125 if (empty($errorsaved))
setEventMessages($langs->trans(
"Error"), null,
'errors');
130 if ($action ==
'specimen') {
131 $modele =
GETPOST(
'module',
'alpha');
133 if ($modele ==
'sepamandate') {
138 $object->initAsSpecimen();
144 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
145 foreach ($dirmodels as $reldir) {
146 $file =
dol_buildpath($reldir.
"core/modules/bank/doc/pdf_".$modele.
".modules.php", 0);
147 if (file_exists($file)) {
149 $classname =
"pdf_".$modele;
157 $module =
new $classname($db);
159 if ($module->write_file($object, $langs) > 0) {
160 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=bank&file=SPECIMEN.pdf");
168 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
173 if ($action ==
'set') {
175 } elseif ($action ==
'del') {
178 if ($conf->global->BANKADDON_PDF ==
"$value")
183 elseif ($action ==
'setdoc') {
184 if (
dolibarr_set_const($db,
"BANKADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
187 $conf->global->BANKADDON_PDF = $value;
203 $form =
new Form($db);
206 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
208 llxHeader(
"", $langs->trans(
"BankSetupModule"));
210 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
213 print '<form name="bankmovementcolorconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
214 print '<input type="hidden" name="token" value="'.newToken().
'">';
215 print '<input type="hidden" name="action" value="save">';
223 print '<table class="noborder centpercent">';
224 print
'<tr class="liste_titre">';
225 print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
226 print
'<td>'.$langs->trans(
"Description").
'</td>';
227 print
'<td>'.$langs->trans(
"Example").
'</td>';
228 print
'<td class="center">'.$langs->trans(
"Status").
'</td>';
229 print
'<td class="center" width="60"> </td>';
232 $bankorder[0][0] = $langs->trans(
"BankOrderGlobal");
233 $bankorder[0][1] = $langs->trans(
"BankOrderGlobalDesc");
234 $bankorder[0][2] =
'BankCode DeskCode BankAccountNumber BankAccountNumberKey';
235 $bankorder[1][0] = $langs->trans(
"BankOrderES");
236 $bankorder[1][1] = $langs->trans(
"BankOrderESDesc");
237 $bankorder[1][2] =
'BankCode DeskCode BankAccountNumberKey BankAccountNumber';
241 $nbofbank = count($bankorder);
242 while ($i < $nbofbank) {
243 print
'<tr class="oddeven">';
244 print
'<td>'.$bankorder[$i][0].
"</td><td>\n";
245 print $bankorder[$i][1];
247 print
'<td class="nowrap">';
248 $tmparray = explode(
' ', $bankorder[$i][2]);
249 foreach ($tmparray as $key => $val) {
252 print $langs->trans($val);
256 if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
257 print
'<td class="center">';
258 print
img_picto($langs->trans(
"Activated"),
'on');
261 print
'<td class="center"><a href="'.$_SERVER[
'PHP_SELF'].
'?action=setbankorder&token='.
newToken().
'&value='.$i.
'">';
262 print
img_picto($langs->trans(
"Disabled"),
'off');
265 print
'<td> </td>';
270 print
'</table>'.
"\n";
285 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
286 $sql .=
" WHERE type = '".$db->escape($type).
"'";
287 $sql .=
" AND entity = ".$conf->entity;
288 $resql = $db->query($sql);
291 $num_rows = $db->num_rows(
$resql);
292 while ($i < $num_rows) {
293 $array = $db->fetch_array(
$resql);
294 array_push($def, $array[0]);
301 print
"<table class=\"noborder\" width=\"100%\">\n";
302 print
"<tr class=\"liste_titre\">\n";
303 print
'<td>'.$langs->trans(
"Name").
'</td>';
304 print
'<td>'.$langs->trans(
"Description").
'</td>';
305 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
306 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
307 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
308 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
313 foreach ($dirmodels as $reldir) {
314 foreach (array(
'',
'/doc') as $valdir) {
318 $handle = opendir($dir);
319 if (is_resource($handle)) {
320 while (($file = readdir($handle)) !==
false) {
326 foreach ($filelist as $file) {
327 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
328 if (file_exists($dir.
'/'.$file)) {
329 $name = substr($file, 4,
dol_strlen($file) - 16);
330 $classname = substr($file, 0,
dol_strlen($file) - 12);
332 require_once $dir.
'/'.$file;
333 $module =
new $classname($db);
335 $modulequalified = 1;
336 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
337 $modulequalified = 0;
338 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
339 $modulequalified = 0;
341 if ($modulequalified) {
342 print
'<tr class="oddeven"><td width="100">';
343 print(empty($module->name) ? $name : $module->name);
345 if (method_exists($module,
'info'))
346 print $module->info($langs);
347 else print $module->description;
351 if (in_array($name, $def)) {
352 print
'<td class="center">'.
"\n";
353 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.$name.
'">';
354 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
358 print
'<td class="center">'.
"\n";
359 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=set&value='.$name.
'&token='.
newToken().
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
364 print
'<td class="center">';
365 if ($conf->global->BANKADDON_PDF == $name) {
366 print
img_picto($langs->trans(
"Default"),
'on');
368 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
373 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
374 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
375 if ($module->type ==
'pdf') {
376 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
378 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
379 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
382 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
387 print
'<td class="center">';
388 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
392 print
'<td class="center">';
393 if ($module->type ==
'pdf') {
394 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
396 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
415 print
'<table class="noborder centpercent">';
416 print
"<tr class=\"liste_titre\">\n";
417 print
'<td colspan="4">'.$langs->trans(
"Name").
'</td>';
418 print
'<td align="center" width="100">'.$langs->trans(
"Value").
'</td>'.
"\n";
421 print
'<tr class="oddeven"><td colspan="4" width="100">';
422 print $langs->trans(
'BankColorizeMovementDesc');
425 if ($conf->global->BANK_COLORIZE_MOVEMENT) {
426 print
'<td class="center">'.
"\n";
427 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetbankcolorizemovement&token='.
newToken().
'">';
428 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
432 print
'<td class="center">'.
"\n";
433 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setbankcolorizemovement&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
439 if (!empty($conf->global->BANK_COLORIZE_MOVEMENT))
445 $color =
'BANK_COLORIZE_MOVEMENT_COLOR'.$key;
447 print
'<tr class="oddeven">';
450 print
'<td colspan="4" width="180" class="nowrap">'.$langs->trans(
"BankColorizeMovementName".$key).
"</td>";
452 print
'<td class="nowrap right">';
453 print $formother->selectColor((
GETPOST(
"BANK_COLORIZE_MOVEMENT_COLOR".$key) ?
GETPOST(
"BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color),
"BANK_COLORIZE_MOVEMENT_COLOR".$key,
'bankmovementcolorconfig', 1,
'',
'right hideifnotset');
471 print
"<table class=\"noborder\" width=\"100%\">\n";
472 print
"<tr class=\"liste_titre\">\n";
473 print
'<td>'.$langs->trans(
"Name").
'</td>';
474 print
'<td>'.$langs->trans(
"Description").
'</td>';
475 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
478 print
'<tr class="oddeven"><td width="100">';
479 print $langs->trans(
'AccountStatement');
481 print $langs->trans(
'AutoReportLastAccountStatement');
484 if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
485 print
'<td class="center">'.
"\n";
486 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetreportlastnumreleve&token='.
newToken().
'">';
487 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
491 print
'<td class="center">'.
"\n";
492 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setreportlastnumreleve">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
500 print
'<div class="center">';
501 print
'<input type="submit" id="save" name="save" class="button hideifnotset button-save" value="'.$langs->trans(
"Save").
'">';
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.
delDocumentModel($name, $type)
Delete document model used by doc generator.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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).
addDocumentModel($name, $type, $label= '', $description= '')
Add document model used by doc generator.
Class to manage bank accounts description of third parties.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Class to manage bank accounts.
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.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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 ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.