--- /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/github_19.0.3_card.php +++ /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/client_card.php @@ -2,4 +2,2 @@ -/* Copyright (C) 2017-2021 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France - * Copyright (C) 2023 Laurent Destailleur - * Copyright (C) 2023 Joachim Kueter +/* Copyright (C) 2017-2019 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France @@ -27 +24,0 @@ -// Load Dolibarr environment @@ -36 +33,2 @@ -if (isModEnabled('project')) { +if (!empty($conf->projet->enabled)) +{ @@ -46,3 +44,2 @@ -$action = GETPOST('action', 'alpha'); -$confirm = GETPOST('confirm'); -$cancel = GETPOST('cancel', 'aZ09'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); @@ -55 +52 @@ -$paymenttype = GETPOST("paymenttype", "aZ09"); +$paymenttype = GETPOST("paymenttype", "int"); @@ -56,0 +54 @@ +$subledger_account = GETPOST("subledger_account", "alpha"); @@ -58,5 +55,0 @@ -if (isModEnabled('accounting') && getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { - $subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : ''; -} else { - $subledger_account = GETPOST("subledger_account", "alpha"); -} @@ -66,3 +59 @@ -if ($user->socid) { - $socid = $user->socid; -} +if ($user->socid) $socid = $user->socid; @@ -75,2 +65,0 @@ - -$permissiontoadd = $user->hasRight('banque', 'modifier'); @@ -85,7 +74,15 @@ -if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -} - -if (empty($reshook)) { - if ($cancel) { - if ($action != 'addlink' && $action != 'setaccountancy_code' && $action != 'setsubledger_account') { +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Link to a project + if ($action == 'classin' && $user->rights->banque->modifier) + { + $object->fetch($id); + $object->setProject(GETPOST('projectid')); + } + + if ($cancel) + { + if ($action != 'addlink') + { @@ -96,3 +93 @@ - if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref); - } + if ($id > 0 || !empty($ref)) $ret = $object->fetch($id, $ref); @@ -102,7 +97,2 @@ - // Link to a project - if ($action == 'classin' && $permissiontoadd) { - $object->fetch($id); - $object->setProject(GETPOST('projectid', 'int')); - } - - if ($action == 'add') { + if ($action == 'add') + { @@ -113,3 +103 @@ - if (empty($datev)) { - $datev = $datep; - } + if (empty($datev)) $datev = $datep; @@ -122,3 +110,3 @@ - $object->label = GETPOST("label", 'restricthtml'); - $object->note = GETPOST("note", 'restricthtml'); - $object->type_payment = dol_getIdFromCode($db, GETPOST('paymenttype'), 'c_paiement', 'code', 'id', 1); + $object->label = GETPOST("label", 'none'); + $object->note = GETPOST("note", 'none'); + $object->type_payment = GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; @@ -126,2 +113,0 @@ - $object->chqemetteur = GETPOST("chqemetteur", 'alpha'); - $object->chqbank = GETPOST("chqbank", 'alpha'); @@ -132,6 +118,7 @@ - $object->subledger_account = $subledger_account; - - $object->sens = GETPOSTINT('sens'); - $object->fk_project = GETPOSTINT('fk_project'); - - if (empty($datep) || empty($datev)) { + $object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; + + $object->sens = GETPOST('sens'); + $object->fk_project = GETPOST('fk_project', 'int'); + + if (empty($datep) || empty($datev)) + { @@ -142 +129,8 @@ - if (empty($object->amount)) { + if (empty($object->type_payment) || $object->type_payment < 0) + { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); + $error++; + } + if (empty($object->amount)) + { @@ -147 +141,2 @@ - if (isModEnabled("banque") && !$object->accountid > 0) { + if (!empty($conf->banque->enabled) && !$object->accountid > 0) + { @@ -152,6 +147,3 @@ - if (empty($object->type_payment) || $object->type_payment < 0) { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); - $error++; - } - if (isModEnabled('accounting') && !$object->accountancy_code) { + // TODO Remove this and allow instead to edit a various payment to enter accounting code + if (!empty($conf->accounting->enabled) && !$object->accountancy_code) + { @@ -162,7 +154,3 @@ - if ($object->sens < 0) { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Sens")), null, 'errors'); - $error++; - } - - if (!$error) { + + if (!$error) + { @@ -172 +160,2 @@ - if ($ret > 0) { + if ($ret > 0) + { @@ -177 +166,3 @@ - } else { + } + else + { @@ -187 +178,2 @@ - if ($action == 'confirm_delete' && $confirm == 'yes') { + if ($action == 'delete') + { @@ -190 +182,2 @@ - if ($object->rappro == 0) { + if ($object->rappro == 0) + { @@ -194,2 +187,4 @@ - if ($ret > 0) { - if ($object->fk_bank) { + if ($ret > 0) + { + if ($object->fk_bank) + { @@ -198,3 +193 @@ - if ($result > 0) { - $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) - } + if ($result > 0) $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) @@ -203 +196,2 @@ - if ($result >= 0) { + if ($result >= 0) + { @@ -207 +201,3 @@ - } else { + } + else + { @@ -212 +208,3 @@ - } else { + } + else + { @@ -216 +214,3 @@ - } else { + } + else + { @@ -221,3 +221 @@ - if ($action == 'setaccountancy_code') { - $db->begin(); - + if ($action == 'setsubledger_account') { @@ -226 +224 @@ - $object->accountancy_code = GETPOST('accountancy_code', 'alphanohtml'); + $object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""); @@ -236,86 +233,0 @@ - - if ($action == 'setsubledger_account') { - $db->begin(); - - $result = $object->fetch($id); - - $object->subledger_account = $subledger_account; - - $res = $object->update($user); - if ($res > 0) { - $db->commit(); - } else { - $db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - } - } -} - -// Action clone object -if ($action == 'confirm_clone' && $confirm != 'yes') { - $action = ''; -} - -if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { - $db->begin(); - - $originalId = $id; - - $object->fetch($id); - - if ($object->id > 0) { - $object->id = $object->ref = null; - - if (GETPOST('clone_label', 'alphanohtml')) { - $object->label = GETPOST('clone_label', 'alphanohtml'); - } else { - $object->label = $langs->trans("CopyOf").' '.$object->label; - } - - $newdatepayment = dol_mktime(0, 0, 0, GETPOST('clone_date_paymentmonth', 'int'), GETPOST('clone_date_paymentday', 'int'), GETPOST('clone_date_paymentyear', 'int')); - $newdatevalue = dol_mktime(0, 0, 0, GETPOST('clone_date_valuemonth', 'int'), GETPOST('clone_date_valueday', 'int'), GETPOST('clone_date_valueyear', 'int')); - if ($newdatepayment) { - $object->datep = $newdatepayment; - } - if (!empty($newdatevalue)) { - $object->datev = $newdatevalue; - } else { - $object->datev = $newdatepayment; - } - - if (GETPOSTISSET("clone_sens")) { - $object->sens = GETPOST("clone_sens", 'int'); - } else { - $object->sens = $object->sens; - } - - if (GETPOST("clone_amount", "alpha")) { - $object->amount = price2num(GETPOST("clone_amount", "alpha")); - } else { - $object->amount = price2num($object->amount); - } - - if ($object->check()) { - $id = $object->create($user); - if ($id > 0) { - $db->commit(); - $db->close(); - - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } else { - $id = $originalId; - $db->rollback(); - - setEventMessages($object->error, $object->errors, 'errors'); - } - } else { - $id = $originalId; - $db->rollback(); - - setEventMessages($object->error, $object->errors, 'errors'); - } - } else { - $db->rollback(); - dol_print_error($db, $object->error); - } @@ -327,0 +240,3 @@ + +llxHeader("", $langs->trans("VariousPayment")); + @@ -329,8 +244,5 @@ -if (isModEnabled('accounting')) { - $formaccounting = new FormAccounting($db); -} -if (isModEnabled('project')) { - $formproject = new FormProjets($db); -} - -if ($id) { +if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); +if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); + +if ($id) +{ @@ -339 +251,2 @@ - if ($result <= 0) { + if ($result <= 0) + { @@ -344,7 +256,0 @@ - -$title = $object->ref." - ".$langs->trans('Card'); -if ($action == 'create') { - $title = $langs->trans("NewVariousPayment"); -} -$help_url = 'EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores|DE:Modul_Lieferantenrechnungen'; -llxHeader('', $title, $help_url); @@ -359 +265 @@ - $options[$bankcategory->id] = $bankcategory->label; + $options[$bankcategory->id] = $bankcategory->label; @@ -362,39 +268,7 @@ -// Create mode -if ($action == 'create') { - // Update fields properties in realtime - if (!empty($conf->use_javascript_ajax)) { - print "\n".''."\n"; - } - +/* ************************************************************************** */ +/* */ +/* Create mode */ +/* */ +/* ************************************************************************** */ +if ($action == 'create') +{ @@ -408 +282 @@ - print dol_get_fiche_head('', ''); + dol_fiche_head('', ''); @@ -415 +289 @@ - print $form->selectDate((empty($datep) ? -1 : $datep), "datep", '', '', '', 'add', 1, 1); + print $form->selectDate((empty($datep) ?-1 : $datep), "datep", '', '', '', 'add', 1, 1); @@ -421 +295 @@ - print $form->selectDate((empty($datev) ? -1 : $datev), "datev", '', '', '', 'add', 1, 1); + print $form->selectDate((empty($datev) ?-1 : $datev), "datev", '', '', '', 'add', 1, 1); @@ -429,0 +304,7 @@ + // Sens + print ''; + print $form->editfieldkey('Sens', 'sens', '', $object, 0, 'string', '', 1).''; + $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); + print $form->selectarray('sens', $sensarray, $sens); + print ''; + @@ -433 +314 @@ - print ''; + print ''; @@ -437 +318,2 @@ - if (isModEnabled("banque")) { + if (!empty($conf->banque->enabled)) + { @@ -440,2 +322 @@ - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Show list of main accounts (comptes courants) + $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant @@ -446,4 +327,4 @@ - print ''.$langs->trans('PaymentMode').''; - $form->select_types_paiements($paymenttype, 'paymenttype', '', 2); - print "\n"; - print ''; + print ''; + print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; + $form->select_types_paiements($paymenttype, "paymenttype"); + print ''; @@ -452 +333,3 @@ - if (isModEnabled("banque")) { + if (!empty($conf->banque->enabled)) + { + // Number @@ -457,13 +340,29 @@ - - // Check transmitter - print ''; - print ''; - - // Bank name - print ''; - print ''; - } + } + + // Project + if (!empty($conf->projet->enabled)) + { + $formproject = new FormProjets($db); + + // Associated project + $langs->load("projects"); + + print ''.$langs->trans("Project").''; + + $numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); + + print ''; + } + + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Category + if (is_array($options) && count($options) && $conf->categorie->enabled) + { + print ''.$langs->trans("RubriquesTransactions").''; + print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1); + print ''; + } @@ -472 +371,2 @@ - if (isModEnabled('accounting')) { + if (!empty($conf->accounting->enabled)) + { @@ -475 +375 @@ - print ''; + print ''; @@ -477,2 +377,4 @@ - print ''; - } else { // For external software + print ''; + } + else // For external software + { @@ -484,48 +386,21 @@ - // Subledger account - if (isModEnabled('accounting')) { - print ''.$langs->trans("SubledgerAccount").''; - print ''; - if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { - print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); - } else { - print ''; - } - print ''; - } else { // For external software - print ''.$langs->trans("SubledgerAccount").''; - print ''; - print ''; - } - - // Sens - print ''; - $labelsens = $form->textwithpicto($langs->trans('Sens'), $langs->trans("AccountingDirectionHelp")); - print $form->editfieldkey($labelsens, 'sens', '', $object, 0, 'string', '', 1).''; - $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); - print $form->selectarray('sens', $sensarray, $sens, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); - print ''; - - // Project - if (isModEnabled('project')) { - $formproject = new FormProjets($db); - - // Associated project - $langs->load("projects"); - - print ''.$langs->trans("Project").''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1); - print ''; - } - - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Category - if (is_array($options) && count($options) && $conf->categorie->enabled) { - print ''.$langs->trans("RubriquesTransactions").''; - print img_picto('', 'category').Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth300', 1); - print ''; - } + // Subledger account + if (!empty($conf->accounting->enabled)) + { + print ''.$langs->trans("SubledgerAccount").''; + print ''; + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) + { + print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); + } + else + { + print ''; + } + print ''; + } + else // For external software + { + print ''.$langs->trans("SubledgerAccount").''; + print ''; + print ''; + } @@ -535,3 +410,7 @@ - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel(); + dol_fiche_end(); + + print '
'; + print ''; + print '   '; + print ''; + print '
'; @@ -549 +428,2 @@ -if ($id) { +if ($id) +{ @@ -554,24 +434 @@ - // Clone confirmation - if ($action === 'clone') { - $set_value_help = $form->textwithpicto('', $langs->trans($langs->trans("AccountingDirectionHelp"))); - $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); - - $formquestion = array( - array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label), - array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1), - array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1), - array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)), - array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)), - array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => $object->sens), - ); - - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); - } - - // Confirmation of the removal of the Various Payment - if ($action == 'delete') { - $text = $langs->trans('ConfirmDeleteVariousPayment'); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); - } - - print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); + dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); @@ -581 +438,2 @@ - if (isModEnabled('project')) { + if (!empty($conf->projet->enabled)) + { @@ -583,3 +441,3 @@ - //$morehtmlref .= '
'; - if ($permissiontoadd) { - $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + $morehtmlref .= $langs->trans('Project').' '; + if ($user->rights->banque->modifier) + { @@ -587 +445 @@ - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; @@ -594 +452 @@ - $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + $morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); @@ -598 +456 @@ - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (property_exists($object, 'socid') ? $object->socid : 0), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); @@ -605,7 +463,5 @@ - if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; - } - } - } - } - + } else { + $morehtmlref .= ''; + } + } + } @@ -614,2 +469,0 @@ - - $morehtmlright = ''; @@ -639,2 +493,15 @@ - if ($object->sens == '1') { - $sens = $langs->trans("Credit"); + if ($object->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit"); + print ''.$langs->trans("Sens").''.$sens.''; + + print ''.$langs->trans("Amount").''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; + + // Accountancy code + print ''; + print $langs->trans("AccountAccounting"); + print ''; + if (!empty($conf->accounting->enabled)) + { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('', $object->accountancy_code, 1); + + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); @@ -642,25 +508,0 @@ - $sens = $langs->trans("Debit"); - } - print ''.$langs->trans("Sens").''.$sens.''; - - print ''.$langs->trans("Amount").''.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).''; - - // Account of Chart of account - $editvalue = ''; - if (isModEnabled('accounting')) { - print ''; - print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0); - print ''; - if ($action == 'editaccountancy_code') { - print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0); - } else { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $object->accountancy_code, 1); - - print $accountingaccount->getNomUrl(0, 1, 1, '', 1); - } - print ''; - } else { - print ''; - print $langs->trans("AccountAccounting"); - print ''; @@ -668,17 +510,14 @@ - print ''; - } - - // Subledger account - print ''; - print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0); - print ''; - print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0, null, '', 1, 'lengthAccounta'); - print ''; - - $bankaccountnotfound = 0; - - if (isModEnabled('banque')) { - print ''; - print ''.$langs->trans('BankTransactionLine').''; - print ''; - if ($object->fk_bank > 0) { + } + print ''; + + // Subledger account + print ''; + print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0); + print ''; + print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0); + print ''; + + if (!empty($conf->banque->enabled)) + { + if ($object->fk_account > 0) + { @@ -686,14 +525,9 @@ - $result = $bankline->fetch($object->fk_bank); - - if ($result <= 0) { - $bankaccountnotfound = 1; - } else { - print $bankline->getNomUrl(1, 0, 'showall'); - } - } else { - $bankaccountnotfound = 1; - - print ''.$langs->trans("NoRecordfound").''; - } - print ''; - print ''; + $bankline->fetch($object->fk_bank); + + print ''; + print ''.$langs->trans('BankTransactionLine').''; + print ''; + print $bankline->getNomUrl(1, 0, 'showall'); + print ''; + print ''; + } @@ -712 +546 @@ - print dol_get_fiche_end(); + dol_fiche_end(); @@ -716 +550 @@ - * Action bar + * Action buttons @@ -723,5 +556,0 @@ - // Clone - if ($permissiontoadd) { - print '"; - } - @@ -729,2 +558,4 @@ - if (empty($object->rappro) || $bankaccountnotfound) { - if ($permissiontoadd) { + if (empty($object->rappro)) + { + if (!empty($user->rights->banque->modifier)) + { @@ -734,3 +565,5 @@ - print ''; - } - } else { + print ''; + } + } + else + { @@ -739 +572,3 @@ - } else { + } + else + { --- /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/github_19.0.3_document.php +++ /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/client_document.php @@ -25 +24,0 @@ -// Load Dolibarr environment @@ -38 +37 @@ -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); @@ -43,3 +42 @@ -if ($user->socid) { - $socid = $user->socid; -} +if ($user->socid) $socid = $user->socid; @@ -50,2 +47,2 @@ -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); @@ -53,3 +50 @@ -if (empty($page) || $page == -1) { - $page = 0; -} // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 @@ -59,6 +54,2 @@ -if (!$sortorder) { - $sortorder = "ASC"; -} -if (!$sortfield) { - $sortfield = "name"; -} +if (!$sortorder) $sortorder = "ASC"; +if (!$sortfield) $sortfield = "name"; @@ -73,3 +63,0 @@ -$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php - - @@ -81 +69 @@ -include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; +include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; @@ -94 +82,2 @@ -if ($object->id) { +if ($object->id) +{ @@ -97 +86 @@ - print dol_get_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto); + dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto); @@ -101 +90,2 @@ - if (isModEnabled('project')) { + if (!empty($conf->projet->enabled)) + { @@ -103 +93,3 @@ - if ($user->hasRight('banque', 'modifier') && 0) { + $morehtmlref .= $langs->trans('Project').' : '; + if ($user->rights->banque->modifier && 0) + { @@ -105 +97 @@ - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; @@ -116 +108 @@ - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); @@ -137 +129 @@ - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); @@ -139 +131,2 @@ - foreach ($filearray as $key => $file) { + foreach ($filearray as $key => $file) + { @@ -153 +146 @@ - print dol_get_fiche_end(); + dol_fiche_end(); @@ -156 +149 @@ - $permissiontoadd = $user->rights->banque->modifier; + $permission = $user->rights->banque->modifier; @@ -158,2 +151,4 @@ - include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} else { + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; +} +else +{ --- /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/github_19.0.3_info.php +++ /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/client_info.php @@ -24 +23,0 @@ -// Load Dolibarr environment @@ -39,3 +38 @@ -if ($user->socid) { - $socid = $user->socid; -} +if ($user->socid) $socid = $user->socid; @@ -56 +53 @@ -print dol_get_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto); +dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto); @@ -61 +58,2 @@ -if (isModEnabled('project')) { +if (!empty($conf->projet->enabled)) +{ @@ -63 +61,3 @@ - if ($user->hasRight('banque', 'modifier') && 0) { + $morehtmlref .= $langs->trans('Project').' : '; + if ($user->rights->banque->modifier && 0) + { @@ -65 +65 @@ - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; @@ -76 +76 @@ - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); --- /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/github_19.0.3_list.php +++ /tmp/dsg/dolibarr/htdocs/compta/bank/various_payment/client_list.php @@ -2 +2 @@ -/* Copyright (C) 2017-2023 Alexandre Spangaro +/* Copyright (C) 2017-2019 Alexandre Spangaro @@ -5 +4,0 @@ - * Copyright (C) 2020 Tobias Sekan @@ -27 +25,0 @@ -// Load Dolibarr environment @@ -32 +29,0 @@ -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; @@ -35 +31,0 @@ -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -39,0 +36,5 @@ +// Security check +$socid = GETPOST("socid", "int"); +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'banque', '', '', ''); + @@ -41,6 +42,2 @@ -$mode = GETPOST('mode', 'alpha'); -$massaction = GETPOST('massaction', 'aZ09'); -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search - -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; + +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -50,4 +47,2 @@ -$search_datep_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_datep_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_datev_start = dol_mktime(0, 0, 0, GETPOST('search_date_value_startmonth', 'int'), GETPOST('search_date_value_startday', 'int'), GETPOST('search_date_value_startyear', 'int')); -$search_datev_end = dol_mktime(23, 59, 59, GETPOST('search_date_value_endmonth', 'int'), GETPOST('search_date_value_endday', 'int'), GETPOST('search_date_value_endyear', 'int')); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); @@ -56,2 +51 @@ -$search_bank_account = GETPOST('search_account', 'int'); -$search_bank_entry = GETPOST('search_bank_entry', 'int'); +$search_account = GETPOST('search_account', 'int'); @@ -59,3 +53 @@ -if ($search_accountancy_account == - 1) { - $search_accountancy_account = ''; -} +if ($search_accountancy_account == - 1) $search_accountancy_account = ''; @@ -63,19 +55,4 @@ -if ($search_accountancy_subledger == - 1) { - $search_accountancy_subledger = ''; -} -if (empty($search_datep_start)) { - $search_datep_start = GETPOST("search_datep_start", 'int'); -} -if (empty($search_datep_end)) { - $search_datep_end = GETPOST("search_datep_end", 'int'); -} -if (empty($search_datev_start)) { - $search_datev_start = GETPOST("search_datev_start", 'int'); -} -if (empty($search_datev_end)) { - $search_datev_end = GETPOST("search_datev_end", 'int'); -} -$search_type_id = GETPOST('search_type_id', 'int'); - -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); +if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = ''; + +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); @@ -83,4 +60 @@ -if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { - // If $page is not defined, or '' or -1 or if we click on clear filters - $page = 0; -} +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 @@ -90,19 +64,2 @@ - -// Initialize technical objects -$object = new PaymentVarious($db); -$extrafields = new ExtraFields($db); -//$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes - -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); - -// Default sort order (if not yet defined by previous GETPOST) -if (!$sortfield) { - $sortfield = "v.datep,v.rowid"; -} -if (!$sortorder) { - $sortorder = "DESC,DESC"; -} +if (!$sortfield) $sortfield = "v.datep,v.rowid"; +if (!$sortorder) $sortorder = "DESC"; @@ -112,11 +69,24 @@ -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers - $search_ref = ''; - $search_label = ''; - $search_datep_start = ''; - $search_datep_end = ''; - $search_datev_start = ''; - $search_datev_end = ''; - $search_amount_deb = ''; - $search_amount_cred = ''; - $search_bank_account = ''; - $search_bank_entry = ''; +if (!GETPOST('typeid')) +{ + $newfiltre = str_replace('filtre=', '', $filtre); + $filterarray = explode('-', $newfiltre); + foreach ($filterarray as $val) + { + $part = explode(':', $val); + if ($part[0] == 'v.fk_typepayment') $typeid = $part[1]; + } +} +else +{ + $typeid = GETPOST('typeid'); +} + +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers +{ + $search_ref = ""; + $search_label = ""; + $search_date_start = ''; + $search_date_end = ''; + $search_amount_deb = ""; + $search_amount_cred = ""; + $search_account = ''; @@ -125,100 +95,3 @@ - $search_type_id = ''; -} - -$search_all = GETPOSTISSET("search_all") ? trim(GETPOST("search_all", 'alpha')) : trim(GETPOST('sall')); - -/* -* TODO: fill array "$fields" in "/compta/bank/class/paymentvarious.class.php" and use -* -* -* $object = new PaymentVarious($db); -* -* $search = array(); -* foreach ($object->fields as $key => $val) -* { -* if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); -* } - -* $fieldstosearchall = array(); -* foreach ($object->fields as $key => $val) -* { -* if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; -* } -* -*/ - -// List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'v.rowid'=>"Ref", - 'v.label'=>"Label", - 'v.datep'=>"DatePayment", - 'v.datev'=>"DateValue", - 'v.amount'=>$langs->trans("Debit").", ".$langs->trans("Credit"), -); - -// Definition of fields for lists -$arrayfields = array( - 'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100), - 'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110), - 'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120), - 'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130), - 'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140), - 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>isModEnabled('project')), - 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("banque")), - 'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>isModEnabled("banque")), - 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>isModEnabled('accounting')), - 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>isModEnabled('accounting')), - 'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500), - 'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510), -); - -$arrayfields = dol_sort_array($arrayfields, 'position'); - -// Security check -$socid = GETPOST("socid", "int"); -if ($user->socid) { - $socid = $user->socid; -} - -$result = restrictedArea($user, 'banque', '', '', ''); - - -/* - * Actions - */ - -if (GETPOST('cancel', 'alpha')) { - $action = 'list'; - $massaction = ''; -} -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { - $massaction = ''; -} - -$parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -} - -if (empty($reshook)) { - // Selection of new fields - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - - // Purge search criteria - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - foreach ($object->fields as $key => $val) { - $search[$key] = ''; - if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - $search[$key.'_dtstart'] = ''; - $search[$key.'_dtend'] = ''; - } - } - $toselect = array(); - $search_array_options = array(); - } - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') - || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { - $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation - } -} + $typeid = ""; +} + @@ -229,0 +103,2 @@ +llxHeader(); + @@ -231,30 +106,5 @@ -if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { - $formaccounting = new FormAccounting($db); -} -if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) { - $accountingjournal = new AccountingJournal($db); -} -if ($arrayfields['ref']['checked']) { - $variousstatic = new PaymentVarious($db); -} -if ($arrayfields['bank']['checked']) { - $accountstatic = new Account($db); -} -if ($arrayfields['project']['checked']) { - $proj = new Project($db); -} -if ($arrayfields['entry']['checked']) { - $bankline = new AccountLine($db); -} -if ($arrayfields['account']['checked']) { - $accountingaccount = new AccountingAccount($db); -} - -$title = $langs->trans("VariousPayments"); -//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; -$help_url = ''; - - -// Build and execute select -// -------------------------------------------------------------------- -$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account, v.fk_projet as fk_project,"; +$formaccounting = new FormAccounting($db); +$variousstatic = new PaymentVarious($db); +$accountstatic = new Account($db); + +$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,"; @@ -263,3 +112,0 @@ - -$sqlfields = $sql; // $sql fields to remove for count total - @@ -273,72 +120,15 @@ -if ($search_ref) { - $sql .= " AND v.rowid = ".((int) $search_ref); -} -if ($search_label) { - $sql .= natural_search(array('v.label'), $search_label); -} -if ($search_datep_start) { - $sql .= " AND v.datep >= '".$db->idate($search_datep_start)."'"; -} -if ($search_datep_end) { - $sql .= " AND v.datep <= '".$db->idate($search_datep_end)."'"; -} -if ($search_datev_start) { - $sql .= " AND v.datev >= '".$db->idate($search_datev_start)."'"; -} -if ($search_datev_end) { - $sql .= " AND v.datev <= '".$db->idate($search_datev_end)."'"; -} -if ($search_amount_deb) { - $sql .= natural_search("v.amount", $search_amount_deb, 1); -} -if ($search_amount_cred) { - $sql .= natural_search("v.amount", $search_amount_cred, 1); -} -if ($search_bank_account > 0) { - $sql .= " AND b.fk_account = ".((int) $search_bank_account); -} -if ($search_bank_entry > 0) { - $sql .= " AND b.fk_account = ".((int) $search_bank_account); -} -if ($search_accountancy_account > 0) { - $sql .= " AND v.accountancy_code = ".((int) $search_accountancy_account); -} -if ($search_accountancy_subledger > 0) { - $sql .= " AND v.subledger_account = ".((int) $search_accountancy_subledger); -} -if ($search_type_id > 0) { - $sql .= " AND v.fk_typepayment=".((int) $search_type_id); -} -if ($search_all) { - $sql .= natural_search(array_keys($fieldstosearchall), $search_all); -} -//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear); -// Add where from extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; -// Add where from hooks -$parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; - -// Count total nb of records -$nbtotalofrecords = ''; -if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { - /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); - $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); - $resql = $db->query($sqlforcount); - if ($resql) { - $objforcount = $db->fetch_object($resql); - $nbtotalofrecords = $objforcount->nbtotalofrecords; - } else { - dol_print_error($db); - } - - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 - $page = 0; - $offset = 0; - } - $db->free($resql); -} - -// Complete request and execute it with limit +if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref); +if ($search_label) $sql .= natural_search(array('v.label'), $search_label); +if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'"; +if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'"; +if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1); +if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account); +if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account); +if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger); +if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; +if ($filtre) { + $filtre = str_replace(":", "=", $filtre); + $sql .= " AND ".$filtre; +} + @@ -346,148 +136,55 @@ -if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); -} - -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit; -} - -$num = $db->num_rows($resql); - -// Direct jump if only one record found -if ($num == 1 && !getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { - $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id); - exit; -} - -// Output page -// -------------------------------------------------------------------- - -llxHeader('', $title, $help_url); - -$arrayofselected = is_array($toselect) ? $toselect : array(); - -$param = ''; -if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); -} -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); -} -if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.((int) $limit); -} -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} -if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); -} -if ($search_label) { - $param .= '&search_label='.urlencode($search_label); -} -if ($search_datep_start) { - $param .= '&search_datep_start='.urlencode($search_datep_start); -} -if ($search_datep_end) { - $param .= '&search_datep_end='.urlencode($search_datep_end); -} -if ($search_datev_start) { - $param .= '&search_datev_start='.urlencode($search_datev_start); -} -if ($search_datev_end) { - $param .= '&search_datev_end='.urlencode($search_datev_end); -} -if ($search_type_id > 0) { - $param .= '&search_type_id='.urlencode($search_type_id); -} -if ($search_amount_deb) { - $param .= '&search_amount_deb='.urlencode($search_amount_deb); -} -if ($search_amount_cred) { - $param .= '&search_amount_cred='.urlencode($search_amount_cred); -} -if ($search_bank_account > 0) { - $param .= '&search_account='.urlencode($search_bank_account); -} -if ($search_accountancy_account > 0) { - $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); -} -if ($search_accountancy_subledger > 0) { - $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); -} - -$url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; -if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); -} - -// List of mass actions available -$arrayofmassactions = array(); -$massactionbutton = $form->selectMassAction('', $arrayofmassactions); - -print '
'."\n"; -if ($optioncss != '') { - print ''; -} -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('banque', 'modifier')); - -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); - -if ($search_all) { - $setupstring = ''; - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); - $setupstring .= $key."=".$val.";"; - } - print ''."\n"; - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; -} - -$arrayofmassactions = array(); - -$moreforfilter= ''; - -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields -$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - - -print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''."\n"; - -// Fields title search -// -------------------------------------------------------------------- -print ''; -// Action column -if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; -} - -if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) { - print ''; -} - -// Ref -if ($arrayfields['ref']['checked']) { + +$totalnboflines = 0; +$result = $db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} +$sql .= $db->plimit($limit + 1, $offset); + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + $total = 0; + + $param = ''; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_label) $param .= '&search_label='.urlencode($search_label); + if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); + if ($typeid > 0) $param .= '&typeid='.urlencode($typeid); + if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb); + if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred); + if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account); + if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); + if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); + + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + + $newcardbutton = ''; + if ($user->rights->banque->modifier) + { + $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'); + } + + print ''; + + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); + + print '
'; + print '
'; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; - print '
'."\n"; + + print ''; + + // Ref @@ -497,11 +194,5 @@ -} - -// Label -if ($arrayfields['label']['checked']) { - print ''; -} - -// Payment date -if ($arrayfields['datep']['checked']) { + + // Label + print ''; + + // Date @@ -509,2 +200,3 @@ - print '
'; - print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print $langs->trans('From').' '; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1); @@ -512,2 +204,4 @@ - print '
'; - print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print $langs->trans('to').' '; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1); + @@ -516,11 +210,4 @@ -} - -// Value date -if ($arrayfields['datev']['checked']) { - print '
'; -} - -// Project -if ($arrayfields['project']['checked']) { - print ''; -} - -// Bank account -if ($arrayfields['bank']['checked']) { - print ''; -} - -// Bank entry -if ($arrayfields['entry']['checked']) { - print ''; -} - -// Accounting account -if (!empty($arrayfields['account']['checked'])) { - print ''; -} - -// Subledger account -if (!empty($arrayfields['subledger']['checked'])) { - print ''; -} - -// Debit -if (!empty($arrayfields['debit']['checked'])) { - print ''; -} - -// Credit -if ($arrayfields['credit']['checked']) { - print ''; -} - -if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + } + + // Accounting account + if (!empty($conf->accounting->enabled)) + { + // Accounting account + print ''; + + // Subledger account + print ''; + } + + // Debit + print ''; + + // Credit + print ''; + + print ''."\n"; - -$totalarray = array(); -$totalarray['nbfield'] = 0; - -// Fields title label -// -------------------------------------------------------------------- -print ''; -// Action column -if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; - $totalarray['nbfield']++; -} -if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) { - print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; -} - -if ($arrayfields['ref']['checked']) { - print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; -} -if ($arrayfields['label']['checked']) { - print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; -} -if ($arrayfields['datep']['checked']) { - print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); - $totalarray['nbfield']++; -} -if ($arrayfields['datev']['checked']) { - print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); - $totalarray['nbfield']++; -} -if ($arrayfields['type']['checked']) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); - $totalarray['nbfield']++; -} -if ($arrayfields['project']['checked']) { - print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; -} -if ($arrayfields['bank']['checked']) { - print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; -} -if ($arrayfields['entry']['checked']) { - print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; -} -if (!empty($arrayfields['account']['checked'])) { - print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left '); - $totalarray['nbfield']++; -} -if (!empty($arrayfields['subledger']['checked'])) { - print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left '); - $totalarray['nbfield']++; -} -if ($arrayfields['debit']['checked']) { - print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; -} -if ($arrayfields['credit']['checked']) { - print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; -} -// Extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; -// Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -// Action column -if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; - $totalarray['nbfield']++; -} -print ''."\n"; - - -// Loop on record -// -------------------------------------------------------------------- -$i = 0; -$savnbfield = $totalarray['nbfield']; -$totalarray = array(); -$totalarray['nbfield'] = 0; -$totalarray['val']['total_cred'] = 0; -$totalarray['val']['total_deb'] = 0; -$imaxinloop = ($limit ? min($num, $limit) : $num); -while ($i < $imaxinloop) { - $obj = $db->fetch_object($resql); - if (empty($obj)) { - break; // Should not happen - } - - $variousstatic->id = $obj->rowid; - $variousstatic->ref = $obj->rowid; - $variousstatic->label = $obj->label; - $variousstatic->datep = $obj->datep; - $variousstatic->type_payment = $obj->payment_code; - $bankline->fetch($obj->fk_bank); - $variousstatic->fk_bank = $bankline->getNomUrl(1); - $variousstatic->amount = $obj->amount; - - $accountingaccount->fetch('', $obj->accountancy_code, 1); - $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); - - if ($mode == 'kanban') { - if ($i == 0) { - print ''; - } - } else { - // Show here line of result - $j = 0; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // No - if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) { - print ''; - } + + print "\n"; + + + print ''; + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); + if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); + if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + print "\n"; + + + $totalarray = array(); + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($result); + + print ''; + + $variousstatic->id = $obj->rowid; + $variousstatic->ref = $obj->rowid; @@ -733,6 +281,2 @@ - if ($arrayfields['ref']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } - } + print "\n"; + if (!$i) $totalarray['nbfield']++; @@ -741,6 +285,2 @@ - if ($arrayfields['label']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } - } + print "\n"; + if (!$i) $totalarray['nbfield']++; @@ -749,15 +289,2 @@ - if ($arrayfields['datep']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - - // Date value - if ($arrayfields['datev']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } - } + print '\n"; + if (!$i) $totalarray['nbfield']++; @@ -766,30 +293,9 @@ - if ($arrayfields['type']['checked']) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project - if ($arrayfields['project']['checked']) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; + if (!$i) $totalarray['nbfield']++; + + // Account + if (!empty($conf->banque->enabled)) + { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } + if (!$i) $totalarray['nbfield']++; @@ -827,11 +323,6 @@ - if (!empty($arrayfields['account']['checked'])) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - $result = $accountingaccount->fetch('', $obj->accountancy_code, 1); - if ($result > 0) { - print ''; - } else { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + if (!empty($conf->accounting->enabled)) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('', $obj->accountancy_code, 1); + + print ''; + if (!$i) $totalarray['nbfield']++; @@ -841,5 +332,4 @@ - if (!empty($arrayfields['subledger']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + if (!empty($conf->accounting->enabled)) + { + print ''; + if (!$i) $totalarray['nbfield']++; @@ -849,14 +339,9 @@ - if ($arrayfields['debit']['checked']) { - print ''; - } + print ''; @@ -865,51 +350,31 @@ - if ($arrayfields['credit']['checked']) { - print ''; - } - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - print ''."\n"; - } - $i++; -} - -// Show total line -include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; - -// If no record found -if ($num == 0) { - $colspan = 1; - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - $colspan++; - } - } - print ''; -} - -$db->free($resql); - -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; - -print '
'; - print ''; - print ''; - print '
'; - print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; + + // Type + print '
'; + $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); @@ -528,65 +215,35 @@ -} - -// Payment type -if ($arrayfields['type']['checked']) { - print ''; - print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100', 1); - print ''; - // TODO - print ''; - $form->select_comptes($search_bank_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100'); - print ''; - print ''; - print ''; - print '
'; - print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); - print '
'; - print '
'; - print '
'; - print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - $searchpicto = $form->showFilterButtons(); + + // Account + if (!empty($conf->banque->enabled)) + { + print ''; + $form->select_comptes($search_account, 'search_account', 0, '', 1); + print ''; + print '
'; + print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); + print '
'; + print '
'; + print '
'; + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); + print '
'; + print '
'; + $searchpicto = $form->showFilterAndCheckAddButtons(0); @@ -595,136 +252,27 @@ -} - -print '
'; - print '
'; - } - // Output Kanban - print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); - if ($i == ($imaxinloop) - 1) { - print '
'; - print '
'.(($offset * $limit) + $i).'
'.$variousstatic->getNomUrl(1)."".$variousstatic->getNomUrl(1)."'.$variousstatic->label."".dol_trunc($obj->label, 40)."'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datev), 'day')."'.dol_print_date($db->jdate($obj->datep), 'day')."'; - if ($obj->payment_code) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ' '; - } - print $obj->num_payment; - print ''; - if ($obj->fk_project > 0) { - $proj->fetch($obj->fk_project); - print $proj->getNomUrl(1); - } - print ''; - if ($obj->bid > 0) { + print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; + if ($obj->bid > 0) + { @@ -800 +306 @@ - if (isModEnabled('accounting')) { + if (!empty($conf->accounting->enabled)) { @@ -801,0 +308,2 @@ + + $accountingjournal = new AccountingJournal($db); @@ -808,2 +315,0 @@ - } else { - print ' '; @@ -810,0 +317 @@ + else print ' '; @@ -812,12 +319 @@ - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Bank entry - if ($arrayfields['entry']['checked']) { - $bankline->fetch($obj->fk_bank); - print ''.$bankline->getNomUrl(1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.length_accounta($obj->subledger_account).''.length_accounta($obj->subledger_account).''; - if ($obj->sens == 0) { - print ''.price($obj->amount).''; - $totalarray['val']['total_deb'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; - } - print ''; + if ($obj->sens == 0) + { + print price($obj->amount); + $totalarray['val']['total_deb'] += $obj->amount; + } + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; + print ''; - if ($obj->sens == 1) { - print ''.price($obj->amount).''; - $totalarray['val']['total_cred'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; - } - print '
'.$langs->trans("NoRecordFound").'
'."\n"; -print '
'."\n"; - -print '
'."\n"; + print ''; + if ($obj->sens == 1) + { + print price($obj->amount); + $totalarray['val']['total_cred'] += $obj->amount; + } + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; + print ''; + print ''; + + if (!$i) $totalarray['nbfield']++; + + print "\n"; + + $i++; + } + + // Show total line + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + + print ""; + print ''; + print ''; + + $db->free($result); +} +else +{ + dol_print_error($db); +}