From 09c802148836d2856d0574101b27b2160938bcb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Feb 2005 18:33:10 +0000 Subject: [PATCH] Trad: Traduction de chaines sur les status de propales et factures. --- htdocs/comm/propal.php | 340 ++++++++++++++++------------- htdocs/langs/en_US/commercial.lang | 1 + htdocs/langs/en_US/propal.lang | 5 +- htdocs/langs/en_US/users.lang | 17 +- htdocs/langs/fr_FR/commercial.lang | 1 + htdocs/langs/fr_FR/propal.lang | 5 +- htdocs/langs/fr_FR/users.lang | 15 +- htdocs/propal.class.php | 46 +++- 8 files changed, 257 insertions(+), 173 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c2c729e5592..025740e1c17 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * * This program is free software; you can redistribute it and/or modify @@ -38,10 +38,9 @@ $user->getrights('propale'); if (!$user->rights->propale->lire) accessforbidden(); -/* - * Modules optionnels - */ -require("../project.class.php"); +if ($conf->projet->enabled) { + require_once "../project.class.php"; +} require("./propal_model_pdf.class.php"); require("../propal.class.php"); require("../actioncomm.class.php"); @@ -56,6 +55,10 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } +// Nombre de ligne pour choix de produit/service prédéfinis +$NBLINES=4; + + /******************************************************************************/ /* Actions */ /******************************************************************************/ @@ -255,7 +258,7 @@ if ($_GET["propalid"]) $head[$h][1] = $langs->trans("Info"); $h++; - dolibarr_fiche_head($head, $hselected, $langs->trans("Prop").": $propal->ref"); + dolibarr_fiche_head($head, $hselected, $langs->trans("Proposal").": $propal->ref"); /* * Confirmation de la suppression de la propale @@ -266,7 +269,10 @@ if ($_GET["propalid"]) $html->form_confirm("propal.php?propalid=$propal->id",$langs->trans("DeleteProp"),$langs->trans("ConfirmDeleteProp"),"confirm_delete"); print '
'; } + + /* + * Fiche propal * */ $sql = "SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.note, x.firstname, x.name, x.fax, x.phone, x.email, p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture"; @@ -279,17 +285,15 @@ if ($_GET["propalid"]) } $result = $db->query($sql); - if ( $result ) { - $obj = $db->fetch_object($result); - - if ($db->num_rows()) + + if ($db->num_rows($result)) { + $obj = $db->fetch_object($result); $color1 = "#e0e0e0"; - if ($propal->brouillon == 1 && $user->rights->propale->creer) { /* la form est ouverte avant la table pour respect des normes */ @@ -298,7 +302,7 @@ if ($_GET["propalid"]) } print ""; - $rowspan=4; + $rowspan=7; print ''; - print ''; + print ''; print ''; - print ''; + print ''; $langs->load("mails"); print ""; @@ -342,37 +343,36 @@ if ($_GET["propalid"]) print $projet->title.''; } - /* - * - */ + $author = new User($db, $obj->fk_user_author); + $author->fetch(''); + print ""; + + print ''; if ($propal->brouillon == 1 && $user->rights->propale->creer) { - print ''; - print ''; - print ''; - + print ''; + print ''; + print ''; } else { - print ''; - print ''; + print ''; } + print ''; - print ''; - /* - * - */ - print ''; - print ''; - - /* - * - */ - print ''; - print ''; - /* - * - */ + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; print "
'.$langs->trans("Company").''; if ($societe->client == 1) @@ -310,7 +314,7 @@ if ($_GET["propalid"]) $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id; } print ''.$societe->nom.''.$langs->trans("Status").''.$obj->lst.'
Conditions de réglement :
'.$langs->trans("Date").''.strftime("%A %d %B %Y",$propal->date); if ($propal->fin_validite) @@ -319,10 +323,7 @@ if ($_GET["propalid"]) } print ''.$langs->trans("Author").''; - $author = new User($db, $obj->fk_user_author); - $author->fetch(''); - print $author->fullname.'
 
".$langs->trans("MailTo")."$obj->firstname $obj->name".($obj->email?" <$obj->email>":"")."
".$langs->trans("Author")."$author->fullname
'.$langs->trans("GlobalDiscount").'
'.$langs->trans("Discount").' ?%
% '; + print ''; + print ' ?'; + print '
'.$langs->trans("Discount").''.$propal->remise_percent.' % '.$propal->remise_percent.' %
'.price($propal->remise).' euros
'.$langs->trans("AmountHT").''.price($obj->price + $obj->remise).' euros'.$langs->trans("VAT").''.price($propal->total_tva).' euros
'.$langs->trans("TotalHT").''.price($obj->price).' euros'.$langs->trans("TotalTTC").''.price($propal->total_ttc).' euros
'.$langs->trans("AmountHT").''.price($obj->price).''.$conf->monnaie.'
'.$langs->trans("VAT").''.price($propal->total_tva).''.$conf->monnaie.'
'.$langs->trans("AmountTTC").''.price($propal->total_ttc).''.$conf->monnaie.'
'.$langs->trans("Status").''.$propal->get_libstatut().'

"; @@ -397,93 +397,137 @@ if ($_GET["propalid"]) print ""; } - /* - * Produits - */ - print_titre($langs->trans("ProductsAndServices")); - print '
'; - print ''; - print ""; - print ''; - print ''; - print ""; - print "\n"; - - $sql = "SELECT pt.rowid, p.label as product, p.ref, pt.price, p.fk_product_type, pt.qty, p.rowid as prodid, pt.tva_tx, pt.remise_percent, pt.subprice"; - $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt, ".MAIN_DB_PREFIX."product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propal->id"; + /* + * Lignes de propale + * + */ + $sql = "SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, p.label as product, p.ref, p.fk_product_type, p.rowid as prodid"; + $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt LEFT JOIN ".MAIN_DB_PREFIX."product as p ON pt.fk_product=p.rowid"; + $sql .= " WHERE pt.fk_propal = ".$propal->id; $sql .= " ORDER BY pt.rowid ASC"; $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); - $i = 0; - - $var=True; + $num_lignes = $db->num_rows($result); + $i = 0; $total = 0; - while ($i < $num) + print '
'.$langs->trans("Ref").''.$langs->trans("ProductOrService").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").' 
'; + if ($num_lignes) + { + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + $var=True; + while ($i < $num_lignes) { $objp = $db->fetch_object($result); $var=!$var; print ""; - print "\n"; - print ''; - print ''; - print "\n"; - print ''; - print ''; - if ($propal->statut == 0 && $user->rights->propale->creer) + if ($objp->fk_product > 0) { - print ''; + print ''; } - else { - print ''; - } - print ""; - - $i++; - } - } - - $sql = "SELECT pt.rowid, pt.description, pt.price, pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice"; - $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt WHERE pt.fk_propal = $propal->id AND pt.fk_product = 0"; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; - while ($i < $num) + else { - $objp = $db->fetch_object($result); - $var=!$var; - print "\n"; - print ''; - print ''; - print "\n"; - print ''; - print ""; - if ($propal->statut == 0 && $user->rights->propale->creer) + print "\n"; + } + + print ''; + print '\n"; + print ''; + if ($objp->remise_percent > 0) { - print ''; + print '\n"; } else { print ''; } - print ""; - $i++; + print '\n"; + + // Icone d'edition et suppression + if ($propal->statut == 0 && $user->rights->propale->creer) + { + print ''; + print ''; } + else + { + print ''; + } + print ""; + + // Update ligne de facture + // \todo + + + $total = $total + ($objp->qty * $objp->price); + $i++; + } + + $db->free(); + } + else + { + dolibarr_print_error($db); } + /* + * Ajouter une ligne + * + */ if ($propal->statut == 0 && $user->rights->propale->creer) { + print ''; + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print ''; + print ''; + + // Ajout produit produits/services personalisé + $var=!$var; + + print "\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print ""; + + // Ajout de produits/services prédéfinis $sql = "SELECT p.rowid,p.label,p.ref,p.price FROM ".MAIN_DB_PREFIX."product as p WHERE p.envente=1 ORDER BY p.nbvente DESC LIMIT 20"; $result = $db->query($sql); if ($result) @@ -503,39 +547,25 @@ if ($_GET["propalid"]) dolibarr_print_error($db); } - /* - * Ligne d'ajout de produits/services personalisé - */ $var=!$var; - - print "\n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print ""; - - /* - * Ligne d'ajout de produits/services prédéfinis - */ - $var=!$var; - print ""; - print ''; - print ''; + print ""; + print ""; print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; + print ""; } - print "
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("AmountHT").'  
".$objp->ref."'; - if ($objp->fk_product_type==0) print img_object($langs->trans("ShowProduct"),"product"); - if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service"); - print ' '.$objp->product.''.$objp->tva_tx.' %".$objp->qty."'.$objp->remise_percent.' %'.price($objp->subprice).''; - print img_delete(); - print ''; + if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service"); + else print img_object($langs->trans("ShowProduct"),"product"); + print ' '.stripslashes(nl2br($objp->description?$objp->description:$objp->product)).''; + if ($objp->date_start && $objp->date_end) { print " (Du ".dolibarr_print_date($objp->date_start)." au ".dolibarr_print_date($objp->date_end).")"; } + if ($objp->date_start && ! $objp->date_end) { print " (A partir du ".dolibarr_print_date($objp->date_start).")"; } + if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dolibarr_print_date($objp->date_end).")"; } + print ' 
 '.$objp->description.''.$objp->tva_tx.' %".$objp->qty."'.$objp->remise_percent.' %".price($objp->subprice)."".stripslashes(nl2br($objp->description)); + if ($objp->date_start && $objp->date_end) { print " (Du ".dolibarr_print_date($objp->date_start)." au ".dolibarr_print_date($objp->date_end).")"; } + if ($objp->date_start && ! $objp->date_end) { print " (A partir du ".dolibarr_print_date($objp->date_start).")"; } + if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dolibarr_print_date($objp->date_end).")"; } + print "'.$objp->tva_tx.' %'.price($objp->subprice)."'.$objp->qty.''; - print img_delete(); - print ''.$objp->remise_percent." % 
'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."'; + //print img_edit(); + print ''; + print img_delete(); + print '  
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("Discount").'   
"; + print $html->select_tva("np_tva_tx",$conf->defaulttx) . "remise_client."\" name=\"np_remise\"> %trans("Add")."\" name=\"addproduct\">
 "; - print $html->select_tva("np_tva_tx",$conf->defaulttx) . "remise_client."\" name=\"np_remise\"> %trans("Add")."\" name=\"addproduct\">
  %
  %
"; - print '
'; + print "
\n"; } + /* + * Fin Ajout ligne + * + */ print ''; @@ -719,54 +749,54 @@ if ($_GET["propalid"]) } } - - - /* - * - */ print ""; + /* - * + * Liste des actions propres à la propal */ - $sql = "SELECT ".$db->pdate("a.datea"). " as da, note, fk_user_author" ; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = $obj->idp AND a.propalrowid = $propal->id "; + $sql = "SELECT id, ".$db->pdate("a.datea"). " as da, note, fk_user_author" ; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + $sql .= " WHERE a.fk_soc = $obj->idp AND a.propalrowid = $propal->id "; - if ( $db->query($sql) ) + $result = $db->query($sql); + if ($result) { - $num = $db->num_rows(); - $i = 0; $total = 0; - - if ($num > 0) + $num = $db->num_rows($result); + if ($num) { - print_titre("Propale envoyée"); + print_titre($langs->trans("ActionsOnPropal")); + $i = 0; $total = 0; print ''; - print "\n"; - - + print ''; + print "\n"; + + $var=True; while ($i < $num) { - $objp = $db->fetch_object(); - print "\n"; + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + print ''; + print '\n"; + print ''; $authoract = new User($db); $authoract->id = $objp->fk_user_author; $authoract->fetch(''); - print "\n"; - print ""; + print ''; + print "\n"; $i++; } print "
".$langs->trans("Date")."".$langs->trans("Author")."
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Action").''.$langs->trans("By").'
".strftime("%d %B %Y %H:%M:%S",$objp->da)."
'.img_object($langs->trans("ShowTask"),"task").' '.$objp->id.''.dolibarr_print_date($objp->da)."'.stripslashes($objp->note).'$authoract->code
$objp->note
'.$authoract->code.'
"; } - $db->free(); } else { dolibarr_print_error($db); } - /* - * - */ + print ""; + if ($propal->brouillon == 1) { print ''; diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 7edc29dbfc0..783523d9487 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -15,6 +15,7 @@ ActionOnCompany=Task about company ActionOnContact=Task about contact TaskRDV=Rendez-vous TaskRDVWith=Rendez-vous with %s +ShowTask=Show task SalesRepresentative=Sales representative ErrorWrongCode=Wrong code NoSalesRepresentativeAffected=No particular sales representative affected diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 6784cd06f15..b93ac27e018 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -21,4 +21,7 @@ NbOfProposals=Number of commercial proposals ShowPropal=Show proposal PropalsDraft=Drafts PropalsOpened=Opened -ListOfProposals=List of commercial proposals \ No newline at end of file +PropalStatusDraft=Draft (need to be validated) +PropalStatusValidated=Validated (proposal is opened) +ListOfProposals=List of commercial proposals +ActionsOnPropal=Tasks on proposal \ No newline at end of file diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 90a1cbe67db..fb1b2a3367b 100755 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -9,10 +9,20 @@ SendNewPassword=Send new password SubjectNewPassword=Your new password for Dolibarr AvailableRights=Available permissions OwnedRights=Owned permissions +GroupRights=Group permissions +UserRights=User permissions DisableUser=Disable user DisableAUser=Disable a user +DeleteUser=Delete user +DeleteAUser=Delete a user +DisableGroup=Disable group +DisableAGroup=Disable a group +DeleteGroup=Delete group +DeleteAGroup=Delete a group ConfirmDisableUser=Are you sure you want to disable user %s ? -ConfirmDisableUser=Are you sure you want to delete group %s ? +ConfirmDisableGroup=Are you sure you want to disable group %s ? +ConfirmDeleteUser=Are you sure you want to delete user %s ? +ConfirmDeleteGroup=Are you sure you want to delete group %s ? NewUser=New user CreateUser=Create user SearchAGroup=Search a group @@ -28,7 +38,7 @@ DefaultRightsDesc=Define here default permissions that are automatically granted DolibarrUsers=Dolibarr users LastName=Name FirstName=Firstname -ListOfGroups=List of Groups +ListOfGroups=List of groups NewGroup=New group CreateGroup=Create group RemoveFromGroup=Remove from group @@ -41,4 +51,5 @@ ShowUser=Show user NonAffectedUsers=Non affected users UserModified=User modified successfully PhotoFile=Fichier photo -UserWithDolibarrAccess=User with Dolibarr access \ No newline at end of file +UserWithDolibarrAccess=User with Dolibarr access +ListOfUsersInGroup=List of users in group \ No newline at end of file diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang index 4732efd8ca5..f55aa4f8f69 100644 --- a/htdocs/langs/fr_FR/commercial.lang +++ b/htdocs/langs/fr_FR/commercial.lang @@ -15,6 +15,7 @@ ActionOnCompany=Action concernant la soci ActionOnContact=Action concernant le contact TaskRDV=Rendez-vous TaskRDVWith=Rendez-vous avec %s +ShowTask=Afficher action SalesRepresentative=Commercial ErrorWrongCode=Code incorrect NoSalesRepresentativeAffected=Aucun commercial particulier affecté diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 7b405769a89..68bfa3659df 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -21,4 +21,7 @@ NbOfProposals=Nombre de propositions commerciales ShowPropal=Afficher proposition PropalsDraft=Brouillons PropalsOpened=Ouvertes -ListOfProposals=Liste des devis/propositions commerciales \ No newline at end of file +PropalStatusDraft=Brouillon (à valider) +PropalStatusValidated=Validée (propale ouverte) +ListOfProposals=Liste des devis/propositions commerciales +ActionsOnPropal=Actions sur la proposition diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang index d016d1b7aec..66982e99f90 100755 --- a/htdocs/langs/fr_FR/users.lang +++ b/htdocs/langs/fr_FR/users.lang @@ -9,10 +9,20 @@ SendNewPassword=Envoyer nouveau mot de passe SubjectNewPassword=Votre mot de passe pour Dolibarr AvailableRights=Permissions disponibles OwnedRights=Permissions détenues +GroupRights=Permissions groupe +UserRights=Permissions utilisateur DisableUser=Désactiver utilisateur DisableAUser=Désactiver un utilisateur +DeleteUser=Supprimer utilisateur +DeleteAUser=Supprimer un utilisateur +DisableGroup=Désactiver groupe +DisableAGroup=Désactiver un groupe +DeleteGroup=Supprimer groupe +DeleteAGroup=Supprimer un groupe ConfirmDisableUser=Etes-vous sûr de vouloir désactiver l'utilisateur %s ? -ConfirmDisableGroup=Etes-vous sûr de vouloir supprimer le groupe %s ? +ConfirmDisableGroup=Etes-vous sûr de vouloir désactiver le groupe %s ? +ConfirmDeleteUser=Etes-vous sûr de vouloir supprimer l'utilisateur %s ? +ConfirmDeleteGroup=Etes-vous sûr de vouloir supprimer le groupe %s ? NewUser=Nouvel utilisateur CreateUser=Créer l'utilisateur SearchAGroup=Rechercher un groupe @@ -41,4 +51,5 @@ ShowUser=Afficher utilisateur NonAffectedUsers=Utilisateurs non affectés au groupe UserModified=Utilisateur modifié avec succès PhotoFile=Fichier photo -UserWithDolibarrAccess=Utilisateur avec accès Dolibarr \ No newline at end of file +UserWithDolibarrAccess=Utilisateur avec accès Dolibarr +ListOfUsersInGroup=Liste des utilisateurs dans le groupe \ No newline at end of file diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 901e313b4b5..2be4329244b 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -23,18 +23,20 @@ */ -/*! \file htdocs/propal.class.php - \brief Fichier de la classe des propales - \author Rodolphe Qiedeville - \author Eric Seigne - \author Laurent Destailleur - \version $Revision$ +/** + \file htdocs/propal.class.php + \brief Fichier de la classe des propales + \author Rodolphe Qiedeville + \author Eric Seigne + \author Laurent Destailleur + \version $Revision$ */ -/*! \class Propal - \brief Classe permettant la gestion des propales +/** + \class Propal + \brief Classe permettant la gestion des propales */ class Propal @@ -346,11 +348,11 @@ class Propal return -1; } } + /* - * Lit les informations - * - * + * \brief Recupère de la base les caractéristiques d'une propale + * \param rowid id de la propal à récupérer */ function fetch($rowid) @@ -835,6 +837,28 @@ class Propal } + /** + * \brief Retourne le libellé du statut d'une propale (brouillon, validée, ...) + * \return string Libellé + */ + function get_libstatut() + { + return $this->LibStatut($this->statut); + } + + /** + * \brief Renvoi le libellé d'un statut donné + * \param statut id statut + * \return string Libellé + */ + function LibStatut($statut) + { + global $langs; + $langs->load("propals"); + if ($statut == 0) return $langs->trans("PropalStatusDraft"); + return $langs->trans("PropalStatusValidated"); + } + } class PropaleLigne