diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 84d4ddc3679..85a45e9ff45 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -643,7 +643,7 @@ class Setup extends DolibarrApi public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { $list = array(); - $sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking"; + $sql = "SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking"; $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t"; $sql .= " WHERE t.active = ".$active; // Add sql filters diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 864de6e2e98..4fb2a1aede4 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -285,16 +285,19 @@ print dol_get_fiche_end(); */ print "
\n"; +$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +if (empty($reshook)) { + if ($user->rights->categorie->creer) + { + $socid = ($object->socid ? "&socid=".$object->socid : ""); + print ''.$langs->trans("Modify").''; + } -if ($user->rights->categorie->creer) -{ - $socid = ($object->socid ? "&socid=".$object->socid : ""); - print ''.$langs->trans("Modify").''; -} - -if ($user->rights->categorie->supprimer) -{ - print 'id.'&type='.$type.'">'.$langs->trans("Delete").''; + if ($user->rights->categorie->supprimer) + { + print 'id.'&type='.$type.'">'.$langs->trans("Delete").''; + } } print "
"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e1f6fb38dbc..cfcdead5fed 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -148,7 +148,7 @@ llxHeader('', $langs->trans('ListPayment')); if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. - $sql = "SELECT p.ref, p.datep, p.amount, p.statut, p.num_paiement"; + $sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement"; $sql .= ", c.code as paiement_code"; // Add fields from hooks @@ -166,7 +166,7 @@ if (GETPOST("orphelins", "alpha")) { $sql .= $hookmanager->resPrint; } else { // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql = "SELECT DISTINCT p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement"; + $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement"; $sql .= ", c.code as paiement_code"; $sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; @@ -390,7 +390,7 @@ while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); $object->id = $objp->rowid; - $object->ref = $objp->ref; + $object->ref = ($objp->ref ? $objp->ref : $objp->rowid); $companystatic->id = $objp->socid; $companystatic->name = $objp->name; @@ -497,6 +497,14 @@ while ($i < min($num, $limit)) { // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; +// If no record found +if ($num == 0) +{ + $colspan = 1; + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + print ""; print ""; print ""; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 5d87303236a..b58b4ddec0c 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -98,7 +98,13 @@ if (empty($reshook)) // Seems to no be used and replaced with $action == 'infocredit' if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') { - $res = $object->set_credite(); + if ($object->statut == 2) { + $res = -1; + setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); + } else { + $res = $object->set_credite(); + } + if ($res >= 0) { header("Location: card.php?id=".$id); @@ -145,10 +151,16 @@ if (empty($reshook)) { $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $error = $object->set_infocredit($user, $dt); + if ($object->statut == 2) { + $error = 1; + setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); + } else { + $error = $object->set_infocredit($user, $dt); + } + if ($error) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 553e3ac0eaa..eb26ee91a6f 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -44,6 +44,7 @@ MakeBankTransferOrder=Make a credit transfer request WithdrawRequestsDone=%s direct debit payment requests recorded ThirdPartyBankCode=Third-party bank code NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. +WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries. ClassCredited=Classify credited ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account? TransData=Transmission date diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index e20eca0c75f..771fcfbcc83 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -45,6 +45,7 @@ WithdrawRequestsDone=%s demandes de prélèvements enregistrées BankTransferRequestsDone=%s demande de prélèvement enregistrée ThirdPartyBankCode=Code banque du tiers NoInvoiceCouldBeWithdrawed=Aucune facture traitée avec succès. Vérifiez que les factures sont sur les sociétés avec un BAN par défaut valide et que le BAN a un RUM avec le mode %s . +WithdrawalCantBeCreditedTwice=Ce bon de prélèvement est déjà classé crédité ; cette opération ne peut pas être réalisée deux fois, car cela pourrait engendrer des doublons dans les paiements et les écritures bancaires. ClassCredited=Classer crédité ClassCreditedConfirm=Êtes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ? TransData=Date de transmission diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 05ca7f27d16..2e04e34dcac 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -203,7 +203,7 @@ class MyModuleApi extends DolibarrApi foreach ($request_data as $field => $value) { $this->myobject->$field = $value; } - if (!$this->myobject->create(DolibarrApiAccess::$user)) { + if ($this->myobject->create(DolibarrApiAccess::$user)<0) { throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); } return $this->myobject->id; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 779bf573341..cc00738ebeb 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -433,15 +433,15 @@ if ($sql_select) // Status print ''; - if ($type_element == 'contract') - { - print $documentstaticline->getLibStatut(2); + if ($type_element == 'contract') { + print $documentstaticline->getLibStatut(5); } else { - print $documentstatic->getLibStatut(2); + print $documentstatic->getLibStatut(5); } print ''; - print ''; + // Label + print ''; // Define text, description and type $text = ''; $description = ''; $type = 0; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5b5e9685628..0df74bc166e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1343,6 +1343,14 @@ while ($i < min($num, $limit)) $i++; } +// If no record found +if ($num == 0) +{ + $colspan = 1; + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b641efd2502..8062368d360 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales $action = GETPOST('action', 'aZ09');