diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 32cd68f99cf..771ef7741c4 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -36,6 +36,7 @@ if (!$user->rights->facture->lire) $langs->load("bills"); $langs->load("banks"); +$langs->load("withdrawals"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); @@ -53,15 +54,19 @@ if ($user->societe_id > 0) if ($_GET["action"] == "new") { - $fact = new Facture($db); - if ($fact->fetch($_GET["facid"])) - { - $result = $fact->demande_prelevement($user); - if ($result == 0) - { - Header("Location: prelevement.php?facid=".$fact->id); - } - } + $fact = new Facture($db); + if ($fact->fetch($_GET["facid"])) + { + $result = $fact->demande_prelevement($user); + if ($result > 0) + { + Header("Location: prelevement.php?facid=".$fact->id); + } + else + { + $mesg='
'.$fact->error.'
'; + } + } } if ($_GET["action"] == "delete") @@ -94,6 +99,9 @@ if ($_GET["facid"] > 0) $fac = New Facture($db); if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) { + + if ($mesg) print $mesg.'
'; + $soc = new Societe($db, $fac->socidp); $soc->fetch($fac->socidp); $author = new User($db); @@ -176,7 +184,7 @@ if ($_GET["facid"] > 0) $sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande"; $sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite"; $sql .= " , pfd.amount"; - $sql .= " , u.name, u.firstname"; + $sql .= " , u.rowid as user_id, u.name, u.firstname, u.code"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE fk_facture = ".$fac->id; @@ -203,16 +211,17 @@ if ($_GET["facid"] > 0) } print "
"; + /* - * Prélèvement - */ + * Prélèvement + */ print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; $var=True; @@ -227,11 +236,12 @@ if ($_GET["facid"] > 0) $var=!$var; print ""; - print '\n"; + print '\n"; print ''; print ''; print ''; - print ''; + print ''; + print ''; print '"; - print '\n"; + print '\n"; + + print '\n"; - print '\n"; print ''; + print '\n"; - print ''; + print ''; - print ''; + print ''; + print ''; print "\n"; $i++;
Date demandeDate traitement'.$langs->trans("DateRequest").''.$langs->trans("DateProcess").''.$langs->trans("Amount").'Bon prélèvement'.$langs->trans("WithdrawalReceipt").''.$langs->trans("User").'  
'.strftime("%d/%m/%Y",$obj->date_demande)."'.dolibarr_print_date($obj->date_demande)."En attente de traitement'.price($obj->amount).'-'.$obj->firstname." ".$obj->name.''.img_object($langs->trans("ShowUser"),'user').' '.$obj->code.' '; print ''; print img_delete(); @@ -250,7 +260,7 @@ if ($_GET["facid"] > 0) $sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande"; $sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite"; $sql .= " , pfd.fk_prelevement_bons, pfd.amount"; - $sql .= " , u.name, u.firstname"; + $sql .= " , u.rowid as user_id, u.name, u.firstname, u.code"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE fk_facture = ".$fac->id; @@ -271,17 +281,20 @@ if ($_GET["facid"] > 0) print "
'.strftime("%d/%m/%Y",$obj->date_demande)."'.dolibarr_print_date($obj->date_demande)."'.dolibarr_print_date($obj->date_traite)."'.strftime("%d/%m/%Y",$obj->date_traite)."'.price($obj->amount).''; print ''.$obj->fk_prelevement_bons."'.$obj->firstname." ".$obj->name.''.img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'-