Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
3d7050e051
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ else if ($action == 'delete')
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($accounting->error, 'errors');
|
||||
setEventMessages($accounting->error, $accounting->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 '<div><font color="red">' . $langs->trans("AnyLineImport") . '</font></div>';
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
} else {
|
||||
|
||||
|
||||
@ -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();
|
||||
$db->close();
|
||||
|
||||
@ -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").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||
}
|
||||
|
||||
// Ask for warehouse during order
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td> </td><td align="center">';
|
||||
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 '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("ProposalsDraft").' <span class="badge">'.$num.'</span></td></tr>';
|
||||
print '<td colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@ -182,6 +186,10 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
@ -219,7 +227,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftOrders").' <span class="badge">'.$num.'</span></td></tr>';
|
||||
print '<td colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||
|
||||
if ($num)
|
||||
{
|
||||
@ -257,10 +265,96 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
$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 '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$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 '</td>';
|
||||
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($total>0)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -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='<div class="error">'.$commande->error.'</div>';
|
||||
}
|
||||
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 '<table class="border" width="100%">';
|
||||
|
||||
@ -286,6 +314,27 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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 '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('Warehouse');
|
||||
print '</td>';
|
||||
if ($action != 'editwarehouse' && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&id='.$commande->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
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 '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -529,7 +578,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Qty ordered
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
print '<td align="center">' . ($objp->qty!=1?'<span class="badge">'.$objp->qty.'</span>':$objp->qty) . '</td>';
|
||||
|
||||
// Qty already shipped
|
||||
$qtyProdCom=$objp->qty;
|
||||
@ -677,7 +726,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<td'.($warehousecanbeselectedlater?'':' class="fieldrequired"').'>'.$langs->trans("WarehouseSource").'</td>';
|
||||
print '<td>';
|
||||
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").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 <a href="https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog">ChangeLog</a> 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 <a href="https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog">ChangeLog</a> for complete list of changes.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
ProposalCustomerSignature=Written acceptance, company stamp, date and signature
|
||||
|
||||
@ -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 '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setwarehouse">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print $this->selectWarehouses($selected, $htmlname, '', $addempty);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
} 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user