$result = restrictedArea($user, 'prelevement', '', '', 'bons'); // Get supervariables $action = GETPOST('action', 'alpha'); /* * Actions */ // Change customer bank information to withdraw if ($action == 'modify') { for ($i = 1; $i < 9; $i++) { dolibarr_set_const($db, GETPOST("nom{$i}"), GETPOST("value{$i}"), 'chaine', 0, '', $conf->entity); } } if ($action == 'create') { // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $bprev = new BonPrelevement($db); $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET); if ($result < 0) { $mesg = '<div class="error">' . $bprev->error . '</div>'; } if ($result == 0) { $mesg = '<div class="error">' . $langs->trans("NoInvoiceCouldBeWithdrawed") . '</div>'; foreach ($bprev->invoice_in_error as $key => $val) { $mesg .= $val . "<br>\n"; } } } /* * View */ $thirdpartystatic = new Societe($db); $invoicestatic = new Facture($db);
} require_once $path . "../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT . "/compta/prelevement/class/bonprelevement.class.php"; require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; require_once DOL_DOCUMENT_ROOT . "/compta/paiement/class/paiement.class.php"; // Global variables $version = DOL_VERSION; $error = 0; /* * Main */ @set_time_limit(0); print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; dol_syslog($script_file . " launched with arg " . join(',', $argv)); $datetimeprev = dol_now(); $month = strftime("%m", $datetimeprev); $year = strftime("%Y", $datetimeprev); $user = new user($db); $user->fetch($conf->global->PRELEVEMENT_USER); if (!isset($argv[1])) { // Check parameters print "This script check invoices with a withdrawal request and\n"; print "then create payment and build a withdraw file.\n"; print "Usage: " . $script_file . " simu|real\n"; exit(-1); } $withdrawreceipt = new BonPrelevement($db); $result = $withdrawreceipt->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $argv[1]); $db->close(); exit(0);