diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 47de225807ea4d00d150341a616d9ff751bad1b6..0408f580fda6093448d56fad93b8e8676bad13e6 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -788,7 +788,7 @@ class Adherent { $acct=new Account($this->db,$accountid); - $dateop=strftime("%Y%m%d",time()); + $dateop=time(); $insertid=$acct->addline($dateop, $operation, $label, $montant, $num_chq, '', $user); if ($insertid > 0) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index eb54ff62b2eeca3213f67c2d1a8a9c4f5e542575..724d3e9ed4692fac2b6926fb1df56f68ad0ff8e5 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -59,7 +59,7 @@ if ($_POST["action"] == '2bank' && $_POST["rowid"] !='') // \todo Cr�er une facture et enregistrer son paiement - $dateop=strftime("%Y%m%d",time()); + $dateop=time(); $sql="SELECT cotisation FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid=".$_POST["rowid"]." "; $result = $db->query($sql); if ($result) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index b35ad62e0551b32e25d44fda42b3b10233c2edce..97b79199ddac7e06ef2a5ecb8e1b3735824370f2 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -308,7 +308,7 @@ if ($_POST["action"] == 'add') // insertion dans la gestion banquaire si configure pour if ($global->conf->ADHERENT_BANK_USE) { - $dateop=strftime("%Y%m%d",time()); + $dateop=time(); $amount=$cotisation; $acct=new Account($db,$_POST["accountid"]); $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 98838339b7dc6baf7fa57e9cf81b711488a7e817..54cf01106a6eb6c6f7ac4238a2ec55349feae8ab 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Type").'</td>'; print '<td>'.$langs->trans("Note").'</td>'; -print '<td>'.$langs->trans("Action").'</td>'; +print '<td align="center">'.$langs->trans("Action").'</td>'; print "</tr>\n"; @@ -82,21 +82,17 @@ print '<form action="const.php" method="POST">'; print '<input type="hidden" name="action" value="add">'; print "<tr $bc[$var] class=value><td><input type=\"text\" class=\"flat\" size=\"24\" name=\"constname\" value=\"\"></td>\n"; - print '<td>'; -print '<input type="text" class="flat" size="30" name="constvalue" value="">'; +print '<input type="text" class="flat" size="32" name="constvalue" value="">'; print '</td><td>'; - $form->select_array('consttype',array('yesno','texte','chaine'),2); print '</td><td>'; - -print '<input type="text" class="flat" size="15" name="constnote" value="">'; -print '</td><td>'; - +print '<input type="text" class="flat" size="24" name="constnote" value="">'; +print '</td><td align="center">'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'" name="Button"><br>'; print "</td>\n"; - print '</tr>'; + print '</form>'; @@ -143,15 +139,15 @@ if ($result) } else { - print '<input type="text" class="flat" size="30" name="constvalue" value="'.stripslashes($obj->value).'">'; + print '<input type="text" class="flat" size="32" name="constvalue" value="'.stripslashes($obj->value).'">'; print '</td><td>'; $form->select_array('consttype',array('yesno','texte','chaine'),2); } print '</td><td>'; // Note - print '<input type="text" class="flat" size="15" name="constnote" value="'.stripslashes(nl2br($obj->note)).'">'; - print '</td><td>'; + print '<input type="text" class="flat" size="24" name="constnote" value="'.stripslashes(nl2br($obj->note)).'">'; + print '</td><td align="center">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="button"> '; print '<a href="const.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>'; print "</td></tr>\n"; diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index 1c116a95084a90a775e1bf27086a5b036a86bdad..183680ee608dedc1726e8b11413f8a3774bb779c 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -189,79 +189,93 @@ class Account } } - /** - \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank - \return int rowid de l'entr�e ajout�e, <0 si erreur - */ - function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='',$emetteur='',$banque='') - { - dolibarr_syslog("Account::Addline: date=".$date.", oper=".$oper.", label=".$label.", amount=".$amount.", num_chq=".$num_chq.", categorie=".$categorie.", user=".$user->id); - if ($this->rowid) - { - $this->db->begin(); - - switch ($oper) - { - case 1: - $oper = 'TIP'; - break; - case 2: - $oper = 'VIR'; - break; - case 3: - $oper = 'PRE'; - break; - case 4: - $oper = 'LIQ'; - break; - case 5: - $oper = 'VAD'; - break; - case 6: - $oper = 'CB'; - break; - case 7: - $oper = 'CHQ'; - break; - } + /** + \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank + \param $date Date TMS op�ration + \param $oper 1,2,3,4... + \param $label Descripton + \param $amount Montant + \param $num_chq Numero cheque ou virement + \param $categorie Categorie optionnelle + \param $user Utilisateur qui cr�e + \param $emetteur Nom emetteur + \param $banque Banque emettrice + \return int Rowid de l'entr�e ajout�e, <0 si erreur + */ + function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user, $emetteur='',$banque='') + { + // Nettoyage parametres + $emetteur=trim($emetteur); + $banque=trim($banque); + + dolibarr_syslog("Account::Addline: date=".$date.", oper=".$oper.", label=".$label.", amount=".$amount.", num_chq=".$num_chq.", categorie=".$categorie.", user=".$user->id); - $datev = $date; + // Verififcation parametres + if (! $this->rowid) + { + $this->error="Account::addline rowid not defined"; + return -1; + } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)"; - $sql.= " VALUES (now(),'".$date."','$datev','".addslashes($label)."','" . price2num($amount)."','".$user->id."','$num_chq','".$this->rowid."', '$oper'"; - $sql.= ",'".addslashes(trim($emetteur))."'"; - $sql.= ",'".addslashes(trim($banque))."');"; + $this->db->begin(); + + switch ($oper) + { + case 1: + $oper = 'TIP'; + break; + case 2: + $oper = 'VIR'; + break; + case 3: + $oper = 'PRE'; + break; + case 4: + $oper = 'LIQ'; + break; + case 5: + $oper = 'VAD'; + break; + case 6: + $oper = 'CB'; + break; + case 7: + $oper = 'CHQ'; + break; + } - if ($this->db->query($sql)) - { - $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank"); - if ($categorie) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ('$rowid', '$categorie')"; - $result = $this->db->query($sql); - if (! $result) - { - $this->db->rollback(); - $this->error=$this->db->error(); - return -3; - } - } - $this->db->commit(); - return $rowid; - } - else - { - $this->db->rollback(); - $this->error=$this->db->error(); - return -2; - } - } - else - { - $this->error="Account::addline rowid not defined"; - return -1; - } - } + $datev = $date; + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)"; + $sql.= " VALUES (now(),'".$this->db->idate($date)."','".$this->db->idate($datev)."',"; + $sql.= "'".addslashes($label)."','" . price2num($amount)."','".$user->id."','$num_chq','".$this->rowid."', '$oper'"; + $sql.= ",'".addslashes($emetteur)."'"; + $sql.= ",'".addslashes($banque)."');"; + + if ($this->db->query($sql)) + { + $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank"); + if ($categorie) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ('$rowid', '$categorie')"; + $result = $this->db->query($sql); + if (! $result) + { + $this->db->rollback(); + $this->error=$this->db->error(); + return -3; + } + } + $this->db->commit(); + return $rowid; + } + else + { + $this->db->rollback(); + $this->error=$this->db->error(); + return -2; + } + } /* * \brief Creation du compte bancaire en base diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0af409eefac4f6ed5b449bec5403e4a80c047033..1662277801b56d8464d53b37ced065ffd1a15388 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -43,14 +43,17 @@ $vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $page=isset($_GET["page"])?$_GET["page"]:0; +$mesg=''; + /* * Action */ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) { - if ($_POST["credit"] > 0) + + if ($_POST["credit"] > 0) { $amount = $_POST["credit"]; } @@ -59,25 +62,35 @@ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user- $amount = - $_POST["debit"]; } - $dateop = $_POST["dateoy"].$_POST["dateo"]; - $operation=$_POST["operation"]; - $label=$_POST["label"]; + $dateop = dolibarr_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]); $operation=$_POST["operation"]; $num_chq=$_POST["num_chq"]; + $label=$_POST["label"]; $cat1=$_POST["cat1"]; - $acct=new Account($db,$account); - - $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); - if ($insertid > 0) - { - Header("Location: account.php?account=" . $account); - exit; - } - else - { - dolibarr_print_error($db,$acct->error); - } + if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); + if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); + + if (! $mesg) + { + $acct=new Account($db,$account); + + $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); + if ($insertid > 0) + { + Header("Location: account.php?account=" . $account); + exit; + } + else + { + dolibarr_print_error($db,$acct->error); + } + } + else + { + $_GET["action"]='addline'; + } } if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->rights->banque->modifier) { @@ -194,25 +207,28 @@ if ($account > 0) dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0); + if ($mesg) print '<div class="error">'.$mesg.'</div>'; + + /** * Bandeau recherche */ - $mesg=''; + $navig=''; $nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total if ($limitsql > $viewline) { - $mesg.='<a href="account.php?account='.$acct->id.'&page='.($page+1).'">'.img_previous().'</a>'; + $navig.='<a href="account.php?account='.$acct->id.'&page='.($page+1).'">'.img_previous().'</a>'; } - $mesg.= ' Page '.($nbpage-$page).'/'.$nbpage.' '; + $navig.= ' Page '.($nbpage-$page).'/'.$nbpage.' '; if ($total_lines > $limitsql ) { - $mesg.= '<a href="account.php?account='.$acct->id.'&page='.($page-1).'">'.img_next().'</a>'; + $navig.= '<a href="account.php?account='.$acct->id.'&page='.($page-1).'">'.img_next().'</a>'; } if (! $_GET["action"]=='addline' && ! $_GET["action"]=='delete') { $titre=$langs->trans("FinancialAccount")." : ".$acct->label; - print_fiche_titre($titre,$mesg); + print_fiche_titre($titre,$navig); } if ($_GET["action"]=='delete') @@ -222,15 +238,10 @@ if ($account > 0) print '<br />'; } - + print '<table class="notopnoleftnoright" width="100%">'; - /* - * Affiche tableau des transactions bancaires - * - */ - // Formulaire de saisie d'une op�ration hors factures if ($user->rights->banque->modifier && $_GET["action"]=='addline') { @@ -246,16 +257,21 @@ if ($account > 0) print '</tr>'; print '<tr class="liste_titre">'; - print '<td><small>YYYY MMDD</small></td><td colspan="2">'.$langs->trans("Type").'</td><td>'.$langs->trans("Description").'</td><td align=right>'.$langs->trans("Debit").'</td><td align=right>'.$langs->trans("Credit").'</td>'; - print '<td colspan="2" align="center"> '; - print '</td></tr>'; + print '<td>'.$langs->trans("Date").'</td>'; + print '<td> </td>'; + print '<td>'.$langs->trans("Type").'</td>'; + print '<td>'.$langs->trans("Description").'</td>'; + print '<td align=right>'.$langs->trans("Debit").'</td>'; + print '<td align=right>'.$langs->trans("Credit").'</td>'; + print '<td colspan="2" align="center"> </td>'; + print '</tr>'; print '<tr '.$bc[false].'>'; - print '<td nowrap>'; - print '<input name="dateoy" class="flat" type="text" size="2" value="'.strftime("%Y",time()).'" maxlength="4">'; - print '<input name="dateo" class="flat" type="text" size="2" maxlength="4"></td>'; - print '<td colspan="2" nowrap>'; - $html->select_types_paiements('','operation','1,2',1); + print '<td nowrap="nowrap" colspan="2">'; + $html->select_date(-1,'op',0,0,0,'transaction'); + print '</td>'; + print '<td nowrap="nowrap">'; + $html->select_types_paiements('','operation','1,2',1,1); print '<input name="num_chq" class="flat" type="text" size="4"></td>'; print '<td>'; print '<input name="label" class="flat" type="text" size="40">'; @@ -275,6 +291,11 @@ if ($account > 0) print "<tr class=\"noborder\"><td colspan=\"8\"> </td></tr>\n"; } + /* + * Affiche tableau des transactions bancaires + * + */ + // Ligne de titre tableau des acritures print '<tr class="liste_titre">'; print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Value").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Description").'</td>'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index e53371648a065fa662cb6dce136fc45a2f4487ac..0ba7812a41ecec645421cb11bee6d98b112503f1 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -56,10 +56,10 @@ if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement' { $error = 0; - $datepaye = $db->idate(mktime(12, 0 , 0, + $datepaye = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], - $_POST['reyear'])); + $_POST['reyear']); $paiement_id = 0; // Verifie si des paiements sont sup�rieurs au montant facture diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 13e3ca47508dd75a16618b3295ffe5ff9d6a02d0..05ace48df98f5cdfadd4001fa0e8a4d633fcf0c4 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -48,7 +48,7 @@ $mesg=''; * Actions */ -if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer) +if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement) { $db->begin(); @@ -68,7 +68,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user- } } -if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer) +if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement) { $db->begin(); @@ -129,7 +129,7 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("Payment").": ".$paiement-> */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), 'Etes-vous s�r de vouloir supprimer ce paiement ?', 'confirm_delete'); + $html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); print '<br>'; } @@ -262,13 +262,18 @@ print '<div class="tabsAction">'; if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '') { - print '<a class="tabAction" href="fiche.php?id='.$_GET['id'].'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>'; -} + if ($user->rights->facture->paiement) + { + print '<a class="butAction" href="fiche.php?id='.$_GET['id'].'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>'; + } +} if ($user->societe_id == 0 && $allow_delete && $paiement->statut == 0 && $_GET['action'] == '') { - print '<a class="butDelete" href="fiche.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>'; - + if ($user->rights->facture->paiement) + { + print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>'; + } } print '</div>'; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b62db09d2a708f420d7032924a23366097ba24a9..bd5ad91920a77772654ea1ea1083c7ae9ee261b8 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -32,7 +32,7 @@ require('./pre.inc.php'); -require('./paiementfourn.class.php'); +require(DOL_DOCUMENT_ROOT.'/fourn/facture/paiementfourn.class.php'); $langs->load('companies'); $langs->load('bills'); @@ -61,10 +61,10 @@ if ($action == 'add_paiement') { $error = 0; - $datepaye = $db->idate(mktime(12, 0 , 0, - $_POST['remonth'], - $_POST['reday'], - $_POST['reyear'])); + $datepaye = dolibarr_mktime(12, 0 , 0, + $_POST['remonth'], + $_POST['reday'], + $_POST['reyear']); $paiement_id = 0; $total = 0; // G�n�re tableau des montants amounts diff --git a/htdocs/fourn/facture/paiementfourn.class.php b/htdocs/fourn/facture/paiementfourn.class.php index c3fe1f37be82a9e403ece3fbff6ee5e38aacd156..ae75dcb8eb7229af1f3ebbf6f2cb7ccfb6df3d22 100644 --- a/htdocs/fourn/facture/paiementfourn.class.php +++ b/htdocs/fourn/facture/paiementfourn.class.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ * $Source$ */ -/*! +/** \file htdocs/fourn/facture/paiementfourn.class.php \ingroup fournisseur, facture \brief Page de cr�ation de paiement factures fournisseurs @@ -140,7 +140,7 @@ class PaiementFourn if ($this->total <> 0) // On accepte les montants n�gatifs { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author)'; - $sql .= ' VALUES (now(), '.$this->datepaye.', \''.$this->total.'\', '.$this->paiementid.', \''.$this->num_paiement.'\', \''.$this->note.'\', '.$user->id.')'; + $sql .= ' VALUES (now(), '.$this->db->idate($this->datepaye).', \''.$this->total.'\', '.$this->paiementid.', \''.$this->num_paiement.'\', \''.$this->note.'\', '.$user->id.')'; $resql = $this->db->query($sql); if ($resql) { @@ -309,6 +309,8 @@ class PaiementFourn function valide() { $sql = 'UPDATE '.MAIN_DB_PREFIX.'paiementfourn SET statut = 1 WHERE rowid = '.$this->id; + + dolibarr_syslog("PaiementFourn::valide sql=".$sql); $result = $this->db->query($sql); if ($result) { @@ -316,7 +318,8 @@ class PaiementFourn } else { - dolibarr_syslog('Paiement::Valide Error -1'); + $this->error='Paiement::Valide Error -1 '.$this->db->error(); + dolibarr_syslog('PaiementFourn::valide error '.$this->error); return -1; } } @@ -331,6 +334,7 @@ class PaiementFourn $sql .= ', '.$this->db->pdate('tms').' as tms'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c'; $sql .= ' WHERE c.rowid = '.$id; + $resql = $this->db->query($sql); if ($resql) { @@ -397,5 +401,57 @@ class PaiementFourn } } + /** + * \brief Retourne le libell� du statut d'une facture (brouillon, valid�e, abandonn�e, pay�e) + * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long, 5=Libell� court + Picto + * \return string Libelle + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * \brief Renvoi le libell� d'un statut donne + * \param status Statut + * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long, 5=Libell� court + Picto + * \return string Libell� du statut + */ + function LibStatut($status,$mode=0) + { + global $langs; // TODO Renvoyer le libell� anglais et faire traduction a affichage + $langs->load('compta'); + if ($mode == 0) + { + if ($status == 0) return $langs->trans('ToValidate'); + if ($status == 1) return $langs->trans('Validated'); + } + if ($mode == 1) + { + if ($status == 0) return $langs->trans('ToValidate'); + if ($status == 1) return $langs->trans('Validated'); + } + if ($mode == 2) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); + } + if ($mode == 3) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4'); + } + if ($mode == 4) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); + } + if ($mode == 5) + { + if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); + } + return $langs->trans('Unknown'); + } } ?> diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 448dea4b5941d3234d1202a5250b0a4e8c261cf9..2485425bb79006419ceef11e46ac9577c515ab34 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -35,10 +35,12 @@ require('./pre.inc.php'); require(DOL_DOCUMENT_ROOT.'/fourn/facture/paiementfourn.class.php'); $user->getrights('facture'); +$user->getrights('fournisseur'); $langs->load('bills'); $langs->load('banks'); $langs->load('companies'); +$langs->load("suppliers"); $mesg=''; @@ -47,7 +49,7 @@ $mesg=''; * Actions */ -if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer) +if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->facture->supprimer) { $db->begin(); @@ -67,7 +69,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user- } } -if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer) +if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->facture->valider) { $db->begin(); @@ -110,7 +112,7 @@ $head[$h][1] = $langs->trans('Info'); $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans('Payment').': '.$paiement->ref); +dolibarr_fiche_head($head, $hselected, $langs->trans('SupplierPayment')); /* * Confirmation de la suppression du paiement @@ -162,13 +164,13 @@ if ($paiement->numero) print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->numero.'</td></tr>'; } print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->montant).' '.$langs->trans('Currency'.$conf->monnaie).'</td></tr>'; +print '<tr><td valign="top">'.$langs->trans('Status').'</td><td colspan="3">'.$paiement->getLibStatut(4).'</td></tr>'; print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>'; print '</table>'; -/* - * - * +/** + * Liste des factures */ $allow_delete = 1 ; $sql = 'SELECT f.facnumber, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.idp'; @@ -234,15 +236,21 @@ print '</div>'; */ print '<div class="tabsAction">'; - if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '') { - print '<a class="tabAction" href="fiche.php?id='.$_GET['id'].'&action=valide">'.$langs->trans('Valid').'</a>'; -} + if ($user->rights->fournisseur->facture->valider) + { + print '<a class="tabAction" href="fiche.php?id='.$_GET['id'].'&action=valide">'.$langs->trans('Valid').'</a>'; + } +} if ($user->societe_id == 0 && $allow_delete && $paiement->statut == 0 && $_GET['action'] == '') { - print '<a class="butDelete" href="fiche.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>'; + if ($user->rights->fournisseur->facture->supprimer) + { + print '<a class="butDelete" href="fiche.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>'; + + } } print '</div>'; diff --git a/htdocs/fourn/paiement/info.php b/htdocs/fourn/paiement/info.php index 0845f2a8febc54e50a02f457fdb0c4e19c812de7..82b9bfb43fb4cd13394f02d560b9ff4e3a1b75e3 100644 --- a/htdocs/fourn/paiement/info.php +++ b/htdocs/fourn/paiement/info.php @@ -31,6 +31,7 @@ require("./pre.inc.php"); require(DOL_DOCUMENT_ROOT."/fourn/facture/paiementfourn.class.php"); $langs->load("bills"); +$langs->load("suppliers"); $langs->load("companies"); llxHeader(); @@ -45,7 +46,7 @@ $head[$h][1] = $langs->trans("Info"); $hselected = $h; $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans("Payment").": ".$_GET["id"]); +dolibarr_fiche_head($head, $hselected, $langs->trans("SupplierPayment")); /* diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 1082861040a3f8671c3793748b566f4954540e27..5d1d9791adba950c4833bc7ef570e622655e7759 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1144,12 +1144,13 @@ class Form * \param htmlname Nom de la zone select * \param filtertype Pour filtre * \param format 0=id+libelle, 1=code+code, 2=code+libelle + * \param empty 1=peut etre vide, 0 sinon */ - function select_types_paiements($selected='',$htmlname='paiementtype',$filtertype='',$format=0) + function select_types_paiements($selected='',$htmlname='paiementtype',$filtertype='',$format=0, $empty=0) { global $langs; - dolibarr_syslog("Form::select_type_paiements $selected, $htmlname, $filtertype, $format",LOG_DEBUG); + dolibarr_syslog("Form::select_type_paiements $selected, $htmlname, $filtertype, $format",LOG_DEBUG); $filterarray=array(); if ($filtertype == 'CRDT') $filterarray=array(0,2); @@ -1159,6 +1160,7 @@ class Form $this->load_cache_types_paiements(); print '<select class="flat" name="'.$htmlname.'">'; + if ($empty) print '<option value=""> </option>'; foreach($this->cache_types_paiements_code as $id => $code) { // On passe si on a demand� de filtrer sur des modes de paiments particuli�rs diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index cf40cdd2d8409925e499cbbb685db992041c4f74..510152da8ad9336cbb05e51d94af5ed485f29d1b 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -38,6 +38,8 @@ SupplierBills=suppliers invoices BillContacts=Invoice contacts Payment=Payment Payments=Payments +DeletePayment=Delete payment +ConfirmDeletePayment=Are you sure you want to delete this payment ? ReceivedPayments=Received payments ReceivedCustomersPayments=Payments received from customers ReceivedCustomersPaymentsToValid=Received customers payments to validate diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 109236296f7bc66c01eae6dfed0cb52786809699..6a397f6f1e1d87ac75a5cf0399bbec25b3c14529 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -78,6 +78,8 @@ InvoiceValidatedInDolibarr=Invoice %s validated in Dolibarr InvoicePayedInDolibarr=Invoice %s changed to payed in Dolibarr InvoiceCanceledInDolibarr=Invoice %s canceled in Dolibarr PaymentDoneInDolibarr=Payment %s done in Dolibarr +CustomerPaymentDoneInDolibarr=Customer payment %s done in Dolibarr +SupplierPaymentDoneInDolibarr=Supplier payment %s done in Dolibarr ##### Export ##### ExportsArea=Exports area AvailableFormats=Available formats diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang index 9111450405ef46d0fa2def6272d571740428b556..a46e8d2425dace1359e42247a31421647c35b6a9 100644 --- a/htdocs/langs/en_US/suppliers.lang +++ b/htdocs/langs/en_US/suppliers.lang @@ -16,4 +16,5 @@ ChangeSupplierPrice=Change supplier price ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. ProductHasAlreadyReferenceInThisSupplier=This product has already a reference in this supplier -NoRecordedSuppliers=No suppliers recorded \ No newline at end of file +NoRecordedSuppliers=No suppliers recorded +SupplierPayment=Supplier payment \ No newline at end of file diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index b2f0f6bdc5ad97fd6d21df068f14a116cf4b0ed9..5c4abeeb32e28e3334284fea58a6e902904d311d 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -38,6 +38,8 @@ SupplierBills=Factures fournisseurs BillContacts=Contacts facture Payment=R�glement Payments=R�glements +DeletePayment=Supprimer le paiement +ConfirmDeletePayment=Etes vous sur de vouloir supprimer ce paiement ? ReceivedPayments=R�glements re�us ReceivedCustomersPayments=R�glements re�us du client ReceivedCustomersPaymentsToValid=R�glements clients re�us � valider diff --git a/htdocs/langs/fr_FR/suppliers.lang b/htdocs/langs/fr_FR/suppliers.lang index f433bf05d9e5940376d38c02078aa996ff17339c..25135eb09becc227d809c45a6b6012c626755e41 100644 --- a/htdocs/langs/fr_FR/suppliers.lang +++ b/htdocs/langs/fr_FR/suppliers.lang @@ -16,4 +16,5 @@ ChangeSupplierPrice=Modifier prix fournisseur ErrorQtyTooLowForThisSupplier=Quantit� insuffisante pour ce fournisseur ErrorSupplierCountryIsNotDefined=Le pays de ce fournisseur n'est pas d�fini. Corriger sur sa fiche. ProductHasAlreadyReferenceInThisSupplier=Ce produit a d�j� une r�f�rence chez ce fournisseur -NoRecordedSuppliers=Pas de fournisseurs enregistr�s \ No newline at end of file +NoRecordedSuppliers=Pas de fournisseurs enregistr�s +SupplierPayment=Paiement fournisseur \ No newline at end of file diff --git a/htdocs/lib/databases/mysql.lib.php b/htdocs/lib/databases/mysql.lib.php index 930da0b9ff6e0729201bade8b3390078909751b6..684fe4aaf4abbab34f0469a1a6fd966d1d9b10f3 100644 --- a/htdocs/lib/databases/mysql.lib.php +++ b/htdocs/lib/databases/mysql.lib.php @@ -441,7 +441,7 @@ class DoliDb } /** - \brief Formatage (par PHP) d'une date au format texte pour insertion dans champ date. + \brief Formatage (par PHP) d'une date vers format texte pour insertion dans champ date. Fonction � utiliser pour g�n�rer les INSERT. \param param Date TMS � convertir \return date Date au format texte YYYYMMDDHHMMSS. diff --git a/htdocs/lib/databases/mysqli.lib.php b/htdocs/lib/databases/mysqli.lib.php index 046f35fb0a851bba796d39bead61df1cd5d00c93..bb0724325a32167e33a96d8a0ce2ecfcffe91ee8 100644 --- a/htdocs/lib/databases/mysqli.lib.php +++ b/htdocs/lib/databases/mysqli.lib.php @@ -436,7 +436,7 @@ class DoliDb } /** - \brief Formatage (par PHP) de la date en texte qui s'insere dans champ date. + \brief Formatage (par PHP) d'une date vers format texte pour insertion dans champ date. Fonction � utiliser pour g�n�rer les INSERT. \param param Date tms � convertir \return date Date au format text YYYYMMDDHHMMSS. diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index 54e80d07201c6b084f93df936392fcb86a3ce573..dc7b4d44b21ba1f6584986820598c2d6c47d205d 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -137,7 +137,7 @@ class Paiement if ($this->total <> 0) // On accepte les montants n�gatifs pour les rejets de pr�l�vement { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement (datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)'; - $sql .= ' VALUES (now(), '.$this->datepaye.', \''.$this->total.'\', '.$this->paiementid.', \''.$this->num_paiement.'\', \''.$this->note.'\', '.$user->id.')'; + $sql .= ' VALUES (now(), '.$this->db->idate($this->datepaye).', \''.$this->total.'\', '.$this->paiementid.', \''.$this->num_paiement.'\', \''.$this->note.'\', '.$user->id.')'; $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/tva.class.php b/htdocs/tva.class.php index ff4a65eeb39c247340a55304a50783f01e21d167..03831112c739b9796fcb2b3675916de233c852bc 100644 --- a/htdocs/tva.class.php +++ b/htdocs/tva.class.php @@ -238,7 +238,7 @@ class Tva require_once(DOL_DOCUMENT_ROOT.'/compta/bank/account.class.php'); $acc = new Account($this->db, $this->accountid); - $bank_line_id = $acc->addline($this->db->idate($this->datep), $this->paymenttype, $this->label, -abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user); // Mise a jour fk_bank dans llx_paiementtva. On connait ainsi la ligne de tva qui a g�n�r� l'�criture bancaire if ($bank_line_id) {