diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 3988a986f67..62b251ac01d 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -124,6 +124,14 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
+ // customer preferred shipping method
+ if ($action == 'setshippingmethod' && $user->rights->societe->creer)
+ {
+ $object->fetch($id);
+ $result = $object->setShippingMethod(GETPOST('shipping_method_id','int'));
+ if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
+ }
+
// assujetissement a la TVA
if ($action == 'setassujtva' && $user->rights->societe->creer)
{
@@ -239,8 +247,8 @@ if ($id > 0)
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '
' . $langs->trans( "Categories" ) . ' ';
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index c1754999e8b..dea894a0258 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1320,6 +1320,9 @@ if ($action == 'create')
print $soc->getNomUrl(1);
print ' ';
print '';
+ if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
+ $shipping_method_id = $soc->shipping_method_id;
+ }
} else {
print '';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1);
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 6078d871f3f..af5131d9c33 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -17,7 +17,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
-insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
+insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/hrm.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
-- Home - Dashboard
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'Dashboard', 0, '', '', '', 2, 0, __ENTITY__);
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index d4d396cf892..d1df6fcb6e5 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -223,9 +223,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
$idsel='hrm';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
- if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/compta/hrm.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget);
+ if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/hrm/hrm.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
- $menu->add('/compta/hrm.php?mainmenu=hrm&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
+ $menu->add('/hrm/hrm.php?mainmenu=hrm&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
}
diff --git a/htdocs/compta/hrm.php b/htdocs/hrm/hrm.php
similarity index 99%
rename from htdocs/compta/hrm.php
rename to htdocs/hrm/hrm.php
index 3f1b77a6697..daef4feef45 100644
--- a/htdocs/compta/hrm.php
+++ b/htdocs/hrm/hrm.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2011 Dimitri Mouillard
* Copyright (C) 2013-2015 Laurent Destailleur
* Copyright (C) 2012-2014 Regis Houssin
- * Copyright (C) 2015 Alexandre Spangaro
+ * Copyright (C) 2015-2016 Alexandre Spangaro
*
* 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
@@ -19,7 +19,7 @@
*/
/**
- * \file htdocs/compta/hrm.php
+ * \file htdocs/hrm/hrm.php
* \ingroup hrm
* \brief Home page for HRM area.
*/
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index eb0a203fa92..d9898fbe3c0 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -180,6 +180,7 @@ CREATE TABLE llx_multicurrency_rate
ALTER TABLE llx_societe ADD COLUMN fk_multicurrency integer;
ALTER TABLE llx_societe ADD COLUMN multicurrency_code varchar(255);
+ALTER TABLE llx_societe ADD COLUMN fk_shipping_method integer AFTER cond_reglement_supplier;
ALTER TABLE llx_product_price ADD COLUMN fk_multicurrency integer;
ALTER TABLE llx_product_price ADD COLUMN multicurrency_code varchar(255);
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index 82e3b420e29..9822272e7c2 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -85,6 +85,7 @@ create table llx_societe
cond_reglement tinyint, -- condition de reglement
mode_reglement_supplier tinyint, -- mode de reglement fournisseur
cond_reglement_supplier tinyint, -- condition de reglement fournisseur
+ fk_shipping_method integer, -- preferred shipping method id
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax1_value double(6,3),
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 265882345ac..3468dc43eee 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1114,6 +1114,7 @@ BrowserIsKO=You are using the web browser %s. This browser is known to be a bad
XDebugInstalled=XDebug is loaded.
XCacheInstalled=XCache is loaded.
AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink. Third parties will appears with name "CC12345 - SC45678 - The big company coorp", instead of "The big company coorp".
+AskForPreferredShippingMethod=Ask for preferred Sending Method for Third Parties.
FieldEdition=Edition of field %s
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
GetBarCode=Get barcode
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index 44d1025b3db..d0554309539 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -469,7 +469,7 @@ class Productbatch extends CommonObject
* @param DoliDB $db database object
* @param int $fk_product_stock id product_stock for objet
* @param int $with_qty doesn't return line with 0 quantity
- * @return int <0 if KO, >0 if OK
+ * @return array <0 if KO, array of batch
*/
public static function findAll($db,$fk_product_stock,$with_qty=0)
{
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index e69d098ea7d..8e7fe40859b 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -225,6 +225,20 @@ if ($action=="setaddrefinlist") {
}
}
+//Activate Ask For Preferred Shipping Method
+if ($action=="setaskforshippingmet") {
+ $setaskforshippingmet = GETPOST('value','int');
+ $res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity);
+ if (! $res > 0) $error++;
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
//Activate ProfId mandatory
if ($action == 'setprofidmandatory')
@@ -777,6 +791,26 @@ print ' ';
print ' ';
+$var=!$var;
+print "