diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d9c0c7b399f..e5a18626b42 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,8 +2,8 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * 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); diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index fb4aaf4e7ff..70569f08eb7 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -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' ); } } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 50182dc5c56..deacc6c128b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -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)) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 7a50a189e44..0fe543f5bfd 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -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 .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $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 .= ''; $morehtmlref .= '
'; } else { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 7e8796e44f6..da2ac2f7824 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1771,7 +1771,9 @@ if ($action == 'create') print ''; // Ref supplier - print ''.$langs->trans('RefSupplier').''; + print ''.$langs->trans('RefSupplier').'id > 0) print ' autofocus'; + print '>'; print ''; print ''.$langs->trans('Type').''; diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 74d3356faeb..b2a79dc4751 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -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) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1daec4b0001..54569be2383 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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 diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index f4ee6768626..ab89bc10c4b 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -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 diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 186272da1b6..0af5c66f0e0 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -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 diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 77073763503..d2a190f8149 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -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'); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index e02a41dab86..16b29836a60 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -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 ''."\n"; print ''; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index f63aec61289..a3e38d22e71 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -365,8 +365,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) { if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { - $langs->load("errors"); - $langs->load("admin"); + $langs->loadLangs(array("errors", "admin")); print ''; } }