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é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;

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é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,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
{

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,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)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num);
}
if (isset($catid))
{
print "<div id='ways'>";
$c = new Categorie ($db, $catid);
$ways = $c->print_all_ways(' &gt; ','fourn/product/liste.php');
print " &gt; ".$ways[0]."<br />\n";
print "</div><br />";
}
print '<table class="liste" width="100%">';
// Lignes des titres
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","","",$sortfield);
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;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)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield);
print "</tr>\n";
// Lignes des champs de filtre
print '<form action="liste.php" method="post">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="sref" value="'.$sref.'">';
print '</td>';
print '<td class="liste_titre" valign="right">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
print '</td>';
print '<td class="liste_titre" colspan="2" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print '&nbsp; <input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
print '</td>';
print '</tr>';
print '</form>';
$oldid = '';
$var=True;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object( $i);
$var=!$var;
print "<tr $bc[$var]>";
if ($oldid <> $objp->rowid)
if ($num == 1 && ( isset($_POST["sall"]) || $snom || $sref ) )
{
$oldid = $objp->rowid;
print "<td><a href=\"../../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 "<td>$objp->label</td>\n";
}
else
{
print '<td colspan="2">&nbsp;</td>';
$objp = $db->fetch_object($resql);
Header("Location: fiche.php?id=".$objp->rowid);
exit;
}
print '<td>'.$objp->nom.'</td>';
print '<td align="right">'.price($objp->price).'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
$texte = $langs->trans("List");
llxHeader("","",$texte);
print "</table>";
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)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num);
}
if (isset($catid))
{
print "<div id='ways'>";
$c = new Categorie ($db, $catid);
$ways = $c->print_all_ways(' &gt; ','fourn/product/liste.php');
print " &gt; ".$ways[0]."<br />\n";
print "</div><br />";
}
print '<table class="liste" width="100%">';
// Lignes des titres
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","","",$sortfield);
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;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)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield);
print "</tr>\n";
// Lignes des champs de filtre
print '<form action="liste.php" method="post">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="sref" value="'.$sref.'">';
print '</td>';
print '<td class="liste_titre" valign="right">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
print '</td>';
print '<td class="liste_titre" colspan="2" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print '&nbsp; <input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
print '</td>';
print '</tr>';
print '</form>';
$oldid = '';
$var=True;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
if ($oldid <> $objp->rowid)
{
$oldid = $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="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->rowid.'">'.$objp->ref.'</a></td>';
print "<td>$objp->label</td>\n";
}
else
{
print '<td colspan="2">&nbsp;</td>';
}
print '<td>'.$objp->nom.'</td>';
print '<td align="right">'.price($objp->price).'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
print "</table>";
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
$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 été validé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

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

View File

@ -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
SomeNotificationsWillBeSent=%s notifications vont être envoyé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é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

View File

@ -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';
// }
}
}

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é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) ;

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é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;
}

View File

@ -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 = '<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é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

View File

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