diff --git a/htdocs/includes/modules/modFournisseur.class.php b/htdocs/includes/modules/modFournisseur.class.php index 388d38c5a3e..436c487aab2 100644 --- a/htdocs/includes/modules/modFournisseur.class.php +++ b/htdocs/includes/modules/modFournisseur.class.php @@ -70,7 +70,7 @@ class modFournisseur extends DolibarrModules $this->const[1][0] = "COMMANDE_SUPPLIER_ADDON"; $this->const[1][1] = "chaine"; - $this->const[1][2] = "diamant"; + $this->const[1][2] = "emeraude"; // Dépendances $this->depends = array("modSociete"); diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 500f62c1852..2a26d207340 100755 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -31,6 +31,12 @@ ValidateOrder=Validate order DeleteOrder=Delete order CancelOrder=Cancel order AddOrder=Add order +AddToMyOrders=Add to my orders +AddToOtherOrders=Add to other orders +ShowOrder=Show order +NoOpenedOrders=No opened orders +NoOtherOpenedOrders=No other opened orders +OtherOrders=Other orders LastOrders=Last %s orders LastModifiedOrders=Last %s modified orders LastClosedOrders=Last %s closed orders diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index eedaf4d1d81..8583c3e2063 100755 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -31,6 +31,12 @@ ValidateOrder=Valider la commande DeleteOrder=Supprimer la commande CancelOrder=Annuler la commande AddOrder=Créer commande +AddToMyOrders=Ajouter à mes commandes +AddToOtherOrders=Ajouter aux autres commandes +ShowOrder=Afficher commande +NoOpenedOrders=Pas de commande brouillon +NoOtherOpenedOrders=Pas d'autre commande brouillon +OtherOrders=Autres commandes LastOrders=Les %s dernières commandes LastModifiedOrders=Les %s dernières commandes modifiées LastClosedOrders=Les %s dernières commandes cloturées diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index bff3aa0ab90..ab072a6761a 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -34,6 +34,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); +require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); $langs->load("bills"); @@ -199,6 +200,9 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer) } } +/* + * Ajout du produit dans une propal + */ if ($_POST["action"] == 'addinpropal') { $propal = New Propal($db); @@ -214,6 +218,30 @@ if ($_POST["action"] == 'addinpropal') exit; } +/* + * Ajout du produit dans une commande + */ +if ($_POST["action"] == 'addincommande') +{ + $commande = New Commande($db); + $commande->fetch($_POST["commandid"]); + + $result = $commande->addline(addslashes($product->libelle), + addslashes($product->product_desc), + $product->price, + $_POST["qty"], + $product->tva_tx, + $product->id, + $_POST["remise_percent"]); + if ( $result < 0) + { + $mesg = $langs->trans("ErrorUnknown").": $result"; + } + + Header("Location: ../commande/fiche.php?id=".$commande->id); + exit; +} + /* * Ajout du produit dans une facture */ @@ -228,6 +256,7 @@ if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer) $facture->addline($_POST["factureid"], addslashes($product->libelle), + addslashes($product->product_desc), $product->price, $_POST["qty"], $product->tva_tx, @@ -764,6 +793,97 @@ if ($_GET["id"] && $_GET["action"] == '' && $product->envente) print ''; } + $commande = New Commande($db); + + print '
| '; + print_titre($langs->trans("AddToMyOrders")) . ' | '; + print ''; + print_titre($langs->trans("AddToOtherOrders")) . ' | '; + print '
| ';
+ $sql = "SELECT s.nom, s.idp, c.rowid as commandeid, c.ref,".$db->pdate("c.date_commande")." as dc";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
+ $sql .=" WHERE c.fk_soc = s.idp AND c.fk_statut = 0 AND c.fk_user_author = ".$user->id;
+ $sql .= " ORDER BY c.date_creation DESC, tms DESC";
+
+ $result=$db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ if ($num) {
+ $i = 0;
+ print ' | ';
+
+ // Liste de "Other orders"
+ print ''; + + $othercom = $commande->liste_array(1, ' <> s'.$user->id); + if (is_array($othercom) && sizeof($othercom)) + { + $var=false; + print ''; + } + else { + print $langs->trans("NoOtherOpenedOrders"); + } + print ' | '; + + print '