From d7341f59e06b24b3b9cdaf8dd545a6e4cc51d0b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Aug 2006 02:20:57 +0000 Subject: [PATCH] Fix: Comptage des commandes en cours sur le stock. Qual: Uniformatisation de code des commandes fournisseurs --- htdocs/conf/conf.class.php | 1 - htdocs/fourn/commande/fiche.php | 30 ++- htdocs/fourn/commande/note.php | 3 +- htdocs/fourn/fournisseur.commande.class.php | 193 ++++++++---------- htdocs/fourn/product/liste.php | 190 +++++++++-------- .../triggers/interface_notification.class.php | 13 ++ htdocs/langs/en_US/bills.lang | 5 +- htdocs/langs/en_US/mails.lang | 4 +- htdocs/langs/en_US/orders.lang | 6 +- htdocs/langs/fr_FR/bills.lang | 5 +- htdocs/langs/fr_FR/mails.lang | 4 +- htdocs/langs/fr_FR/orders.lang | 6 +- htdocs/lib/doleditor.class.php | 24 ++- htdocs/notify.class.php | 11 +- htdocs/product.class.php | 6 +- htdocs/product/stats/commande.php | 12 +- htdocs/product/stats/contrat.php | 4 +- htdocs/product/stats/facture.php | 14 +- htdocs/product/stats/fiche.php | 14 +- htdocs/product/stats/propal.php | 4 +- htdocs/product/stock/product.php | 9 +- htdocs/societe/notify/fiche.php | 1 + htdocs/translate.class.php | 17 +- htdocs/user.class.php | 35 +++- mysql/data/data.sql | 1 + mysql/migration/2.0.0-2.1.0.sql | 4 +- 26 files changed, 338 insertions(+), 278 deletions(-) diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index f6677d85a6c..11142b2b0ae 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -39,7 +39,6 @@ class Conf /** \public */ var $db; // Objet des caractéristiques de connexions // base db->host, db->name, db->user, db->pass, db->type - var $langage; // Langue choisie fr_FR, en_US, ... var $maxfilesize = 2000000; // Taille max des fichiers uploadés var $externalrss; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 9ef9f3ba118..4c9512f18d1 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -264,6 +264,7 @@ if ($_GET["id"] > 0) { $soc = new Societe($db); $soc->fetch($commande->socidp); + $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); @@ -291,7 +292,7 @@ if ($_GET["id"] > 0) */ if ($_GET["action"] == 'delete') { - $html->form_confirm("fiche.php?id=$commande->id","Supprimer la commande","Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete"); + $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DeleteOrder"),"Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete"); print '
'; } @@ -301,7 +302,27 @@ if ($_GET["id"] > 0) */ if ($_GET["action"] == 'valid') { - $html->form_confirm("fiche.php?id=$commande->id","Valider la commande","Etes-vous sûr de vouloir valider cette commande ?","confirm_valid"); + // on vérifie si la commande est en numérotation provisoire + $ref = substr($commande->ref, 1, 4); + if ($ref == 'PROV') + { + $newref = $commande->getNextNumRef($soc); + } + else + { + $newref = $commande->ref; + } + + $text=$langs->trans('ConfirmValidateOrder',$newref); + if ($conf->notification->enabled) + { + require_once(DOL_DOCUMENT_ROOT ."/notify.class.php"); + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage(3,$commande->socidp); + } + + $html->form_confirm("fiche.php?id=".$commande->id,$langs->trans("ValidateOrder"),$text,"confirm_valid"); print '
'; } /* @@ -351,7 +372,7 @@ if ($_GET["id"] > 0) // Ref print ''.$langs->trans("Ref").''; - print ''.$commande->ref.''; + print ''.$commande->ref.''; print ''; // Fournisseur @@ -386,7 +407,8 @@ if ($_GET["id"] > 0) } // Auteur - print ''.$langs->trans("Author").''.$author->fullname.''; + print ''.$langs->trans("AuthorRequest").''; + print ''.$author->getNomUrl(1).''; print ''; print " "; diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 5b7734a46d0..357b9d00ff9 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -140,7 +140,8 @@ if ($_GET["id"] > 0) } // Auteur - print ''.$langs->trans("Author").''.$author->fullname.''; + print ''.$langs->trans("AuthorRequest").''; + print ''.$author->getNomUrl(1).''; print ''; print " "; diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index be2e8e19a91..33274339b59 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -184,69 +184,39 @@ class CommandeFournisseur extends Commande */ function valid($user) { - dolibarr_syslog("CommandeFournisseur::Valid"); + dolibarr_syslog("CommandeFournisseur.class::Valid"); $result = 0; if ($user->rights->fournisseur->commande->valider) { - if (defined('COMMANDE_SUPPLIER_ADDON')) + $this->db->begin(); + + $num=$this->getNextNumRef($soc); + + $sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur SET ref='$num', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id"; + $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; + + $resql=$this->db->query($sql); + if ($resql) { - if (is_readable(DOL_DOCUMENT_ROOT .'/fourn/commande/modules/'.COMMANDE_SUPPLIER_ADDON.'.php')) - { - $this->db->begin(); - - require_once DOL_DOCUMENT_ROOT .'/fourn/commande/modules/'.COMMANDE_SUPPLIER_ADDON.'.php'; - - // Definition du nom de module de numerotation de commande fournisseur - - $modName=COMMANDE_SUPPLIER_ADDON; - - // Recuperation de la nouvelle reference - $objMod = new $modName($this->db); - $soc = new Societe($this->db); - $soc->fetch($this->socidp); - $num = $objMod->commande_get_num($soc); - - $sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur SET ref='$num', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id"; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - - $resql=$this->db->query($sql); - if ($resql) - { - $result = 1; - $this->log($user, 1, time()); - $this->ref = $num; + $result = 1; + $this->log($user, 1, time()); // Statut 1 + $this->ref = $num; - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); - // Fin appel triggers + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); + // Fin appel triggers - $this->_NotifyApprobator($user); // \todo a gerer par trigger - - dolibarr_syslog("CommandeFournisseur::valid Success"); - $this->db->begin(); - return 1; - } - else - { - $this->error=$this->db->error(); - dolibarr_syslog("CommandeFournisseur::valid ".$this->error); - $this->db->rollback(); - return -1; - } - } - else - { - $this->error='Impossible de lire le module de numérotation'; - dolibarr_syslog("CommandeFournisseur::valid ".$this->error); - return -1; - } + dolibarr_syslog("CommandeFournisseur::valid Success"); + $this->db->commit(); + return 1; } else { - $this->error='Le module de numérotation n\'est pas défini' ; + $this->error=$this->db->error(); dolibarr_syslog("CommandeFournisseur::valid ".$this->error); + $this->db->rollback(); return -1; } } @@ -370,64 +340,59 @@ class CommandeFournisseur extends Commande } - /* - * - * - */ - function _NotifyApprobator($user) - { - require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); - - $this->ReadApprobators(); - - if (sizeof($this->approbs) > 0) - { + /** + * \brief Renvoie la référence de commande suivante non utilisée en fonction du module + * de numérotation actif défini dans COMMANDE_SUPPLIER_ADDON + * \param soc objet societe + * \return string reference libre pour la facture + */ + function getNextNumRef($soc) + { + global $db, $langs; + $langs->load("orders"); - $this->_details_text(); + $dir = DOL_DOCUMENT_ROOT .'/fourn/commande/modules'; - $from = $user->email; - $subject = "Nouvelle commande en attente d'approbation réf : ".$this->ref; - - $message = "Bonjour,\n\n"; - $message .= "La commande ".$this->ref." validée par $user->fullname, est en attente de votre approbation.\n\n"; - - - $message .= $this->details_text; - - if (sizeof($this->approbs) > 1) - { - $message .= "\nCette demande d'approbation a été envoyée à :\n"; - - foreach($this->approbs as $approb) - { - if (strlen($approb[2])) - { - $message .= "- $approb[0] $approb[1] <$approb[2]>\n"; - } - } - } - - $message .= "\nCordialement,\n\n"; - $message .="--\n(message automatique envoyé par Dolibarr)"; + if (defined('COMMANDE_SUPPLIER_ADDON')) + { + $file = COMMANDE_SUPPLIER_ADDON.'.php'; + + if (is_readable($dir.'/'.$file)) + { + // Definition du nom de module de numerotation de commande fournisseur + $modName=COMMANDE_SUPPLIER_ADDON; + require_once($dir.'/'.$file); - foreach($this->approbs as $approb) - { + // Recuperation de la nouvelle reference + $objMod = new $modName($this->db); - $sendto = $approb[2]; - - $mailfile = new CMailFile($subject, - $sendto, - $from, - $message, array(), array(), array()); - if ( $mailfile->sendfile() ) - { - - } - } - } - } - - /** + $numref = ""; + $numref = $objMod->commande_get_num($soc,$this); + + if ( $numref != "") + { + return $numref; + } + else + { + dolibarr_print_error($db,"Facture::getNextNumRef ".$obj->error); + return -1; + } + } + else + { + print $langs->trans("Error")." ".$langs->trans("FailedToLoadCOMMANDE_SUPPLIER_ADDONFile"); + return -2; + } + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_NotDefined"); + return -3; + } + } + + /** * \brief Approuve une commande * */ @@ -443,15 +408,23 @@ class CommandeFournisseur extends Commande if ($this->db->query($sql) ) { $result = 0; - $this->log($user, 2, time()); + $this->log($user, 2, time()); // Statut 2 + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf); + // Fin appel triggers + $subject = "Votre commande ".$this->ref." a été approuvée"; $message = "Bonjour,\n\n"; $message .= "Votre commande ".$this->ref." a été approuvée, par $user->fullname"; $message .= "\n\nCordialement,\n\n"; - $this->_NotifyCreator($user, $subject, $message); - + + dolibarr_syslog("CommandeFournisseur::valid Success"); + $this->db->commit(); + return 1; } else { diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php index 9b7d2724c17..4af79500682 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -80,12 +79,10 @@ $sql .= ", pf.fk_soc"; $sql .= ", min(ppf.price) as price"; $sql .= ", s.nom"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - if ($catid) { $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; } - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = pf.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON ppf.fk_soc = pf.fk_soc AND ppf.fk_product = p.rowid AND ppf.quantity = 1"; @@ -117,7 +114,6 @@ else } } - if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = $fourn_id"; @@ -126,115 +122,115 @@ $sql .= " GROUP BY p.rowid"; $sql .= " ORDER BY $sortfield $sortorder "; $sql .= $db->plimit($limit + 1 ,$offset); +dolibarr_syslog("fourn/product/liste: sql=$sql"); + $resql = $db->query($sql) ; if ($resql) { - $num = $db->num_rows($resql); - - $i = 0; - - if ($num == 1 && (isset($_POST["sall"]) or $snom or $sref)) - { - $objp = $db->fetch_object($resql); - Header("Location: fiche.php?id=$objp->rowid"); - } - - $texte = $langs->trans("List"); - + $num = $db->num_rows($resql); + $i = 0; - llxHeader("","",$texte); - - if ($sref || $snom || $_POST["sall"] || $_POST["search"]) - { - print_barre_liste($texte, $page, "liste.php", "&sref=".$sref."&snom=".$snom, $sortfield, $sortorder,'',$num); - } - else - { - print_barre_liste($texte, $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num); - } - - - if (isset($catid)) - { - print "
"; - $c = new Categorie ($db, $catid); - $ways = $c->print_all_ways(' > ','fourn/product/liste.php'); - print " > ".$ways[0]."
\n"; - print "

"; - } - - - print ''; - - // Lignes des titres - print ""; - print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield); - print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield); - print_liste_field_titre($langs->trans("Supplier"),"liste.php", "pf.fk_soc","","","",$sortfield); - print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield); - print "\n"; - - // Lignes des champs de filtre - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $oldid = ''; - $var=True; - while ($i < min($num,$limit)) - { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - - if ($oldid <> $objp->rowid) + if ($num == 1 && ( isset($_POST["sall"]) || $snom || $sref ) ) { - $oldid = $objp->rowid; - print "\n"; - print "\n"; - } - else - { - print ''; + $objp = $db->fetch_object($resql); + Header("Location: fiche.php?id=".$objp->rowid); + exit; } - print ''; - print ''; - print "\n"; - $i++; - } - $db->free($resql); + $texte = $langs->trans("List"); + llxHeader("","",$texte); - print "
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '  '; - print '
rowid\">"; - if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service"); - else print img_object($langs->trans("ShowProduct"),"product"); - print " "; - print "rowid\">$objp->ref$objp->label '.$objp->nom.''.price($objp->price).'
"; + if ($sref || $snom || $_POST["sall"] || $_POST["search"]) + { + print_barre_liste($texte, $page, "liste.php", "&sref=".$sref."&snom=".$snom, $sortfield, $sortorder,'',$num); + } + else + { + print_barre_liste($texte, $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num); + } + + + if (isset($catid)) + { + print "
"; + $c = new Categorie ($db, $catid); + $ways = $c->print_all_ways(' > ','fourn/product/liste.php'); + print " > ".$ways[0]."
\n"; + print "

"; + } + + + print ''; + + // Lignes des titres + print ""; + print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield); + print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield); + print_liste_field_titre($langs->trans("Supplier"),"liste.php", "pf.fk_soc","","","",$sortfield); + print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield); + print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $oldid = ''; + $var=True; + while ($i < min($num,$limit)) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + + if ($oldid <> $objp->rowid) + { + $oldid = $objp->rowid; + print ''; + print "\n"; + } + else + { + print ''; + } + + print ''; + print ''; + print "\n"; + $i++; + } + $db->free($resql); + + print "
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '  '; + print '
'; + if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service"); + else print img_object($langs->trans("ShowProduct"),"product"); + print " "; + print ''.$objp->ref.'$objp->label '.$objp->nom.''.price($objp->price).'
"; } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/includes/triggers/interface_notification.class.php b/htdocs/includes/triggers/interface_notification.class.php index 02a60074036..95ba73d0ed4 100644 --- a/htdocs/includes/triggers/interface_notification.class.php +++ b/htdocs/includes/triggers/interface_notification.class.php @@ -125,6 +125,19 @@ class InterfaceNotification $notify->send($action_notify, $object->socidp, $mesg, 'ficheinter', $object->id, $filepdf); } + if ($action == 'ORDER_SUPPLIER_VALIDATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); + + $action_notify = 3; + $ref = sanitize_string($object->ref); + $filepdf = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + $mesg = 'La commande fournisseur '.$object->ref." a été validée.\n"; + + $notify = new Notify($this->db); + $notify->send($action_notify, $object->socidp, $mesg, 'order_supplier', $object->id, $filepdf); + } + return 0; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ab673553876..ea49990b2bf 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -8,12 +8,15 @@ BillsCustomersUnpayedForCompany=Unpayed customers' invoices for %s BillsSuppliersUnpayed=Unpayed suppliers' invoices BillsUnpayed=Unpayed BillsStatistics=Invoices statistics +CardBill=Invoice card Invoice=Invoice Invoices=Invoices InvoiceLine=Invoice line InvoiceCustomer=Customer invoice -CardBill=Invoice card +CustomerInvoice=Customer invoice +CustomersInvoices=Customers' invoices SupplierInvoice=Supplier invoice +SuppliersInvoices=Suppliers' invoices SupplierBill=Supplier invoice SupplierBills=suppliers invoices BillContacts=Invoice contacts diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 84ad30f8123..94c266ef831 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -79,4 +79,6 @@ DeliveryReceipt=Delivery Receipt Notifications=Notifications NoNotificationsWillBeSent=No email notifications are planned for this event and company ANotificationsWillBeSent=1 notification will be sent by email -SomeNotificationsWillBeSent=%s notifications will be sent by email \ No newline at end of file +SomeNotificationsWillBeSent=%s notifications will be sent by email +AddNewNotification=Activate a new notification request +ListOfActiveNotifications=List all active notifications requests \ No newline at end of file diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 0baee5ce837..dcaf3b74fe2 100755 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -21,12 +21,15 @@ StatusOrderValidatedShort=Validated StatusOrderOnProcessShort=On process StatusOrderProcessedShort=Processed StatusOrderToBillShort=To bill +StatusOrderApprovedShort=Approved StatusOrderCanceled=Canceld StatusOrderDraft=Draft (need to be validated) StatusOrderValidated=Validated StatusOrderOnProcess=On process StatusOrderProcessed=Processed StatusOrderToBill=To bill +StatusOrderApproved=Approved +DraftOrWaitingApproved=Draft or approved not yet ordered MenuOrdersToBill=Orders to bill SearchOrder=Search order Sending=Sending @@ -59,7 +62,7 @@ CloseOrder=Close order ConfirmCloseOrder=Are you sure you want to close this order ? Once an order is closed, it can only be billed. ConfirmCloseOrderIfSending=Are you sure you want to close this order ? You must close an order only when all shipping are done. ConfirmDeleteOrder=Are you sure you want to delete this order ? -ConfirmValidateOrder=Are you sure you want to validate this order ? +ConfirmValidateOrder=Are you sure you want to validate this order under name %s ? ConfirmCancelOrder=Are you sure you want to cancel this order ? GenerateBill=Generate invoice ClassifyBilled=Classify "Billed" @@ -75,6 +78,7 @@ SendOrderByMail=Send order by mail ActionsOnOrder=Actions on order NoArticleOfTypeProduct=No article of type 'product' so no shippable article for this order OrderMode=Order method +AuthorRequest=Request author # Sources OrderSource0=Commercial proposal OrderSource1=Internet diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 9859f99cc9a..77619cbb1c7 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -8,12 +8,15 @@ BillsCustomersUnpayedForCompany=Factures clients impay BillsSuppliersUnpayed=Factures fournisseurs impayées BillsUnpayed=Impayées BillsStatistics=Statistiques factures +CardBill=Fiche facture Invoice=Facture Invoices=Factures InvoiceLine=Ligne de facture InvoiceCustomer=Facture client -CardBill=Fiche facture +CustomerInvoice=Facture client +CustomersInvoices=Factures clients SupplierInvoice=Facture fournisseur +SuppliersInvoices=Factures fournisseurs SupplierBill=Facture fournisseur SupplierBills=Factures fournisseurs BillContacts=Contacts facture diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 19287f6049f..3bff1788cc5 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -79,4 +79,6 @@ DeliveryReceipt=Accus Notifications=Notifications NoNotificationsWillBeSent=Aucune notification par email n'est prévue pour cet évenement et société ANotificationsWillBeSent=1 notification va être envoyée par mail -SomeNotificationsWillBeSent=%s notifications vont être envoyées par mail \ No newline at end of file +SomeNotificationsWillBeSent=%s notifications vont être envoyées par mail +AddNewNotification=Activer une nouvelle demande de notification +ListOfActiveNotifications=Liste des demandes de notifications actives \ No newline at end of file diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 6a69d825826..971f2415d0c 100755 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -21,12 +21,15 @@ StatusOrderValidatedShort=Valid StatusOrderOnProcessShort=En cours StatusOrderProcessedShort=Traitée StatusOrderToBillShort=À facturer +StatusOrderApprovedShort=Approuvé StatusOrderCanceled=Annulée StatusOrderDraft=Brouillon (à valider) StatusOrderValidated=Validée StatusOrderOnProcess=Traitement en cours StatusOrderProcessed=Traitée StatusOrderToBill=À facturer +StatusOrderApprovedShort=Approuvé +DraftOrWaitingApproved=Brouillon ou approuvée pas encore commandée SearchOrder=Rechercher une commande MenuOrdersToBill=Commandes à facturer Sending=Expédition @@ -59,7 +62,7 @@ CloseOrder=Cloturer commande ConfirmCloseOrder=Êtes-vous sur de vouloir cloturer cette commande ? Une fois une commande cloturée, elle doit être facturée. ConfirmCloseOrderIfSending=Êtes-vous sur de vouloir cloturer cette commande ? Vous ne devez cloturer une commande qu'une fois les produits expédiés. ConfirmDeleteOrder=Êtes-vous sur de vouloir effacer cette commande ? -ConfirmValidateOrder=Êtes-vous sur de vouloir valider cette commande ? +ConfirmValidateOrder=Êtes-vous sur de vouloir valider cette commande sous la référence %s ? ConfirmCancelOrder=Êtes-vous sur de vouloir annuler cette commande ? GenerateBill=Facturer ClassifyBilled=Classer "Facturée" @@ -75,6 +78,7 @@ SendOrderByMail=Envoi commande par mail ActionsOnOrder=Actions sur la commande NoArticleOfTypeProduct=Pas d'article de type 'produit' et donc expédiable dans cette commande OrderMode=Méthode de commande +AuthorRequest=Auteur/Demandeur # Sources OrderSource0=Proposition commerciale OrderSource1=Internet diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php index 9fea58ebd0c..aca46c2f314 100644 --- a/htdocs/lib/doleditor.class.php +++ b/htdocs/lib/doleditor.class.php @@ -41,18 +41,18 @@ class DolEditor /** \brief DolEditor - \param htmlname Nom formulaire html WYSIWIG - \param content Contenu édition WYSIWIG - \param height Hauteur en pixel de la zone édition + \param htmlname Nom formulaire html WYSIWIG + \param content Contenu édition WYSIWIG + \param height Hauteur en pixel de la zone édition \param toolbarname Nom barre de menu éditeur - \param toolbarlocation Emplacement de la barre de menu : - 'In' chaque fenêtre d'édition a ça propre barre d'outils - 'Out:nom' partage de la barre d'outils où 'nom' est le nom du DIV qui affiche la barre - \param toolbarstartexpanded visible ou non au démarrage + \param toolbarlocation Emplacement de la barre de menu : + 'In' chaque fenêtre d'édition a ça propre barre d'outils + 'Out:nom' partage de la barre d'outils où 'nom' est le nom du DIV qui affiche la barre + \param toolbarstartexpanded visible ou non au démarrage */ function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false) { - global $conf; + global $conf,$langs; dolibarr_syslog("DolEditor::DolEditor"); @@ -62,11 +62,15 @@ class DolEditor $this->editor->Height = $height; if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js')) { - $this->editor->Config["CustomConfigurationsPath"] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'; + $this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'; $this->editor->ToolbarSet = $toolbarname; - $this->editor->Config[ 'ToolbarLocation' ] = $toolbarlocation ; + $this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In'; $this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded; $this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/'; +// if ($langs->origlang=='auto') +// { + $this->editor->Config['AutoDetectLanguage'] = 'true'; +// } } } diff --git a/htdocs/notify.class.php b/htdocs/notify.class.php index adf517f2dca..02bd2e07989 100644 --- a/htdocs/notify.class.php +++ b/htdocs/notify.class.php @@ -86,11 +86,12 @@ class Notify { $num=-1; - $sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action"; - $sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action; - $sql .= " AND s.idp = ".$socid; + $sql = "SELECT n.rowid, c.email, c.idp, c.name, c.firstname, a.titre, s.nom"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action"; + $sql.= " AND n.fk_soc = s.idp"; + $sql.= " AND n.fk_action = ".$action; + $sql.= " AND s.idp = ".$socid; dolibarr_syslog("Notify.class::countDefinedNotifications $action, $socid"); diff --git a/htdocs/product.class.php b/htdocs/product.class.php index e6876641928..c3f62bb76b7 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -1009,7 +1009,7 @@ class Product /** * \brief Charge tableau des stats commande fournisseur pour le produit/service * \param socid Id societe pour filtrer sur une société - * \param filtrestatut Id statut pour filtrer sur un statut + * \param filtrestatut Id des statuts pour filtrer sur des statuts * \return array Tableau des stats */ function load_stats_commande_fournisseur($socid=0,$filtrestatut='') @@ -1027,9 +1027,9 @@ class Product { $sql.= " AND c.fk_soc = ".$socid; } - if ($filtrestatut) + if ($filtrestatut != '') // Peut valoir 0 { - $sql.= " AND c.fk_statut = ".$filtrestatut; + $sql.= " AND c.fk_statut in (".$filtrestatut.")"; } $result = $this->db->query($sql) ; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 9609649d3ef..4af885e4fdd 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -136,14 +136,14 @@ if ($_GET["id"] || $_GET["ref"]) print ''; print ''; } - // Commandes + // Commandes clients if ($conf->commande->enabled) { $ret=$product->load_stats_commande($socidp); if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print ''; - print ''.img_object('','order').' '.$langs->trans("Orders").''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -177,7 +177,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print ''; - print ''.img_object('','bill').' '.$langs->trans("Bills").''; + print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; @@ -194,7 +194,7 @@ if ($_GET["id"] || $_GET["ref"]) $sql = "SELECT distinct(s.nom), s.idp, s.code_client, c.rowid, c.total_ht as amount, c.ref,"; - $sql.= " ".$db->pdate("c.date_creation")." as date, c.fk_statut as statut, c.rowid as commandeid"; + $sql.= " ".$db->pdate("c.date_creation")." as date, c.fk_statut as statut, c.facture, c.rowid as commandeid"; if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."commandedet as d"; if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -213,7 +213,7 @@ if ($_GET["id"] || $_GET["ref"]) { $num = $db->num_rows($result); - print_barre_liste($langs->trans("Orders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num); $i = 0; print ""; @@ -246,7 +246,7 @@ if ($_GET["id"] || $_GET["ref"]) print ""; print "\n"; - print ''; + print ''; print "\n"; $i++; } diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 88680f0e3e3..48efdcdcf17 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -142,7 +142,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; // Propals @@ -137,7 +137,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print '
"; print dolibarr_print_date($objp->date)."".price($objp->amount)."'.$commandestatic->LibStatut($objp->statut,5).''.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'
'; - print ''.img_object('','order').' '.$langs->trans("Orders").''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -176,7 +176,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print '
'; - print ''.img_object('','bill').' '.$langs->trans("Bills").''; + print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 37b584e73bb..725b40e2a60 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -107,10 +107,10 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print '
'.$langs->trans("Referers").''.$langs->trans("NbOfCustomers").''.$langs->trans("NbOfReferers").''.$langs->trans("TotalQuantity").'
'.$langs->trans("Referers").''.$langs->trans("NbOfCustomers").''.$langs->trans("NbOfReferers").''.$langs->trans("TotalQuantity").'
'; - print ''.img_object('','order').' '.$langs->trans("Orders").''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -171,7 +171,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print '
'; - print ''.img_object('','bill').' '.$langs->trans("Bills").''; + print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; @@ -207,7 +207,7 @@ if ($_GET["id"] || $_GET["ref"]) { $num = $db->num_rows($result); - print_barre_liste($langs->trans("Bills"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num); $i = 0; print ""; diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index 938937b8e6e..d44296c2b41 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -132,7 +132,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; // Propals @@ -182,7 +182,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print ''; - print ''; print ''; } diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 862e29bc8ed..31ef77e4cd3 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -32,6 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); $langs->load("companies"); +$langs->load("mails"); $user->getrights('commercial'); diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index b6d3e59e995..361f4177057 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -34,7 +34,8 @@ class Translate { var $dir; - var $defaultlang; + var $origlang; // Langue origine + var $defaultlang; // Langue courante en vigueur de l'utilisateur var $tab_loaded=array(); // Tableau pour signaler les fichiers deja chargés var $tab_translate=array(); // Tableau des traductions @@ -81,11 +82,13 @@ class Translate { /** * \brief Accesseur de this->defaultlang - * \param defaultlang Langue par defaut à utiliser + * \param srclang Langue à utiliser */ - function setDefaultLang($defaultlang='fr_FR') + function setDefaultLang($srclang='fr_FR') { - if ($defaultlang == 'auto') + $this->origlang=$srclang; + + if ($srclang == 'auto') { $langpref=$_SERVER['HTTP_ACCEPT_LANGUAGE']; $langpref=eregi_replace(";[^,]*","",$langpref); @@ -95,11 +98,11 @@ class Translate { $langpart=split("_",$langlist[0]); - if (isset($langpart[1])) $defaultlang=strtolower($langpart[0])."_".strtoupper($langpart[1]); - else $defaultlang=strtolower($langpart[0])."_".strtoupper($langpart[0]); + if (isset($langpart[1])) $srclang=strtolower($langpart[0])."_".strtoupper($langpart[1]); + else $srclang=strtolower($langpart[0])."_".strtoupper($langpart[0]); } - $this->defaultlang=$defaultlang; + $this->defaultlang=$srclang; } diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 5d8439faae6..fe56f2de19a 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -1031,10 +1031,10 @@ class User $result = $this->db->query($sql); } - /** - * \brief Retire l'utilisateur d'un groupe - * \param group id du groupe - */ + /** + * \brief Retire l'utilisateur d'un groupe + * \param group id du groupe + */ function RemoveFromGroup($group) { @@ -1044,7 +1044,32 @@ class User $result = $this->db->query($sql); } - + + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto Inclut le picto dans le lien + * \param option Sur quoi pointe le lien + * \return string Chaine avec URL + */ + function getNomUrl($withpicto=0,$option='') + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + if ($option == 'xxx') + { + $lien = ''; + $lienfin=''; + } + + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin.' '); + $result.=$lien.$this->nom.' '.$this->prenom.$lienfin; + return $result; + } } ?> diff --git a/mysql/data/data.sql b/mysql/data/data.sql index b33e86f160e..72ef70d86f5 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -52,6 +52,7 @@ insert into llx_sqltables (name, loaded) values ('llx_album',0); delete from llx_action_def; insert into llx_action_def (rowid,code,titre,description,objet_type) values (1,'NOTIFY_VAL_FICHINTER','Validation fiche intervention','Déclenché lors de la validation d\'une fiche d\'intervention','ficheinter'); insert into llx_action_def (rowid,code,titre,description,objet_type) values (2,'NOTIFY_VAL_FAC','Validation facture','Déclenché lors de la validation d\'une facture','facture'); +insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_VAL_ORDER_SUUPLIER','Validation commande fournisseur','Déclenché lors de la validation d\'une commande fournisseur','order_supplier'); -- -- Constantes de configuration diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index d1f192279eb..129dd4f947b 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -334,4 +334,6 @@ alter table llx_commande drop column fk_soc_contact; alter table llx_livraison drop column fk_soc_contact; alter table llx_propal drop column fk_soc_contact; -alter table llx_c_pays modify libelle varchar(50) NOT NULL; \ No newline at end of file +alter table llx_c_pays modify libelle varchar(50) NOT NULL; + +insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_VAL_ORDER_SUUPLIER','Validation commande fournisseur','Déclenché lors de la validation d\'une commande fournisseur','order_supplier');
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; $product->load_previous_next_ref(); $previous_ref = $product->ref_previous?''.img_previous().'':''; $next_ref = $product->ref_next?''.img_next().'':''; @@ -152,10 +152,10 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print '
'.$langs->trans("Referers").''.$langs->trans("NbOfCustomers").''.$langs->trans("NbOfReferers").''.$langs->trans("TotalQuantity").'
'.$langs->trans("Referers").''.$langs->trans("NbOfCustomers").''.$langs->trans("NbOfReferers").''.$langs->trans("TotalQuantity").'
'; - print ''.img_object('','order').' '.$langs->trans("Orders").''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -216,7 +216,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print '
'; - print ''.img_object('','bill').' '.$langs->trans("Bills").''; + print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index e5cf6785fdc..549db179183 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -141,7 +141,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print '
'; - print ''.img_object('','order').' '.$langs->trans("Orders").''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -175,7 +175,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print '
'; - print ''.img_object('','bill').' '.$langs->trans("Bills").''; + print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 454cd4a1813..a75de643cdd 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -35,6 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("products"); +$langs->load("orders"); $langs->load("bills"); $user->getrights('produit'); @@ -119,7 +120,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print '
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; $product->load_previous_next_ref(); $previous_ref = $product->ref_previous?''.img_previous().'':''; $next_ref = $product->ref_next?''.img_next().'':''; @@ -179,14 +180,14 @@ if ($_GET["id"] || $_GET["ref"]) // Nbre de commande fournisseurs en cours if ($conf->fournisseur->enabled) { - $result=$product->load_stats_commande_fournisseur(0,'1'); + $result=$product->load_stats_commande_fournisseur(0,'2'); if ($result < 0) dolibarr_print_error($db,$product->error); print '
'.$langs->trans("SuppliersOrders").''; print $product->stats_commande_fournisseur['qty']; - $result=$product->load_stats_commande_fournisseur(0,'0'); + $result=$product->load_stats_commande_fournisseur(0,'0,1'); if ($result < 0) dolibarr_print_error($db,$product->error); - print ' ('.$langs->trans("Draft").': '.$product->stats_commande_fournisseur['qty'].')'; + print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')'; print '