diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index a56701dada2..d1c4ef409b4 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -76,7 +76,7 @@ if ($action == 'disable') {
$action = 'update';
if ($result < 0) {
- setEventMessage($accounting->error, 'errors');
+ setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} else if ($action == 'enable') {
if ($accounting->fetch($id)) {
@@ -84,7 +84,7 @@ if ($action == 'disable') {
}
$action = 'update';
if ($result < 0) {
- setEventMessage($accounting->error, 'errors');
+ setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php
index 925bf818137..99eb49949e7 100644
--- a/htdocs/accountancy/admin/card.php
+++ b/htdocs/accountancy/admin/card.php
@@ -125,7 +125,7 @@ else if ($action == 'delete')
}
if ($result < 0) {
- setEventMessage($accounting->error, 'errors');
+ setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php
index 9bde2d23c14..c0a987ddf82 100644
--- a/htdocs/accountancy/admin/export.php
+++ b/htdocs/accountancy/admin/export.php
@@ -100,9 +100,9 @@ if ($action == 'update') {
}
if (! $error) {
- setEventMessage($langs->trans("SetupSaved"));
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
- setEventMessage($langs->trans("Error"), 'errors');
+ setEventMessages($langs->trans("Error"), null, 'errors');
}
}
diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php
index 657d5b100e6..45e69c991de 100644
--- a/htdocs/accountancy/admin/fiscalyear_card.php
+++ b/htdocs/accountancy/admin/fiscalyear_card.php
@@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
}
else
{
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -110,7 +110,7 @@ else if ($action == 'add')
{
$db->rollback();
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
$action='create';
}
}
@@ -147,7 +147,7 @@ else if ($action == 'update')
}
else
{
- setEventMessage($object->error, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
else
diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php
index 61e86b7df19..7c38617d66c 100644
--- a/htdocs/accountancy/admin/importaccounts.php
+++ b/htdocs/accountancy/admin/importaccounts.php
@@ -76,14 +76,14 @@ if ($_POST["action"] == 'import') {
$result = $accounting->create($user);
if ($result > 0) {
- setEventMessage($langs->trans("AccountingAccountAdd"), 'mesgs');
+ setEventMessages($langs->trans("AccountingAccountAdd"), null, 'mesgs');
} else {
- setEventMessage($accounting->error, 'errors');
+ setEventMessages($accounting->error, $accounting->errors, 'errors');
}
$cpt ++;
}
} else {
- setEventMessage($langs->trans('AccountPlanNotFoundCheckSetting'), 'errors');
+ setEventMessages($langs->trans('AccountPlanNotFoundCheckSetting'), null, 'errors');
}
} else {
print '
' . $langs->trans("AnyLineImport") . '
';
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index af0bccdf00c..40dff028783 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -111,11 +111,11 @@ if ($action == 'update')
if (! $error)
{
- setEventMessage($langs->trans("SetupSaved"));
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
- setEventMessage($langs->trans("Error"),'errors');
+ setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@@ -126,9 +126,9 @@ if ($action == 'setlistsorttodo') {
$error ++;
if (! $error) {
- setEventMessage($langs->trans("SetupSaved"), 'mesgs');
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
- setEventMessage($langs->trans("Error"), 'mesgs');
+ setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
@@ -138,9 +138,9 @@ if ($action == 'setlistsortdone') {
if (! $res > 0)
$error ++;
if (! $error) {
- setEventMessage($langs->trans("SetupSaved"), 'mesgs');
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
- setEventMessage($langs->trans("Error"), 'mesgs');
+ setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
diff --git a/htdocs/accountancy/admin/journal.php b/htdocs/accountancy/admin/journal.php
index b55728ee080..18f01abb082 100644
--- a/htdocs/accountancy/admin/journal.php
+++ b/htdocs/accountancy/admin/journal.php
@@ -68,9 +68,9 @@ if ($action == 'update') {
}
if (! $error) {
- setEventMessage($langs->trans("SetupSaved"));
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
- setEventMessage($langs->trans("Error"), 'errors');
+ setEventMessages($langs->trans("Error"), null, 'errors');
}
}
diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php
index d79d14e74d1..0bea58fd75c 100644
--- a/htdocs/accountancy/admin/productaccount.php
+++ b/htdocs/accountancy/admin/productaccount.php
@@ -116,7 +116,7 @@ if ($action == 'update') {
$result=$accounting->fetch($accounting_account_id,null,1);
if ($result<0) {
- //setEventMessage(null, $accounting->errors,'errors');
+ //setEventMessages(null, $accounting->errors, 'errors');
$msg .= '' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '
' . $sql . '
';
} else {
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index d1bf69a8eee..d4c256dfbf2 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -51,7 +51,7 @@ if ($action == "confirm_update") {
$error = 0;
- if ((intval($debit) != 0) && (intval($credit) != 0)) {
+ if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
@@ -69,11 +69,11 @@ if ($action == "confirm_update") {
$book->debit = $debit;
$book->credit = $credit;
- if (! empty($debit)) {
+ if (floatval($debit)!=0.0) {
$book->montant = $debit;
$book->sens = 'D';
}
- if (! empty($credit)) {
+ if (floatval($credit)!=0.0) {
$book->montant = $credit;
$book->sens = 'C';
}
@@ -372,4 +372,4 @@ if ($action == 'create') {
}
llxFooter();
-$db->close();
\ No newline at end of file
+$db->close();
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 860e1a21772..f7e3812d74f 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -251,6 +251,23 @@ else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
}
}
+// Activate ask for warehouse
+else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
+{
+ $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity);
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessage($langs->trans("SetupSaved"));
+ }
+ else
+ {
+ setEventMessage($langs->trans("Error"),'errors');
+ }
+}
+
/*
* View
@@ -630,6 +647,36 @@ else
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' | '.$langs->trans('NotAvailable').' | ';
}
+// Ask for warehouse during order
+if ($conf->stock->enabled)
+{
+ $var=!$var;
+ print '| ';
+ print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' |   | ';
+ if (! empty($conf->use_javascript_ajax))
+ {
+ print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
+ }
+ else
+ {
+ if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
+ {
+ print ''.img_picto($langs->trans("Disabled"),'switch_off').'';
+ }
+ else
+ {
+ print ''.img_picto($langs->trans("Enabled"),'switch_on').'';
+ }
+ }
+ print ' |
';
+}
+else
+{
+ $var=!$var;
+ print '| ';
+ print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' | | '.$langs->trans('NotAvailable').' |
';
+}
+
print '';
print '
';
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 18991f66bba..86f48d10817 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
+if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! $user->rights->societe->lire) accessforbidden();
@@ -65,6 +66,7 @@ $formfile = new FormFile($db);
$companystatic=new Societe($db);
if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
+if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
llxHeader();
@@ -125,6 +127,8 @@ if (count($listofsearchfields))
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
+ $langs->load("propal");
+
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
@@ -144,7 +148,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '';
print '';
- print '| '.$langs->trans("ProposalsDraft").' '.$num.' |
';
+ print ''.$langs->trans("ProposalsDraft").($num?' '.$num.'':'').' | ';
if ($num > 0)
{
@@ -182,6 +186,10 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '| '.$langs->trans("Total").' | '.price($total)." |
";
}
}
+ else
+ {
+ print '| '.$langs->trans("NoProposal").' |
';
+ }
print "
";
$db->free($resql);
@@ -219,7 +227,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '';
print '';
- print '| '.$langs->trans("DraftOrders").' '.$num.' |
';
+ print ''.$langs->trans("DraftOrders").($num?' '.$num.'':'').' | ';
if ($num)
{
@@ -257,10 +265,96 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '| '.$langs->trans("Total").' | '.price($total)." |
";
}
}
+ else
+ {
+ print '| '.$langs->trans("NoOrder").' |
';
+ }
print "
";
$db->free($resql);
}
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
+
+/*
+ * Draft suppliers orders
+ */
+if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
+{
+ $langs->load("orders");
+
+ $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
+ $sql.= ", s.code_client";
+ $sql.= ", s.code_fournisseur";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
+ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
+ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql.= " WHERE cf.fk_soc = s.rowid";
+ $sql.= " AND cf.fk_statut = 0";
+ $sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")";
+ if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($socid) $sql.= " AND cf.fk_soc = ".$socid;
+
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $total = 0;
+ $num = $db->num_rows($resql);
+
+ print '';
+ print '';
+ print '| '.$langs->trans("DraftSuppliersOrders").($num?' '.$num.'':'').' |
';
+
+ if ($num)
+ {
+ $i = 0;
+ $var = true;
+ while ($i < $num)
+ {
+ $var=!$var;
+ $obj = $db->fetch_object($resql);
+ print '| ';
+ $supplierorderstatic->id=$obj->rowid;
+ $supplierorderstatic->ref=$obj->ref;
+ $supplierorderstatic->ref_supplier=$obj->ref_suppliert;
+ $supplierorderstatic->total_ht = $obj->total_ht;
+ $supplierorderstatic->total_tva = $obj->total_tva;
+ $supplierorderstatic->total_ttc = $obj->total_ttc;
+ print $supplierorderstatic->getNomUrl(1);
+ print ' | ';
+ print '';
+ $companystatic->id=$obj->socid;
+ $companystatic->name=$obj->name;
+ $companystatic->client=$obj->client;
+ $companystatic->code_client = $obj->code_client;
+ $companystatic->code_fournisseur = $obj->code_fournisseur;
+ $companystatic->canvas=$obj->canvas;
+ print $companystatic->getNomUrl(1,'customer',16);
+ print ' | ';
+ print ''.price($obj->total_ttc).' |
';
+ $i++;
+ $total += $obj->total_ttc;
+ }
+ if ($total>0)
+ {
+ $var=!$var;
+ print '| '.$langs->trans("Total").' | '.price($total)." |
";
+ }
+ }
+ else
+ {
+ print '| '.$langs->trans("NoSupplierOrder").' |
';
+ }
+ print "
";
+
+ $db->free($resql);
+ } else {
+ dol_print_error($db);
+ }
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 4c2c0f3aea7..d43314a8816 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -702,6 +702,7 @@ class Commande extends CommonOrder
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql.= ", fk_shipping_method";
+ $sql.= ", fk_warehouse";
$sql.= ", remise_absolue, remise_percent";
$sql.= ", fk_incoterms, location_incoterms";
$sql.= ", entity";
@@ -724,6 +725,7 @@ class Commande extends CommonOrder
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL');
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
+ $sql.= ", ".($this->warehouse_id>0?$this->warehouse_id:'NULL');
$sql.= ", ".($this->remise_absolue>0?$this->db->escape($this->remise_absolue):'NULL');
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
$sql.= ", ".(int) $this->fk_incoterms;
@@ -1063,6 +1065,7 @@ class Commande extends CommonOrder
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
+ $this->warehouse_id = $object->warehouse_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
@@ -1432,6 +1435,7 @@ class Commande extends CommonOrder
$sql.= ', c.date_commande';
$sql.= ', c.date_livraison';
$sql.= ', c.fk_shipping_method';
+ $sql.= ', c.fk_warehouse';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
$sql.= ', c.fk_incoterms, c.location_incoterms';
@@ -1499,6 +1503,7 @@ class Commande extends CommonOrder
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
+ $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null;
$this->fk_delivery_address = $obj->fk_delivery_address;
//Incoterms
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f555bd113d9..d5dac206e15 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1507,6 +1507,36 @@ abstract class CommonObject
}
+ /**
+ * Change the warehouse
+ *
+ * @param int $warehouse_id Id of warehouse
+ * @return int 1 if OK, 0 if KO
+ */
+ function setWarehouse($warehouse_id)
+ {
+ if (! $this->table_element) {
+ dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined",LOG_ERR);
+ return -1;
+ }
+ if ($warehouse_id<0) $warehouse_id='NULL';
+ dol_syslog(get_class($this).'::setWarehouse('.$warehouse_id.')');
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql.= " SET fk_warehouse = ".$warehouse_id;
+ $sql.= " WHERE rowid=".$this->id;
+
+ if ($this->db->query($sql)) {
+ $this->warehouse_id = ($warehouse_id=='NULL')?null:$warehouse_id;
+ return 1;
+ } else {
+ dol_syslog(get_class($this).'::setWarehouse Error ', LOG_DEBUG);
+ $this->error=$this->db->error();
+ return 0;
+ }
+ }
+
+
/**
* Set last model used by doc generator
*
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index 82bf1d01e6a..2fd7bbb359a 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -88,9 +88,7 @@ if ($action == 'setdatedelivery' && $user->rights->commande->creer)
$commande->fetch($id);
$result=$commande->set_date_livraison($user,$datelivraison);
if ($result < 0)
- {
- $mesg=''.$commande->error.'
';
- }
+ setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
@@ -98,6 +96,8 @@ if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
$commande = new Commande($db);
$commande->fetch($id);
$commande->setDeliveryAddress(GETPOST('delivery_address_id','int'));
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setmode' && $user->rights->commande->creer)
@@ -105,7 +105,24 @@ if ($action == 'setmode' && $user->rights->commande->creer)
$commande = new Commande($db);
$commande->fetch($id);
$result = $commande->setPaymentMethods(GETPOST('mode_reglement_id','int'));
- if ($result < 0) dol_print_error($db,$commande->error);
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
+}
+
+if ($action == 'setavailability' && $user->rights->commande->creer) {
+ $commande = new Commande($db);
+ $commande->fetch($id);
+ $result=$commande->availability(GETPOST('availability_id'));
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
+}
+
+if ($action == 'setdemandreason' && $user->rights->commande->creer) {
+ $commande = new Commande($db);
+ $commande->fetch($id);
+ $result=$commande->demand_reason(GETPOST('demand_reason_id'));
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setconditions' && $user->rights->commande->creer)
@@ -113,7 +130,8 @@ if ($action == 'setconditions' && $user->rights->commande->creer)
$commande = new Commande($db);
$commande->fetch($id);
$result=$commande->setPaymentTerms(GETPOST('cond_reglement_id','int'));
- if ($result < 0) dol_print_error($db,$commande->error);
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
}
// shipping method
@@ -121,8 +139,18 @@ if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$commande = new Commande($db);
$commande->fetch($id);
$result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int'));
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
}
+// warehouse
+if ($action == 'setwarehouse' && $user->rights->commande->creer) {
+ $commande = new Commande($db);
+ $commande->fetch($id);
+ $result = $commande->setWarehouse(GETPOST('warehouse_id', 'int'));
+ if ($result < 0)
+ setEventMessages($commande->error, $commande->errors, 'errors');
+}
/*
@@ -164,8 +192,8 @@ if ($id > 0 || ! empty($ref))
}
// Onglet commande
- $nbrow=8;
- if (! empty($conf->projet->enabled)) $nbrow++;
+ //$nbrow=8;
+ //if (! empty($conf->projet->enabled)) $nbrow++;
print '';
@@ -286,6 +314,27 @@ if ($id > 0 || ! empty($ref))
print '';
print '';
+ // Warehouse
+ if (! empty($conf->stock->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
+ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
+ $formproduct=new FormProduct($db);
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editwarehouse') {
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'warehouse_id', 1);
+ } else {
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'none');
+ }
+ print ' | ';
+ print '
';
+ }
+
// Terms of payment
print '';
print '| ';
@@ -529,7 +578,7 @@ if ($id > 0 || ! empty($ref))
}
// Qty ordered
- print ' | '.$objp->qty.' | ';
+ print '' . ($objp->qty!=1?''.$objp->qty.'':$objp->qty) . ' | ';
// Qty already shipped
$qtyProdCom=$objp->qty;
@@ -677,7 +726,7 @@ if ($id > 0 || ! empty($ref))
print ''.$langs->trans("WarehouseSource").' | ';
print '';
- print $formproduct->selectWarehouses(-1,'entrepot_id','',1);
+ print $formproduct->selectWarehouses(! empty($commande->warehouse_id)?$commande->warehouse_id:-1,'entrepot_id','',1);
if (count($formproduct->cache_warehouses) <= 0)
{
print ' '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").'';
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 490b5cf1ea3..cf580459a9c 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -229,7 +229,7 @@ class ProductFournisseur extends Product
else
{
$this->db->rollback();
- return 1;
+ return -1;
}
}
else
@@ -312,7 +312,7 @@ class ProductFournisseur extends Product
else
{
$this->db->rollback();
- return 1;
+ return -1;
}
}
else
diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
index 9bc9d7b8677..670177d1e55 100755
--- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
+++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
@@ -67,7 +67,7 @@ ALTER TABLE llx_prelevement_lignes MODIFY COLUMN code_banque varchar(128);
ALTER TABLE llx_societe_rib MODIFY COLUMN code_banque varchar(128);
ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30);
-
+ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL after fk_shipping_method;
ALTER TABLE llx_ecm_directories MODIFY COLUMN fullpath varchar(750);
diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql
index 3511aa7ec78..553b2facad7 100644
--- a/htdocs/install/mysql/tables/llx_commande.sql
+++ b/htdocs/install/mysql/tables/llx_commande.sql
@@ -63,6 +63,7 @@ create table llx_commande
date_livraison date default NULL,
fk_shipping_method integer, -- shipping method id
+ fk_warehouse integer default NULL,
fk_availability integer NULL,
fk_input_reason integer, -- id coming from c_input_reason, '0' if no defined
fk_delivery_address integer, -- delivery address (deprecated)
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index ed2eb3cdffa..28a6514328c 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1204,6 +1204,7 @@ AskPriceSupplierPDFModules=Price requests suppliers documents models
FreeLegalTextOnAskPriceSupplier=Free text on price requests suppliers
WatermarkOnDraftAskPriceSupplier=Watermark on draft price requests suppliers (none if empty)
BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER=Ask for bank account destination of price request
+WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER=Ask for Warehouse Source for order
##### Orders #####
OrdersSetup=Order management setup
OrdersNumberingModules=Orders numbering models
@@ -1699,4 +1700,3 @@ TitleExampleForMajorRelease=Example of message you can use to announce this majo
TitleExampleForMaintenanceRelease=Example of message you can use to announce this maintenance release (feel free to use it on your web sites)
ExampleOfNewsMessageForMajorRelease=Dolibarr ERP & CRM %s is available. Version %s is a major release with a lot of new features for both users and developers. You can download it from the download area of http://www.dolibarr.org portal (subdirectory Stable versions). You can read ChangeLog for complete list of changes.
ExampleOfNewsMessageForMaintenanceRelease=Dolibarr ERP & CRM %s is available. Version %s is a maintenance version, so it contains only fixes of bugs. We recommend everybody using an older version to upgrade to this one. As any maintenance release, no new features, nor data structure change is present into this version. You can download it from the download area of http://www.dolibarr.org portal (subdirectory Stable versions). You can read ChangeLog for complete list of changes.
-
\ No newline at end of file
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index bd1bb09d40f..287a83afba3 100644
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -79,6 +79,8 @@ OrdersOpened=Orders to process
NoOpenedOrders=No open orders
NoOtherOpenedOrders=No other open orders
NoDraftOrders=No draft orders
+NoOrder=No Order
+NoSupplierOrder=No supplier order
OtherOrders=Other orders
LastOrders=Last %s customer orders
LastCustomerOrders=Last %s customer orders
@@ -105,6 +107,7 @@ ClassifyShipped=Classify delivered
ClassifyBilled=Classify billed
ComptaCard=Accountancy card
DraftOrders=Draft orders
+DraftSuppliersOrders=Draft suppliers orders
RelatedOrders=Related orders
RelatedCustomerOrders=Related customer orders
RelatedSupplierOrders=Related supplier orders
diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang
index 168f98a2789..d12d7595f94 100644
--- a/htdocs/langs/en_US/propal.lang
+++ b/htdocs/langs/en_US/propal.lang
@@ -53,6 +53,7 @@ ListOfProposals=List of commercial proposals
ActionsOnPropal=Events on proposal
NoOpenedPropals=No open commercial proposals
NoOtherOpenedPropals=No other open commercial proposals
+NoPropal=No commercial proposal
RefProposal=Commercial proposal ref
SendPropalByMail=Send commercial proposal by mail
AssociatedDocuments=Documents associated with the proposal:
@@ -98,4 +99,4 @@ DocModelJauneDescription=Jaune proposal model
DefaultModelPropalCreate=Default model creation
DefaultModelPropalToBill=Default template when closing a business proposal (to be invoiced)
DefaultModelPropalClosed=Default template when closing a business proposal (unbilled)
-ProposalCustomerSignature=Written acceptance, company stamp, date and signature
\ No newline at end of file
+ProposalCustomerSignature=Written acceptance, company stamp, date and signature
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 0215f20e3c6..f08143c443c 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -134,6 +134,40 @@ class FormProduct
return $out;
}
+ /**
+ * Display form to select warehouse
+ *
+ * @param string $page Page
+ * @param int $selected Id of warehouse
+ * @param string $htmlname Name of select html field
+ * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
+ * @return void
+ */
+ function formSelectWarehouses($page, $selected='', $htmlname='warehouse_id', $addempty=0)
+ {
+ global $langs;
+ if ($htmlname != "none") {
+ print '';
+ } else {
+ if ($selected) {
+ require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php';
+ $warehousestatic=new Entrepot($this->db);
+ $warehousestatic->fetch($selected);
+ print $warehousestatic->getNomUrl();
+ } else {
+ print " ";
+ }
+ }
+ }
+
/**
* Output a combo box with list of units
* pour l'instant on ne definit pas les unites dans la base
|
|