Fix: possibilit d'ajouter la note public et prive la cration de la commande
Fix: dsormais on peut modifier la note public et prive en mme temps
This commit is contained in:
parent
74ea13b439
commit
3689ba246e
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -46,13 +46,13 @@ class Commande extends CommonObject
|
||||
var $id ;
|
||||
|
||||
var $socid; // Id client
|
||||
var $client; // Objet societe client (<EFBFBD> charger par fetch_client)
|
||||
var $client; // Objet societe client (a charger par fetch_client)
|
||||
|
||||
var $ref;
|
||||
var $ref_client;
|
||||
var $contactid;
|
||||
var $projet_id;
|
||||
var $statut; // -1=Annulee, 0=Brouillon, 1=Valid<EFBFBD>e, 2=Accept<70>e, 3=Re<52>ue (facturee ou non)
|
||||
var $statut; // -1=Annulee, 0=Brouillon, 1=Validee, 2=Acceptee, 3=Recue (facturee ou non)
|
||||
var $facturee;
|
||||
var $brouillon;
|
||||
var $cond_reglement_id;
|
||||
@ -62,7 +62,7 @@ class Commande extends CommonObject
|
||||
var $adresse_livraison_id;
|
||||
var $adresse;
|
||||
var $date; // Date commande
|
||||
var $date_livraison; // Date livraison souhait<EFBFBD>e
|
||||
var $date_livraison; // Date livraison souhaitee
|
||||
var $fk_remise_except;
|
||||
var $remise_percent;
|
||||
var $remise_absolue;
|
||||
@ -78,7 +78,7 @@ class Commande extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB Handler d'acc<EFBFBD>s base
|
||||
* \param DB Handler d'acces base
|
||||
*/
|
||||
function Commande($DB, $socid="", $commandeid=0)
|
||||
{
|
||||
@ -95,9 +95,9 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/** \brief Cr<EFBFBD><EFBFBD> la commande depuis une propale existante
|
||||
\param user Utilisateur qui cr<EFBFBD>e
|
||||
\param propale_id id de la propale qui sert de mod<EFBFBD>le
|
||||
/** \brief Cree la commande depuis une propale existante
|
||||
\param user Utilisateur qui cree
|
||||
\param propale_id id de la propale qui sert de modele
|
||||
*/
|
||||
function create_from_propale($user, $propale_id)
|
||||
{
|
||||
@ -136,7 +136,7 @@ class Commande extends CommonObject
|
||||
$this->note = $propal->note;
|
||||
$this->note_public = $propal->note_public;
|
||||
|
||||
/* D<EFBFBD>finit la soci<63>t<EFBFBD> comme un client */
|
||||
/* Definit la societe comme un client */
|
||||
$soc = new Societe($this->db);
|
||||
$soc->id = $this->socid;
|
||||
$soc->set_as_client();
|
||||
@ -147,8 +147,8 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie la r<EFBFBD>f<EFBFBD>rence de commande suivante non utilis<EFBFBD>e en fonction du module
|
||||
* de num<EFBFBD>rotation actif d<EFBFBD>fini dans COMMANDE_ADDON
|
||||
* \brief Renvoie la reference de commande suivante non utilisee en fonction du module
|
||||
* de numerotation actif defini dans COMMANDE_ADDON
|
||||
* \param soc objet societe
|
||||
* \return string reference libre pour la commande
|
||||
*/
|
||||
@ -163,7 +163,7 @@ class Commande extends CommonObject
|
||||
{
|
||||
$file = $conf->global->COMMANDE_ADDON.".php";
|
||||
|
||||
// Chargement de la classe de num<EFBFBD>rotation
|
||||
// Chargement de la classe de numerotation
|
||||
$classname = $conf->global->COMMANDE_ADDON;
|
||||
$result=include_once($dir.'/'.$file);
|
||||
if ($result)
|
||||
@ -265,7 +265,7 @@ class Commande extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
//Si activ<EFBFBD> on d<>cr<63>mente le produit principal et ses composants <20> la validation de command
|
||||
//Si active on decremente le produit principal et ses composants a la validation de command
|
||||
if($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||
@ -281,16 +281,16 @@ class Commande extends CommonObject
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
// on d<EFBFBD>compte le stock de tous les sousproduits
|
||||
// on decompte le stock de tous les sousproduits
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilit<EFBFBD> de choisir l'entrepot
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvS->livraison($user, $value[1], $entrepot_id, $value[0]*$this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// on d<EFBFBD>compte le stock du produit principal
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilit<EFBFBD> de choisir l'entrepot
|
||||
// on decompte le stock du produit principal
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ class Commande extends CommonObject
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
//Si activ<EFBFBD> on incr<63>mente le produit principal et ses composants <20> l'<27>dition de la commande
|
||||
//Si active on incremente le produit principal et ses composants a l'edition de la commande
|
||||
if($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||
@ -347,16 +347,16 @@ class Commande extends CommonObject
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
// on d<EFBFBD>compte le stock de tous les sousproduits
|
||||
// on decompte le stock de tous les sousproduits
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilit<EFBFBD> de choisir l'entrepot
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvS->reception($user, $value[1], $entrepot_id, $value[0]*$this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// on d<EFBFBD>compte le stock du produit principal
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilit<EFBFBD> de choisir l'entrepot
|
||||
// on decompte le stock du produit principal
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
@ -398,13 +398,13 @@ class Commande extends CommonObject
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
// on d<EFBFBD>compte le stock de tous les sousproduits
|
||||
// on decompte le stock de tous les sousproduits
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
$entrepot_id = "1";
|
||||
$result=$mouvS->livraison($user, $value[1], $entrepot_id, $value[0]*$this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
// on d<EFBFBD>compte pas le stock du produit principal, <20>a serait fait manuellement avec l'exp<78>dition
|
||||
// on decompte pas le stock du produit principal, ca serait fait manuellement avec l'expedition
|
||||
// $result=$mouvS->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
@ -432,7 +432,7 @@ class Commande extends CommonObject
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
//Si activ<EFBFBD> on incr<63>mente le produit principal et ses composants <20> l'<27>dition de la commande
|
||||
//Si active on incremente le produit principal et ses composants a l'edition de la commande
|
||||
if($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||
@ -448,16 +448,16 @@ class Commande extends CommonObject
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
// on d<EFBFBD>compte le stock de tous les sousproduits
|
||||
// on decompte le stock de tous les sousproduits
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilit<EFBFBD> de choisir l'entrepot
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvS->reception($user, $value[1], $entrepot_id, $value[0]*$this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// on d<EFBFBD>compte le stock du produit principal
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilit<EFBFBD> de choisir l'entrepot
|
||||
// on decompte le stock du produit principal
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
}
|
||||
}
|
||||
@ -471,8 +471,8 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Cr<EFBFBD><EFBFBD> la commande
|
||||
* \param user Objet utilisateur qui cr<EFBFBD>e
|
||||
* \brief Cree la commande
|
||||
* \param user Objet utilisateur qui cree
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
@ -483,7 +483,7 @@ class Commande extends CommonObject
|
||||
|
||||
dolibarr_syslog("Commande.class::create");
|
||||
|
||||
// V<EFBFBD>rification param<61>tres
|
||||
// Verification parametres
|
||||
if ($this->source < 0)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
|
||||
@ -561,10 +561,10 @@ class Commande extends CommonObject
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_pr (fk_commande, fk_propale) VALUES ('.$this->id.','.$this->propale_id.')';
|
||||
$this->db->query($sql);
|
||||
|
||||
// On r<EFBFBD>cup<EFBFBD>re les diff<66>rents contact interne et externe
|
||||
// On recupere les differents contact interne et externe
|
||||
$prop = New Propal($this->db, $this->socid, $this->propale_id);
|
||||
|
||||
// On r<EFBFBD>cup<EFBFBD>re le commercial suivi propale
|
||||
// On recupere le commercial suivi propale
|
||||
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
|
||||
|
||||
if ($this->userid)
|
||||
@ -573,7 +573,7 @@ class Commande extends CommonObject
|
||||
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
|
||||
}
|
||||
|
||||
// On r<EFBFBD>cup<EFBFBD>re le contact client suivi propale
|
||||
// On recupere le contact client suivi propale
|
||||
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
|
||||
|
||||
if ($this->contactid)
|
||||
@ -610,13 +610,13 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Ajoute une ligne de produit (associ<EFBFBD> <EFBFBD> un produit/service pr<EFBFBD>d<EFBFBD>fini ou non)
|
||||
* \brief Ajoute une ligne de produit (associe a un produit/service predefini ou non)
|
||||
* \param commandeid Id de la commande
|
||||
* \param desc Description de la ligne
|
||||
* \param pu_ht Prix unitaire HT
|
||||
* \param qty Quantit<EFBFBD>
|
||||
* \param txtva Taux de tva forc<EFBFBD>, sinon -1
|
||||
* \param fk_product Id du produit/service pred<EFBFBD>fini
|
||||
* \param qty Quantite
|
||||
* \param txtva Taux de tva force, sinon -1
|
||||
* \param fk_product Id du produit/service predefini
|
||||
* \param remise_percent Pourcentage de remise de la ligne
|
||||
* \param info_bits Bits de type de lignes
|
||||
* \param fk_remise_exscept Id remise
|
||||
@ -624,8 +624,8 @@ class Commande extends CommonObject
|
||||
* \param pu_ttc Prix unitaire TTC
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* \see add_product
|
||||
* \remarks Les parametres sont deja cens<EFBFBD> etre juste et avec valeurs finales a l'appel
|
||||
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete d<EFBFBD>fini
|
||||
* \remarks Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
@ -727,13 +727,13 @@ class Commande extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Ajoute une ligne dans tableau lines
|
||||
* \param idproduct Id du produit <EFBFBD> ajouter
|
||||
* \param qty Quantit<EFBFBD>
|
||||
* \remise_percent remise_percent Remise relative effectu<EFBFBD>e sur le produit
|
||||
* \param idproduct Id du produit a ajouter
|
||||
* \param qty Quantite
|
||||
* \remise_percent remise_percent Remise relative effectuee sur le produit
|
||||
* \return void
|
||||
* \remarks $this->client doit etre charg<EFBFBD>
|
||||
* \remarks $this->client doit etre charge
|
||||
* \TODO Remplacer les appels a cette fonction par generation objet Ligne
|
||||
* ins<EFBFBD>r<EFBFBD> dans tableau $this->products
|
||||
* insere dans tableau $this->products
|
||||
*/
|
||||
function add_product($idproduct, $qty, $remise_percent=0)
|
||||
{
|
||||
@ -766,7 +766,7 @@ class Commande extends CommonObject
|
||||
|
||||
$this->lines[] = $line;
|
||||
|
||||
/** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS <EFBFBD> LA COMMANDE
|
||||
/** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE
|
||||
if($conf->global->PRODUIT_SOUSPRODUITS == 1)
|
||||
{
|
||||
$prod = new Product($this->db, $idproduct);
|
||||
@ -790,8 +790,8 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Recup<EFBFBD>re de la base les caract<EFBFBD>ristiques d'une commande
|
||||
* \param rowid id de la commande <EFBFBD> r<EFBFBD>cup<EFBFBD>rer
|
||||
* \brief Recupere de la base les caracteristiques d'une commande
|
||||
* \param rowid id de la commande a recuperer
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
@ -928,7 +928,7 @@ class Commande extends CommonObject
|
||||
$comligne->tva_tx=$remise->tva_tx;
|
||||
$comligne->subprice=-$remise->amount_ht;
|
||||
$comligne->price=-$remise->amount_ht;
|
||||
$comligne->fk_product=0; // Id produit pr<EFBFBD>d<EFBFBD>fini
|
||||
$comligne->fk_product=0; // Id produit predefini
|
||||
$comligne->qty=1;
|
||||
$comligne->remise=0;
|
||||
$comligne->remise_percent=0;
|
||||
@ -971,7 +971,7 @@ class Commande extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Reinitialise le tableau lignes
|
||||
* \param only_product Ne renvoie que ligne li<EFBFBD>es <EFBFBD> des produits physiques pr<EFBFBD>d<EFBFBD>finis
|
||||
* \param only_product Ne renvoie que ligne liees a des produits physiques predefinis
|
||||
* \return array Tableau de CommandeLigne
|
||||
*/
|
||||
function fetch_lines($only_product=0)
|
||||
@ -1041,7 +1041,7 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie nombre de lignes de type produits. Doit etre appel<EFBFBD> apr<EFBFBD>s fetch_lines
|
||||
* \brief Renvoie nombre de lignes de type produits. Doit etre appele apres fetch_lines
|
||||
* \return int <0 si ko, Nbre de lignes produits sinon
|
||||
*/
|
||||
function getNbOfProductsLines()
|
||||
@ -1055,7 +1055,7 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge tableau avec les exp<EFBFBD>ditions par ligne
|
||||
* \brief Charge tableau avec les expeditions par ligne
|
||||
* \param filtre_statut Filtre sur statut
|
||||
* \return int <0 if KO, Nb of records if OK
|
||||
*/
|
||||
@ -1181,8 +1181,8 @@ class Commande extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Supprime une ligne de la commande
|
||||
* \param idligne Id de la ligne <EFBFBD> supprimer
|
||||
* \return int >0 si ok, 0 si rien <EFBFBD> supprimer, <0 si ko
|
||||
* \param idligne Id de la ligne a supprimer
|
||||
* \return int >0 si ok, 0 si rien a supprimer, <0 si ko
|
||||
*/
|
||||
function delete_line($idligne)
|
||||
{
|
||||
@ -1325,7 +1325,7 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief D<EFBFBD>finit une date de livraison
|
||||
* \brief Definit une date de livraison
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param date_livraison Date de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
@ -1359,7 +1359,7 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief D<EFBFBD>finit une adresse de livraison
|
||||
* \brief Definit une adresse de livraison
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param adresse_livraison Adresse de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
@ -1386,10 +1386,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi la liste des commandes (<EFBFBD>ventuellement filtr<EFBFBD>e sur un user) dans un tableau
|
||||
* \brief Renvoi la liste des commandes (eventuellement filtree sur un user) dans un tableau
|
||||
* \param brouillon 0=non brouillon, 1=brouillon
|
||||
* \param user Objet user de filtre
|
||||
* \return int -1 si erreur, tableau r<EFBFBD>sultat si ok
|
||||
* \return int -1 si erreur, tableau resultat si ok
|
||||
*/
|
||||
function liste_array ($brouillon=0, $user='')
|
||||
{
|
||||
@ -1440,8 +1440,8 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change les conditions de r<EFBFBD>glement de la commande
|
||||
* \param cond_reglement_id Id de la nouvelle condition de r<EFBFBD>glement
|
||||
* \brief Change les conditions de reglement de la commande
|
||||
* \param cond_reglement_id Id de la nouvelle condition de reglement
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function cond_reglement($cond_reglement_id)
|
||||
@ -1474,7 +1474,7 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Change le mode de r<EFBFBD>glement
|
||||
* \brief Change le mode de reglement
|
||||
* \param mode Id du nouveau mode
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
@ -1540,7 +1540,7 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Classe la commande comme factur<EFBFBD>e
|
||||
* \brief Classe la commande comme facturee
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function classer_facturee()
|
||||
@ -1587,7 +1587,7 @@ class Commande extends CommonObject
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Nettoyage param<EFBFBD>tres
|
||||
// Nettoyage parametres
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
@ -1703,7 +1703,7 @@ class Commande extends CommonObject
|
||||
$err++;
|
||||
}
|
||||
|
||||
// On efface le r<EFBFBD>pertoire de pdf provisoire
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$comref = sanitize_string($this->ref);
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
@ -1806,9 +1806,9 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le libell<EFBFBD> du statut de la commande
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
* \brief Retourne le libelle du statut de la commande
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
{
|
||||
@ -1816,11 +1816,11 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
||||
* \brief Renvoi le libelle d'un statut donne
|
||||
* \param statut Id statut
|
||||
* \param facturee Si facturee
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \return string Libelle
|
||||
*/
|
||||
function LibStatut($statut,$facturee,$mode)
|
||||
{
|
||||
@ -1967,8 +1967,8 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialise la commande avec valeurs fictives al<EFBFBD>atoire
|
||||
* Sert <EFBFBD> g<EFBFBD>n<EFBFBD>rer une commande pour l'aperu des mod<EFBFBD>les ou demo
|
||||
* \brief Initialise la commande avec valeurs fictives aleatoire
|
||||
* Sert a generer une commande pour l'aperu des modeles ou demo
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
@ -1976,7 +1976,7 @@ class Commande extends CommonObject
|
||||
|
||||
dolibarr_syslog("Commande::initAsSpecimen");
|
||||
|
||||
// Charge tableau des id de soci<EFBFBD>t<EFBFBD> socids
|
||||
// Charge tableau des id de societe socids
|
||||
$socids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client=1 LIMIT 10";
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2009,7 +2009,7 @@ class Commande extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise param<EFBFBD>tres
|
||||
// Initialise parametres
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
@ -2098,9 +2098,9 @@ class CommandeLigne
|
||||
var $rowid;
|
||||
var $fk_facture;
|
||||
var $desc; // Description ligne
|
||||
var $fk_product; // Id produit pr<EFBFBD>d<EFBFBD>fini
|
||||
var $fk_product; // Id produit predefini
|
||||
|
||||
var $qty; // Quantit<EFBFBD> (exemple 2)
|
||||
var $qty; // Quantite (exemple 2)
|
||||
var $tva_tx; // Taux tva produit/service (exemple 19.6)
|
||||
var $subprice; // P.U. HT (exemple 100)
|
||||
var $remise_percent; // % de la remise ligne (exemple 20%)
|
||||
@ -2109,9 +2109,9 @@ class CommandeLigne
|
||||
var $marque_tx;
|
||||
var $info_bits = 0; // Bit 0: 0 si TVA normal - 1 si TVA NPR
|
||||
// Bit 1: 0 ligne normale - 1 si ligne de remise fixe
|
||||
var $total_ht; // Total HT de la ligne toute quantit<EFBFBD> et incluant la remise ligne
|
||||
var $total_tva; // Total TVA de la ligne toute quantit<EFBFBD> et incluant la remise ligne
|
||||
var $total_ttc; // Total TTC de la ligne toute quantit<EFBFBD> et incluant la remise ligne
|
||||
var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
|
||||
|
||||
// Ne plus utiliser
|
||||
var $remise;
|
||||
@ -2125,7 +2125,7 @@ class CommandeLigne
|
||||
|
||||
/**
|
||||
* \brief Constructeur d'objets ligne de commande
|
||||
* \param DB handler d'acc<EFBFBD>s base de donn<EFBFBD>e
|
||||
* \param DB handler d'acces base de donnee
|
||||
*/
|
||||
function CommandeLigne($DB)
|
||||
{
|
||||
@ -2213,7 +2213,7 @@ class CommandeLigne
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ins<EFBFBD>re l'objet ligne de commande en base
|
||||
* \brief Insere l'objet ligne de commande en base
|
||||
* \param notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
@ -2227,7 +2227,7 @@ class CommandeLigne
|
||||
$rangtouse=$this->rang;
|
||||
if ($rangtouse == -1)
|
||||
{
|
||||
// R<EFBFBD>cup<EFBFBD>re rang max de la commande dans $rangmax
|
||||
// Recupere rang max de la commande dans $rangmax
|
||||
$sql = 'SELECT max(rang) as max FROM '.MAIN_DB_PREFIX.'commandedet';
|
||||
$sql.= ' WHERE fk_commande ='.$this->fk_commande;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -140,10 +140,9 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||
|
||||
$commande->date_commande = $datecommande;
|
||||
$commande->note = $_POST['note'];
|
||||
$commande->note_public = $_POST['note_public'];
|
||||
$commande->source = $_POST['source_id'];
|
||||
$commande->projetid = $_POST['projetid'];
|
||||
//$commande->remise_absolue = $_POST['remise_absolue']; //la remise etait appliquee sur les lignes et sur le total
|
||||
//$commande->remise_percent = $_POST['remise_percent'];
|
||||
$commande->ref_client = $_POST['ref_client'];
|
||||
$commande->modelpdf = $_POST['model'];
|
||||
$commande->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
@ -768,7 +767,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($obj->rowid);
|
||||
|
||||
$nbrow=9;
|
||||
$nbrow=10;
|
||||
|
||||
print '<form name="crea_commande" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -779,13 +778,12 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td>';
|
||||
print '<td>'.$langs->trans('NotePublic').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
|
||||
|
||||
// Reference client
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
|
||||
print '<input type="text" name="ref_client" value=""></td>';
|
||||
print '<td rowspan="'.$nbrow.'" valign="top"><textarea name="note" cols="70" rows="8"></textarea></td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||
@ -873,6 +871,23 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
$html->select_array('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
// Note publique
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Note privée
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
print '</textarea></td></tr>';
|
||||
}
|
||||
|
||||
if ($propalid > 0)
|
||||
{
|
||||
$amount = ($obj->price);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -54,28 +55,14 @@ $commande->fetch($_GET["id"]);
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($_POST["action"] == 'update_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$commande->update_note_public($_POST["note_public"],$user);
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'update' && $user->rights->commande->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$resPrivateNote=$commande->update_note($_POST["note"]);
|
||||
$resPublicNote=$commande->update_note_public($_POST["note_public"]);
|
||||
|
||||
$res=$commande->update_note($_POST["note"],$user);
|
||||
if ($res < 0)
|
||||
if ($resPrivateNote < 0 || $resPublicNote < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||
$db->rollback();
|
||||
@ -98,15 +85,14 @@ $html = new Form($db);
|
||||
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$soc = new Societe($db, $commande->socid);
|
||||
$soc->fetch($commande->socid);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
|
||||
dolibarr_fiche_head($head, 'note', $langs->trans("CustomerOrder"));
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
$soc = new Societe($db, $commande->socid);
|
||||
$soc->fetch($commande->socid);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
|
||||
dolibarr_fiche_head($head, 'note', $langs->trans("CustomerOrder"));
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
@ -115,11 +101,11 @@ if ($_GET["id"])
|
||||
|
||||
// Ref commande client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $commande->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -129,59 +115,59 @@ if ($_GET["id"])
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Note publique
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?id='.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="update_public">';
|
||||
print '<textarea name="note_public" cols="80" rows="8">'.$commande->note_public."</textarea><br>";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($commande->note_public?nl2br($commande->note_public):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<textarea name="note_public" cols="80" rows="8">'.$commande->note_public."</textarea><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($commande->note_public?nl2br($commande->note_public):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Note privée
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?id='.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<textarea name="note" cols="80" rows="8">'.$commande->note."</textarea><br>";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<textarea name="note" cols="80" rows="8">'.$commande->note."</textarea><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($commande->note?nl2br($commande->note):" ");
|
||||
print ($commande->note?nl2br($commande->note):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '</div>';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->commande->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?id=$commande->id&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<br><center>';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans('Save').'">';
|
||||
print '</center>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->commande->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?id=".$commande->id."&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user