Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/fourn/commande/card.php
	htdocs/langs/en_US/main.lang
This commit is contained in:
Laurent Destailleur 2020-08-27 21:57:42 +02:00
commit 4ecd15b7ab
12 changed files with 102 additions and 23 deletions

View File

@ -2,8 +2,8 @@
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -289,6 +290,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
*/
$formaccounting = new FormAccounting($db);
$formfile = new FormFile($db);
$formother = new FormOther($db);
$form = new Form($db);

View File

@ -41,7 +41,7 @@ class InfoBox
{
return array(
0 => 'Home',
27 => 'Accountancy Home'
27 => 'AccountancyHome'
);
} else {
return array(
@ -72,7 +72,7 @@ class InfoBox
24 => 'expensereportindex',
25 => 'mailingindex',
26 => 'opensurveyindex',
27 => 'Accountancy Home'
27 => 'AccountancyHome'
);
}
}

View File

@ -2068,7 +2068,7 @@ function pdf_getTotalQty($object, $type, $outputlangs)
*/
function pdf_getLinkedObjects($object, $outputlangs)
{
global $hookmanager;
global $db, $hookmanager;
$linkedobjects = array();
@ -2130,8 +2130,13 @@ function pdf_getLinkedObjects($object, $outputlangs)
// We concat this record info into fields xxx_value. title is overwrote.
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
{
$elementobject->fetchObjectLinked();
if (!empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']);
$elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (! empty($elementobject->linkedObjectsIds['commande'])){
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$order = new Commande($db);
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
if ($ret < 1) { $order=null; }
}
}
if (!is_object($order))
{

View File

@ -652,7 +652,9 @@ if (empty($reshook))
*/
if ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha'))
{
$vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0);
$db->begin();
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
if ($lineid)
{
@ -780,7 +782,11 @@ if (empty($reshook))
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db, $result);
}
$db->commit();
} else {
$db->rollback();
dol_print_error($db, $object->error);
exit;
}
@ -789,6 +795,8 @@ if (empty($reshook))
// Remove a product line
if ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
{
$db->begin();
$result = $object->deleteline($lineid);
if ($result > 0)
{
@ -807,19 +815,28 @@ if (empty($reshook))
$ret = $object->fetch($object->id); // Reload to get new records
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
// Reset action to avoid asking again confirmation on failure
$action = '';
}
if (!$error) {
$db->commit();
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
/* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */
$action = '';
$db->rollback();
}
}
// Validate
if ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate)
{
$db->begin();
$object->date_commande = dol_now();
$result = $object->valid($user);
if ($result >= 0)
@ -839,21 +856,33 @@ if (empty($reshook))
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db, $result);
if ($result < 0) {
$error++;
dol_print_error($db, $result);
}
}
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
// If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step
if (empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $usercanapprove && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)))
if (!$error && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $usercanapprove && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)))
{
$action = 'confirm_approve'; // can make standard or first level approval also if permission is set
}
if (! $error) {
$db->commit();
} else {
$db->rollback();
}
}
if (($action == 'confirm_approve' || $action == 'confirm_approve2') && $confirm == 'yes' && $usercanapprove)
{
$db->begin();
$idwarehouse = GETPOST('idwarehouse', 'int');
$qualified_for_stock_change = 0;
@ -891,12 +920,20 @@ if (empty($reshook))
}
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
exit;
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (!$error) {
$db->commit();
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
exit;
} else {
$db->rollback();
}
}
if ($action == 'confirm_refuse' && $confirm == 'yes' && $usercanapprove)
@ -923,6 +960,8 @@ if (empty($reshook))
if ($action == 'confirm_commande' && $confirm == 'yes' && $usercanorder)
{
$db->begin();
$result = $object->commande($user, GETPOST("datecommande"), GETPOST("methode", 'int'), GETPOST('comment', 'alphanohtml'));
if ($result > 0)
{
@ -939,10 +978,18 @@ if (empty($reshook))
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
$action = '';
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
if (!$error) {
$db->commit();
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
@ -987,6 +1034,8 @@ if (empty($reshook))
// Set status of reception (complete, partial, ...)
if ($action == 'livraison' && $usercanreceived)
{
$db->begin();
if (GETPOST("type") != '')
{
$date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear"));
@ -999,13 +1048,22 @@ if (empty($reshook))
$action = '';
} elseif ($result == -3)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Delivery")), null, 'errors');
}
if (! $error) {
$db->commit();
} else {
$db->rollback();
}
}
if ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanorder)
@ -1907,7 +1965,7 @@ if ($action == 'create')
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {

View File

@ -1771,7 +1771,9 @@ if ($action == 'create')
print '</td></tr>';
// Ref supplier
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : $objectsrc->ref_supplier).'" type="text"></td>';
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : $objectsrc->ref_supplier).'" type="text"';
if ($societe->id > 0) print ' autofocus';
print '></td>';
print '</tr>';
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td>';

View File

@ -242,7 +242,7 @@ class DoliStorage implements TokenStorageInterface
$sql.= " WHERE service='".$this->db->escape($service)."'";
$resql = $this->db->query($sql);
$result = $this->db->fetch_array($resql);
$states[$service] = $result[state];
$states[$service] = $result['state'];
$this->states[$service] = $states[$service];
return is_array($states)

View File

@ -839,9 +839,16 @@ Permission532=Create/modify services
Permission534=Delete services
Permission536=See/manage hidden services
Permission538=Export services
Permission561=Read payment orders by credit transfer
Permission562=Create/modify payment order by credit transfer
Permission563=Send/Transmit payment order by credit transfer
Permission564=Record Debits/Rejections of credit transfer
Permission650=Read Bills of Materials
Permission651=Create/Update Bills of Materials
Permission652=Delete Bills of Materials
Permission660=Read Manufacturing Order (MO)
Permission661=Create/Update Manufacturing Order (MO)
Permission662=Delete Manufacturing Order (MO)
Permission701=Read donations
Permission702=Create/modify donations
Permission703=Delete donations
@ -851,6 +858,8 @@ Permission773=Delete expense reports
Permission774=Read all expense reports (even for user not subordinates)
Permission775=Approve expense reports
Permission776=Pay expense reports
Permission777=Read expense reports of everybody
Permission778=Create/modify expense reports of everybody
Permission779=Export expense reports
Permission1001=Read stocks
Permission1002=Create/modify warehouses
@ -903,6 +912,7 @@ Permission2515=Setup documents directories
Permission2801=Use FTP client in read mode (browse and download only)
Permission2802=Use FTP client in write mode (delete or upload files)
Permission3200=Read archived events and fingerprints
Permission3301=Generate new modules
Permission4001=See employees
Permission4002=Create employees
Permission4003=Delete employees

View File

@ -102,3 +102,5 @@ SuspenseAccountNotDefined=Suspense account isn't defined
BoxLastCustomerShipments=Last customer shipments
BoxTitleLastCustomerShipments=Latest %s customer shipments
NoRecordedShipments=No recorded customer shipment
# Pages
AccountancyHome=Accountancy

View File

@ -1076,6 +1076,7 @@ NotUsedForThisCustomer=Not used for this customer
AmountMustBePositive=Amount must be positive
ByStatus=By status
InformationMessage=Information
Used=Used
ASAP=As Soon As Possible
CREATEInDolibarr=Record %s create
MODIFYInDolibarr=Record %s modified

View File

@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.cl
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
if (!empty($conf->barcode->enabled)) dol_include_once('/core/class/html.formbarcode.class.php');
// Load translation files required by the page
$langs->loadLangs(array('products', 'suppliers', 'bills', 'margins'));
$langs->loadLangs(array('products', 'suppliers', 'bills', 'margins', 'stocks'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');

View File

@ -1272,7 +1272,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
// List of Stripe payment modes
if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $object->fournisseur && !empty($stripesupplieracc))
{
print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, '');
print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'stripe-s');
$balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc));
print '<table class="liste centpercent">'."\n";
print '<tr class="liste_titre">';

View File

@ -365,8 +365,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
if (!empty($conf->global->$keyforsumupbank)) {
print '<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button>';
} else {
$langs->load("errors");
$langs->load("admin");
$langs->loadLangs(array("errors", "admin"));
print '<button type="button" class="calcbutton2 disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
}
}