diff --git a/ChangeLog b/ChangeLog index c567d47a9bc..ed4498c342a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -162,7 +162,8 @@ Dolibarr better: creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. - A lot of pages called fiche.php were renamed into card.php - A lot of pages called liste.php were renamed into list.php - +- If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the + warehouse module and your Point Of Sale module if you use one. ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index fd3f74c06c2..9ce93a6bc26 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -534,7 +534,7 @@ dol_fiche_end(); // Show warning about external users -if ($mode != 'marketplace') print '
'.showModulesExludedForExternal($modules).'

'."\n"; +if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n"; llxFooter(); diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 74a9b8c8434..907ed389b38 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -116,7 +116,7 @@ foreach ($modulesdir as $dir) $db->commit(); // Show warning about external users -print showModulesExludedForExternal($modules).'
'."\n"; +print info_admin(showModulesExludedForExternal($modules)).'
'."\n"; print "
\n"; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index d0582a91630..a3109647939 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -193,6 +193,11 @@ if (! empty($conf->expedition->enabled)) print "\n\n\n"; } print ''; + +//if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) +//{ +print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule")); +//} print '
'; // Title rule for stock increase diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 18bb626507f..861267b94f3 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -50,14 +50,13 @@ if (GETPOST('action','alpha') == 'set') $db->begin(); if (GETPOST('socid','int') < 0) $_POST["socid"]=''; - /*if (GETPOST("CASHDESK_ID_BANKACCOUNT") < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]=''; - if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/ - $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",GETPOST('socid','int'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",GETPOST('CASHDESK_ID_WAREHOUSE','alpha'),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",(GETPOST('socid','int') > 0 ? GETPOST('socid','int') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",(GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",(GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",(GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",(GETPOST('CASHDESK_ID_WAREHOUSE','alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",GETPOST('CASHDESK_NO_DECREASE_STOCK','alpha'),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity); dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha')); @@ -129,9 +128,25 @@ if (! empty($conf->banque->enabled)) if (! empty($conf->stock->enabled)) { $var=!$var; - print ''.$langs->trans("CashDeskIdWareHouse").''; + print ''.$langs->trans("CashDeskDoNotDecreaseStock").''; // Force warehouse (this is not a default value) print ''; - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1); + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); + print ''; + + $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; + + $var=!$var; + print ''.$langs->trans("CashDeskIdWareHouse").''; // Force warehouse (this is not a default value) + print ''; + if (! $disabled) + { + print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1,$disabled); + print ' ('.$langs->trans("Create").')'; + } + else + { + print $langs->trans("StockDecreaseForPointOfSaleDisabled"); + } print ''; } diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index 9940e70cc93..dd57a2fd988 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -45,7 +45,17 @@ else -// Left area with selected articles (shopping cart) +$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart'] + +$total_ttc = $obj_facturation->prixTotalTtc(); + +/*var_dump($obj_facturation); +var_dump($_SESSION['poscart']); +var_dump($total_ttc); +exit;*/ + + +// Left area with selected articles (area for article, amount and payments) print '
'; $page=GETPOST('menu','alpha'); @@ -72,13 +82,10 @@ print '
'; - // Right area with selected articles (shopping cart) print '
'; require ('tpl/liste_articles.tpl.php'); -$obj_facturation->prixTotalHt($lst_total_ht); -$obj_facturation->prixTotalTtc($lst_total_ttc); print '
'; diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css index 0972527a73b..f62a9193830 100644 --- a/htdocs/cashdesk/css/style.css +++ b/htdocs/cashdesk/css/style.css @@ -222,6 +222,7 @@ p.titre { margin: 0 15px; padding: 0; max-width: 500px; + width: 100%; } .titre1 { @@ -308,7 +309,7 @@ p.titre { } .texte_ref { - width: 80px; + min-width: 150px; } .texte1,.texte1_off { @@ -321,8 +322,8 @@ p.titre { /* ------------------- */ .textarea_note { - width: 300px; - height: 150px; + width: 100%; + height: 50px; padding: 2px 2px; } @@ -362,7 +363,7 @@ p.titre { } .resume_label,.note_label { - width: 200px; + min-width: 200px; font-weight: bold; font-size: 1.1em; } diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 42e1c00f651..8953f7b0ccc 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -137,16 +137,17 @@ switch ( $_GET['action'] ) case 'ajout_article': // We have clicked on button "Add product" - //var_dump($obj_facturation); + //var_dump('ajout_article'); //exit; - if (! empty($obj_facturation->id)) // A product has been selected and stored in session + if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it { $obj_facturation->qte($_POST['txtQte']); $obj_facturation->tva($_POST['selTva']); $obj_facturation->remisePercent($_POST['txtRemise']); - $obj_facturation->ajoutArticle(); - + $obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart'] + // We update prixTotalTtc + } $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; @@ -160,7 +161,7 @@ switch ( $_GET['action'] ) } - +// We saved object obj_facturation $_SESSION['serObjFacturation'] = serialize($obj_facturation); header('Location: '.$redirection); diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index f0545181ff0..7411b998272 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -32,6 +32,7 @@ $conf_db_base = $dolibarr_main_db_name; $conf_fksoc = (! empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))?$_SESSION["CASHDESK_ID_THIRDPARTY"]:($conf->global->CASHDESK_ID_THIRDPARTY>0?$conf->global->CASHDESK_ID_THIRDPARTY:0); // Identifiant unique correspondant a l'entrepot a utiliser $conf_fkentrepot = (! empty($_SESSION["CASHDESK_ID_WAREHOUSE"]))?$_SESSION["CASHDESK_ID_WAREHOUSE"]:($conf->global->CASHDESK_ID_WAREHOUSE>0?$conf->global->CASHDESK_ID_WAREHOUSE:0); +if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable stock decrease is on, we set warehouse id to 0. // Identifiant unique correspondant au compte caisse / liquide $conf_fkaccount_cash = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CASH>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CASH:0); diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index a2eb40f2932..fa1c6723d20 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -99,16 +99,15 @@ print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf- print ''; print "\n"; -if (! empty($conf->stock->enabled)) +if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { $langs->load("stocks"); print ""; print ''.$langs->trans("Warehouse").''; print ''; $disabled=0; - if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1; // If a particular stock is defined, we disable choice - print $formproduct->selectWarehouses((GETPOST('warehouseid')?GETPOST('warehouseid'):(empty($conf->global->CASHDESK_ID_WAREHOUSE)?'ifone':$conf->global->CASHDESK_ID_WAREHOUSE)),'warehouseid','',!$disabled,$disabled); - //print ''; + if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) $disabled=1; // If a particular stock is defined, we disable choice + print $formproduct->selectWarehouses((GETPOST('warehouseid')?GETPOST('warehouseid','int'):(empty($conf->global->CASHDESK_ID_WAREHOUSE)?'ifone':$conf->global->CASHDESK_ID_WAREHOUSE)),'warehouseid','',!$disabled,$disabled); print ''; print "\n"; } diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index c96b4f2b6f1..db80866a77f 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -36,11 +36,11 @@ $langs->load("cashdesk"); $username = GETPOST("txtUsername"); $password = GETPOST("pwdPassword"); -$thirdpartyid = (GETPOST('socid','int')!='')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY; -$warehouseid = (GETPOST("warehouseid")!='')?GETPOST("warehouseid"):$conf->global->CASHDESK_ID_WAREHOUSE; -$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH"):$conf->global->CASHDESK_ID_BANKACCOUNT_CASH; -$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE"):$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; -$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CB"):$conf->global->CASHDESK_ID_BANKACCOUNT_CB; +$thirdpartyid = (GETPOST('socid','int') > 0)?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY; +$warehouseid = (GETPOST("warehouseid") > 0)?GETPOST("warehouseid",'int'):$conf->global->CASHDESK_ID_WAREHOUSE; +$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH") > 0)?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH",'int'):$conf->global->CASHDESK_ID_BANKACCOUNT_CASH; +$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE") > 0)?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE",'int'):$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; +$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB") > 0)?GETPOST("CASHDESK_ID_BANKACCOUNT_CB",'int'):$conf->global->CASHDESK_ID_BANKACCOUNT_CB; // Check username if (empty($username)) @@ -58,15 +58,15 @@ if (! ($thirdpartyid > 0)) } // If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished. -if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($warehouseid > 0)) +if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && ! ($warehouseid > 0)) { - $retour=$langs->trans("CashDeskSetupStock"); + $retour=$langs->trans("CashDeskYouDidNotDisableStockDecease"); header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); exit; } // If stock decrease on bill validation, check user has stock edit permissions -if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! empty($username)) +if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && ! empty($username)) { $testuser=new User($db); $testuser->fetch(0,$username); @@ -117,8 +117,9 @@ if ( $retour >= 0 ) $_SESSION['uname'] = $username; $_SESSION['lastname'] = $tab['lastname']; $_SESSION['firstname'] = $tab['firstname']; - $_SESSION['CASHDESK_ID_THIRDPARTY'] = $thirdpartyid; - $_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid; + $_SESSION['CASHDESK_ID_THIRDPARTY'] = ($thirdpartyid > 0 ? $thirdpartyid : ''); + $_SESSION['CASHDESK_ID_WAREHOUSE'] = ($warehouseid > 0 ? $warehouseid : ''); + $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : ''); @@ -131,7 +132,6 @@ if ( $retour >= 0 ) { dol_print_error($db); } - } else { diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index f2258c6473e..47116705320 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -43,6 +43,7 @@ $langs->load("cashdesk"); @@ -147,7 +148,7 @@ $langs->load("cashdesk"); - +
diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index e640113e562..e4b6bc14436 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -67,8 +67,6 @@ else } } -$obj_facturation->calculTotaux(); -$total_ttc = $obj_facturation->prixTotalTtc(); echo ('

'.$langs->trans("Total").' : '.price(price2num($total_ttc, 'MT'),0,$langs,0,0,-1,$conf->currency).'

'."\n"); ?> diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 4ee52ce0da6..ce38bb7d7e8 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -72,7 +72,7 @@ print $langs->trans("CashDeskThirdParty").': '.$companyLink.'
'; /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'
'; print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'
'; print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'
';*/ -if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)) +if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { print $langs->trans("CashDeskWarehouse").': '.$warehouseLink; } diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index 15762ecf494..1aa1c0c4723 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -17,6 +17,7 @@ */ $langs->load("main"); +$langs->load("bills"); // Object $form must de defined @@ -111,8 +112,9 @@ $langs->load("main");

trans("Notes"); ?>

- " /> -

trans("RestartSelling"); ?>

+
" />
+
trans("RestartSelling"); ?> +
diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php index 9ebab951eb9..b00268d7b0a 100644 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ b/htdocs/cashdesk/tpl/validation2.tpl.php @@ -18,10 +18,11 @@ */ $langs->load("main"); +$langs->load("bills"); ?> -

trans("SellFinished"); ?>

+

trans("SellFinished"); ?>


diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 173c1894555..fa943acda96 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -218,7 +218,33 @@ switch ($action) $resultcreate=$invoice->create($user,0,dol_stringtotime($obj_facturation->paiementLe())); if ($resultcreate > 0) { - $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), (isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0)); + $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); + if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease=0; // If a particular stock is defined, we disable choice + + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), 0); + + if ($warehouseidtodecrease > 0) + { + // Decrease + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + $langs->load("agenda"); + // Loop on each line + $cpt=count($invoice->lines); + for ($i = 0; $i < $cpt; $i++) + { + if ($invoice->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($db); + $mouvP->origin = &$invoice; + // We decrease stock for product + if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + if ($result < 0) { + $error++; + } + } + } + } } else { @@ -232,7 +258,33 @@ switch ($action) $resultcreate=$invoice->create($user,0,0); if ($resultcreate > 0) { - $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), (isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0)); + $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); + if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease=0; // If a particular stock is defined, we disable choice + + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), 0); + + if ($warehouseidtodecrease > 0) + { + // Decrease + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + $langs->load("agenda"); + // Loop on each line + $cpt=count($invoice->lines); + for ($i = 0; $i < $cpt; $i++) + { + if ($invoice->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($db); + $mouvP->origin = &$invoice; + // We decrease stock for product + if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + if ($result < 0) { + $error++; + } + } + } + } $id = $invoice->id; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 15a74483411..ca4c27bfdbc 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -94,6 +94,13 @@ $object->substitutionarrayfortest=array( //,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet ); +// List of sending methods +$listofmethods=array(); +$listofmethods['mail']='PHP mail function'; +//$listofmethods['simplemail']='Simplemail class'; +$listofmethods['smtps']='SMTP/SMTPS socket library'; + + /* * Actions @@ -741,10 +748,21 @@ else { // Define message to recommand from command line - // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message + $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; + if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) + if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') + { + // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. + // You ensure that every user is using its own SMTP server. + $linktoadminemailbefore=''; + $linktoadminemailend=''; + setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings'); + setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 'warnings'); + if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), 'warnings'); + $_GET["action"]=''; + } + else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message @@ -764,7 +782,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,270); } } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 49d2f1befa2..75f2399017b 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -276,7 +276,8 @@ if ($object->fetch($id) >= 0) $obj = new $classname($db); - $qualified=1; + // Check dependencies + $qualified=(isset($obj->enabled)?$obj->enabled:1); foreach ($obj->require_module as $key) { if (! $conf->$key->enabled || (! $user->admin && $obj->require_admin)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a6877ad9ed8..b924b059bfd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1600,7 +1600,7 @@ class Facture extends CommonInvoice * * @param User $user Object user that validate * @param string $force_number Reference to force on invoice - * @param int $idwarehouse Id of warehouse to use for stock decrease + * @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease) * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >0 if OK */ @@ -1728,7 +1728,7 @@ class Facture extends CommonInvoice $result=$this->client->set_as_client(); // Si active on decremente le produit principal et ses composants a la validation de facture - if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 87ee2f1a1d2..1b0438bdea1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3016,30 +3016,33 @@ abstract class CommonObject $marginInfo = $this->getMarginInfos($force_price); - print $langs->trans('ShowMarginInfos').' : '; - $hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']; - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // FIXME Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better + { + print $langs->trans('ShowMarginInfos').' : '; + $hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; - print ''; - if (!empty($hidemargininfos)) print ''; - - print ''; + print ''; + if (!empty($hidemargininfos)) print ''; + } + + print '
'; print ''; - print ''; - print ''; + print ''; + print ''; if ($conf->global->MARGIN_TYPE == "1") - print ''; + print ''; else - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; if (! empty($conf->product->enabled)) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 042474781d7..30ecadedb55 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -53,9 +53,10 @@ class FormAdmin * @param array $filter Array of keys to exclude in list * @param int $showempty Add empty value * @param int $showwarning Show a warning if language is not complete + * @param int $disabled Disable edit of select * @return string Return HTML select string with list of languages */ - function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0) + function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0,$disabled=0) { global $langs; @@ -63,7 +64,7 @@ class FormAdmin $out=''; - $out.= ''; if ($showempty) { $out.= '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').'
'; // Ref @@ -206,9 +224,9 @@ if ($action == 'create') print '
'; - print '
'; - print ''; - print '
'; + dol_fiche_end(); + + print '
'; print ''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7ccc75bc357..476c394ecc1 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -633,12 +633,14 @@ if ($resql) print ''.$obj->reel.($obj->reel<0?' '.img_warning():'').''; // PMP print ''.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').''; // Ditto : Show PMP from movement or from product + // Value purchase print ''.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').''; // Ditto : Show PMP from movement or from product // Sell price print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); else print $langs->trans("Variable"); print ''; // Ditto : Show PMP from movement or from product + // Value sell print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).''; // Ditto : Show PMP from movement or from product else print $langs->trans("Variable"); @@ -669,6 +671,7 @@ print ''.$total.''; print ''; print ($totalwithpmp?price($totalvalue/$totalwithpmp):' '); print ''; +// Value purchase print ''; print price(price2num($totalvalue,'MT'),1); print ''; @@ -676,6 +679,7 @@ print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total,1):' '); else print $langs->trans("Variable"); print ''; +// Value to sell print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($totalvaluesell,'MT'),1); else print $langs->trans("Variable"); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 5ac8a76fb53..c4d933d4940 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1958,6 +1958,10 @@ input.liste_titre { background: none; } +.margintable td { + border: 0px !important; +} + /* Disable shadows */ .noshadow { -moz-box-shadow: 0px 0px 0px #DDD !important; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 3bca4cbee47..860e74c5567 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -179,10 +179,10 @@ if ($action == 'edit') print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print ''; print 'conf->MAIN_LANG_DEFAULT)?" checked":""); - print ! empty($dolibarr_main_demo)?' disabled="disabled"':''; // Disabled for demo + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; - print $formadmin->select_language((! empty($fuser->conf->MAIN_LANG_DEFAULT)?$fuser->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1); + print $formadmin->select_language((! empty($fuser->conf->MAIN_LANG_DEFAULT)?$fuser->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1,null,0,0,(! empty($dolibarr_main_demo))); print ''; // Taille max des listes @@ -190,7 +190,7 @@ if ($action == 'edit') print ''.$langs->trans("MaxSizeList").''; print ''.$conf->global->MAIN_SIZE_LISTE_LIMIT.''; print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); - print ! empty($dolibarr_main_demo)?' disabled="disabled"':''; // Disabled for demo + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index f9dbb54f8f4..b63b3e65ffc 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -276,7 +276,7 @@ print '
'; if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'
'; // Show warning about external users -if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'

'."\n"; +if (empty($user->societe_id)) print info_admin(showModulesExludedForExternal($modules)).'

'."\n"; // For multicompany transversal mode // TODO Place a hook here