2
0
forked from Wavyzz/dolibarr

Fix: Comptage des commandes en cours sur le stock.

Qual: Uniformatisation de code des commandes fournisseurs
This commit is contained in:
Laurent Destailleur
2006-08-07 02:20:57 +00:00
parent 14cae5a73a
commit d7341f59e0
26 changed files with 338 additions and 278 deletions

View File

@@ -39,7 +39,6 @@ class Conf
/** \public */
var $db; // Objet des caract<63>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<61>s
var $externalrss;

View File

@@ -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 '<br />';
}
@@ -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<75>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.='<br>';
$text.=$notify->confirmMessage(3,$commande->socidp);
}
$html->form_confirm("fiche.php?id=".$commande->id,$langs->trans("ValidateOrder"),$text,"confirm_valid");
print '<br />';
}
/*
@@ -351,7 +372,7 @@ if ($_GET["id"] > 0)
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '<td colspan="5">'.$commande->ref.'</td>';
print '</tr>';
// Fournisseur
@@ -386,7 +407,8 @@ if ($_GET["id"] > 0)
}
// Auteur
print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>';
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '<td colspan="3" width="50%">';
print "&nbsp;</td></tr>";

View File

@@ -140,7 +140,8 @@ if ($_GET["id"] > 0)
}
// Auteur
print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>';
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '<td width="50%">';
print "&nbsp;</td></tr>";

View File

@@ -184,27 +184,13 @@ 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'))
{
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);
$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 ;";
@@ -213,7 +199,7 @@ class CommandeFournisseur extends Commande
if ($resql)
{
$result = 1;
$this->log($user, 1, time());
$this->log($user, 1, time()); // Statut 1
$this->ref = $num;
// Appel des triggers
@@ -222,10 +208,8 @@ class CommandeFournisseur extends Commande
$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();
$this->db->commit();
return 1;
}
else
@@ -237,20 +221,6 @@ class CommandeFournisseur extends Commande
}
}
else
{
$this->error='Impossible de lire le module de num<75>rotation';
dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
return -1;
}
}
else
{
$this->error='Le module de num<75>rotation n\'est pas d<>fini' ;
dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
return -1;
}
}
else
{
$this->error='Not Authorized';
dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
@@ -370,60 +340,55 @@ class CommandeFournisseur extends Commande
}
/*
*
*
/**
* \brief Renvoie la r<>f<EFBFBD>rence de commande suivante non utilis<69>e en fonction du module
* de num<75>rotation actif d<>fini dans COMMANDE_SUPPLIER_ADDON
* \param soc objet societe
* \return string reference libre pour la facture
*/
function _NotifyApprobator($user)
function getNextNumRef($soc)
{
require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
global $db, $langs;
$langs->load("orders");
$this->ReadApprobators();
$dir = DOL_DOCUMENT_ROOT .'/fourn/commande/modules';
if (sizeof($this->approbs) > 0)
if (defined('COMMANDE_SUPPLIER_ADDON'))
{
$file = COMMANDE_SUPPLIER_ADDON.'.php';
$this->_details_text();
$from = $user->email;
$subject = "Nouvelle commande en attente d'approbation r<>f : ".$this->ref;
$message = "Bonjour,\n\n";
$message .= "La commande ".$this->ref." valid<69>e par $user->fullname, est en attente de votre approbation.\n\n";
$message .= $this->details_text;
if (sizeof($this->approbs) > 1)
if (is_readable($dir.'/'.$file))
{
$message .= "\nCette demande d'approbation a <20>t<EFBFBD> envoy<6F>e <20> :\n";
// 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);
$numref = "";
$numref = $objMod->commande_get_num($soc,$this);
if ( $numref != "")
{
if (strlen($approb[2]))
return $numref;
}
else
{
$message .= "- $approb[0] $approb[1] <$approb[2]>\n";
dolibarr_print_error($db,"Facture::getNextNumRef ".$obj->error);
return -1;
}
}
}
$message .= "\nCordialement,\n\n";
$message .="--\n(message automatique envoy<6F> par Dolibarr)";
foreach($this->approbs as $approb)
else
{
$sendto = $approb[2];
$mailfile = new CMailFile($subject,
$sendto,
$from,
$message, array(), array(), array());
if ( $mailfile->sendfile() )
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;
}
}
@@ -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 <20>t<EFBFBD> approuv<75>e";
$message = "Bonjour,\n\n";
$message .= "Votre commande ".$this->ref." a <20>t<EFBFBD> approuv<75>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
{

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2006 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
@@ -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,6 +122,8 @@ $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)
{
@@ -133,16 +131,14 @@ if ($resql)
$i = 0;
if ($num == 1 && (isset($_POST["sall"]) or $snom or $sref))
if ($num == 1 && ( isset($_POST["sall"]) || $snom || $sref ) )
{
$objp = $db->fetch_object($resql);
Header("Location: fiche.php?id=$objp->rowid");
Header("Location: fiche.php?id=".$objp->rowid);
exit;
}
$texte = $langs->trans("List");
llxHeader("","",$texte);
if ($sref || $snom || $_POST["sall"] || $_POST["search"])
@@ -198,18 +194,18 @@ if ($resql)
$var=True;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object( $i);
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
if ($oldid <> $objp->rowid)
{
$oldid = $objp->rowid;
print "<td><a href=\"../../product/fiche.php?id=$objp->rowid\">";
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->rowid.'">';
if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service");
else print img_object($langs->trans("ShowProduct"),"product");
print "</a> ";
print "<a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->rowid.'">'.$objp->ref.'</a></td>';
print "<td>$objp->label</td>\n";
}
else
@@ -236,5 +232,5 @@ else
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -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 <20>t<EFBFBD> valid<69>e.\n";
$notify = new Notify($this->db);
$notify->send($action_notify, $object->socidp, $mesg, 'order_supplier', $object->id, $filepdf);
}
return 0;
}

View File

@@ -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

View File

@@ -80,3 +80,5 @@ 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
AddNewNotification=Activate a new notification request
ListOfActiveNotifications=List all active notifications requests

View File

@@ -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

View File

@@ -8,12 +8,15 @@ BillsCustomersUnpayedForCompany=Factures clients impay
BillsSuppliersUnpayed=Factures fournisseurs impay<61>es
BillsUnpayed=Impay<61>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

View File

@@ -80,3 +80,5 @@ Notifications=Notifications
NoNotificationsWillBeSent=Aucune notification par email n'est pr<70>vue pour cet <20>venement et soci<63>t<EFBFBD>
ANotificationsWillBeSent=1 notification va <20>tre envoy<6F>e par mail
SomeNotificationsWillBeSent=%s notifications vont <20>tre envoy<6F>es par mail
AddNewNotification=Activer une nouvelle demande de notification
ListOfActiveNotifications=Liste des demandes de notifications actives

View File

@@ -21,12 +21,15 @@ StatusOrderValidatedShort=Valid
StatusOrderOnProcessShort=En cours
StatusOrderProcessedShort=Trait<69>e
StatusOrderToBillShort=<3D> facturer
StatusOrderApprovedShort=Approuv<75>
StatusOrderCanceled=Annul<75>e
StatusOrderDraft=Brouillon (<28> valider)
StatusOrderValidated=Valid<69>e
StatusOrderOnProcess=Traitement en cours
StatusOrderProcessed=Trait<69>e
StatusOrderToBill=<3D> facturer
StatusOrderApprovedShort=Approuv<75>
DraftOrWaitingApproved=Brouillon ou approuv<75>e pas encore command<6E>e
SearchOrder=Rechercher une commande
MenuOrdersToBill=Commandes <20> facturer
Sending=Exp<78>dition
@@ -59,7 +62,7 @@ CloseOrder=Cloturer commande
ConfirmCloseOrder=<3D>tes-vous sur de vouloir cloturer cette commande ? Une fois une commande clotur<75>e, elle doit <20>tre factur<75>e.
ConfirmCloseOrderIfSending=<3D>tes-vous sur de vouloir cloturer cette commande ? Vous ne devez cloturer une commande qu'une fois les produits exp<78>di<64>s.
ConfirmDeleteOrder=<3D>tes-vous sur de vouloir effacer cette commande ?
ConfirmValidateOrder=<3D>tes-vous sur de vouloir valider cette commande ?
ConfirmValidateOrder=<3D>tes-vous sur de vouloir valider cette commande sous la r<>f<EFBFBD>rence %s ?
ConfirmCancelOrder=<3D>tes-vous sur de vouloir annuler cette commande ?
GenerateBill=Facturer
ClassifyBilled=Classer "Factur<75>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<78>diable dans cette commande
OrderMode=M<>thode de commande
AuthorRequest=Auteur/Demandeur
# Sources
OrderSource0=Proposition commerciale
OrderSource1=Internet

View File

@@ -52,7 +52,7 @@ class DolEditor
*/
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';
// }
}
}

View File

@@ -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");

View File

@@ -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<63>t<EFBFBD>
* \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) ;

View File

@@ -136,14 +136,14 @@ if ($_GET["id"] || $_GET["ref"])
print '</td>';
print '</tr>';
}
// Commandes
// Commandes clients
if ($conf->commande->enabled)
{
$ret=$product->load_stats_commande($socidp);
if ($ret < 0) dolibarr_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("Orders").'</a>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
print '</td><td align="right">';
print $product->stats_commande['customers'];
print '</td><td align="right">';
@@ -177,7 +177,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("bills");
print '<tr><td>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("Bills").'</a>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
print '</td><td align="right">';
print $product->stats_facture['customers'];
print '</td><td align="right">';
@@ -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"],"&amp;id=$product->id",$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&amp;id=$product->id",$sortfield,$sortorder,'',$num);
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
@@ -246,7 +246,7 @@ if ($_GET["id"] || $_GET["ref"])
print "<td align=\"center\">";
print dolibarr_print_date($objp->date)."</td>";
print "<td align=\"right\">".price($objp->amount)."</td>\n";
print '<td align="right">'.$commandestatic->LibStatut($objp->statut,5).'</td>';
print '<td align="right">'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
print "</tr>\n";
$i++;
}

View File

@@ -142,7 +142,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("Orders").'</a>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
print '</td><td align="right">';
print $product->stats_commande['customers'];
print '</td><td align="right">';
@@ -176,7 +176,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("bills");
print '<tr><td>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("Bills").'</a>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
print '</td><td align="right">';
print $product->stats_facture['customers'];
print '</td><td align="right">';

View File

@@ -107,10 +107,10 @@ if ($_GET["id"] || $_GET["ref"])
print $product->getLibStatut(2);
print '</td></tr>';
print '<tr><td valign="top" width="28%">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="24%">'.$langs->trans("NbOfCustomers").'</td>';
print '<td align="right" width="24%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="24%">'.$langs->trans("TotalQuantity").'</td>';
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>';
// Propals
@@ -137,7 +137,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("Orders").'</a>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
print '</td><td align="right">';
print $product->stats_commande['customers'];
print '</td><td align="right">';
@@ -171,7 +171,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("bills");
print '<tr><td>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("Bills").'</a>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
print '</td><td align="right">';
print $product->stats_facture['customers'];
print '</td><td align="right">';
@@ -207,7 +207,7 @@ if ($_GET["id"] || $_GET["ref"])
{
$num = $db->num_rows($result);
print_barre_liste($langs->trans("Bills"),$page,$_SERVER["PHP_SELF"],"&amp;id=$product->id",$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&amp;id=$product->id",$sortfield,$sortorder,'',$num);
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";

View File

@@ -132,7 +132,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="28%">'.$langs->trans("Ref").'</td><td colspan="3">';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
@@ -152,10 +152,10 @@ if ($_GET["id"] || $_GET["ref"])
print $product->getLibStatut(2);
print '</td></tr>';
print '<tr><td valign="top" width="28%">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="24%">'.$langs->trans("NbOfCustomers").'</td>';
print '<td align="right" width="24%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="24%">'.$langs->trans("TotalQuantity").'</td>';
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>';
// Propals
@@ -182,7 +182,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("Orders").'</a>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
print '</td><td align="right">';
print $product->stats_commande['customers'];
print '</td><td align="right">';
@@ -216,7 +216,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("bills");
print '<tr><td>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("Bills").'</a>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
print '</td><td align="right">';
print $product->stats_facture['customers'];
print '</td><td align="right">';

View File

@@ -141,7 +141,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("Orders").'</a>';
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
print '</td><td align="right">';
print $product->stats_commande['customers'];
print '</td><td align="right">';
@@ -175,7 +175,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($ret < 0) dolibarr_print_error($db);
$langs->load("bills");
print '<tr><td>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("Bills").'</a>';
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
print '</td><td align="right">';
print $product->stats_facture['customers'];
print '</td><td align="right">';

View File

@@ -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 '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
@@ -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 '<tr><td>'.$langs->trans("SuppliersOrders").'</td>';
print '<td>';
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 '</td></tr>';
}

View File

@@ -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');

View File

@@ -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<72>s
var $tab_translate=array(); // Tableau des traductions
@@ -81,11 +82,13 @@ class Translate {
/**
* \brief Accesseur de this->defaultlang
* \param defaultlang Langue par defaut <EFBFBD> utiliser
* \param srclang Langue <20> 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;
}

View File

@@ -1045,6 +1045,31 @@ 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 = '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
if ($option == 'xxx')
{
$lien = '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
}
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin.' ');
$result.=$lien.$this->nom.' '.$this->prenom.$lienfin;
return $result;
}
}
?>

View File

@@ -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<EFBFBD>clench<EFBFBD> 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<EFBFBD>clench<EFBFBD> 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<EFBFBD>clench<EFBFBD> lors de la validation d\'une commande fournisseur','order_supplier');
--
-- Constantes de configuration

View File

@@ -335,3 +335,5 @@ 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;
insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_VAL_ORDER_SUUPLIER','Validation commande fournisseur','D<EFBFBD>clench<EFBFBD> lors de la validation d\'une commande fournisseur','order_supplier');