[Qual] Uniformize code
This commit is contained in:
parent
c0872d690e
commit
b34edeb751
@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$reload = 0;
|
$reload = 0;
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action= "edit";
|
$action= "edit";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,7 +105,7 @@ if (empty($reshook))
|
|||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->code_compta=$_POST["customeraccountancycode"];
|
$object->code_compta=$_POST["customeraccountancycode"];
|
||||||
$result=$object->update($object->id,$user,1,1,0);
|
$result=$object->update($object->id,$user,1,1,0);
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// conditions de reglement
|
// conditions de reglement
|
||||||
@ -113,7 +113,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// mode de reglement
|
// mode de reglement
|
||||||
@ -121,7 +121,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// assujetissement a la TVA
|
// assujetissement a la TVA
|
||||||
@ -130,7 +130,7 @@ if (empty($reshook))
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->tva_assuj=$_POST['assujtva_value'];
|
$object->tva_assuj=$_POST['assujtva_value'];
|
||||||
$result=$object->update($object->id);
|
$result=$object->update($object->id);
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// set prospect level
|
// set prospect level
|
||||||
@ -157,7 +157,7 @@ if (empty($reshook))
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||||
$result=$object->set_OutstandingBill($user);
|
$result=$object->set_OutstandingBill($user);
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -359,7 +359,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$statut=2; // Status 'sent partially' (because at least one error)
|
$statut=2; // Status 'sent partially' (because at least one error)
|
||||||
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||||
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2010-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
@ -131,7 +131,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if (! GETPOST('socid', 3))
|
if (! GETPOST('socid', 3))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ if (empty($reshook))
|
|||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ if (empty($reshook))
|
|||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans($object->error), 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,8 +211,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
else setEventMessage($langs->trans($object->error), 'errors');
|
else setEventMessages($langs->trans($object->error), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$id = $object->create_from($user);
|
$id = $object->create_from($user);
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), 'errors');
|
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), null, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$object->ref = GETPOST('ref');
|
$object->ref = GETPOST('ref');
|
||||||
@ -507,7 +507,7 @@ if (empty($reshook))
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
|
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ if (empty($reshook))
|
|||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->insert_discount($_POST["remise_id"]);
|
$result = $object->insert_discount($_POST["remise_id"]);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -875,7 +875,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
||||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
||||||
setEventMessage($mesg, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit);
|
||||||
@ -929,13 +929,13 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour d'une ligne dans la propale
|
// Update a line within proposal
|
||||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
||||||
{
|
{
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
@ -991,7 +991,7 @@ if (empty($reshook))
|
|||||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||||
|
|
||||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1040,7 +1040,7 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1137,9 +1137,9 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1636,13 +1636,13 @@ if ($action == 'create')
|
|||||||
else if ($action == 'validate') {
|
else if ($action == 'validate') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// on verifie si l'objet est en numerotation provisoire
|
// We verifie whether the object is provisionally numbering
|
||||||
$ref = substr($object->ref, 1, 4);
|
$ref = substr($object->ref, 1, 4);
|
||||||
if ($ref == 'PROV') {
|
if ($ref == 'PROV') {
|
||||||
$numref = $object->getNextNumRef($soc);
|
$numref = $object->getNextNumRef($soc);
|
||||||
if (empty($numref)) {
|
if (empty($numref)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$numref = $object->ref;
|
$numref = $object->ref;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||||
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -54,12 +54,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($ret == 0)
|
if ($ret == 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
|
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else if ($ret < 0)
|
else if ($ret < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout d'un nouveau contact
|
* Add a new contact
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||||
@ -96,16 +96,16 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
|
|||||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bascule du statut d'un contact
|
// Toggle the status of a contact
|
||||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
@ -114,7 +114,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Deletes a contact
|
||||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$result = $object->delete_contact($lineid);
|
$result = $object->delete_contact($lineid);
|
||||||
|
|||||||
@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
|||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorFailedToLoadDiscount"), 'errors');
|
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
|
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors');
|
setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error && $discount->fk_facture_line)
|
if (! $error && $discount->fk_facture_line)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors');
|
setEventMessages($langs->trans("ErrorCantSplitAUsedDiscount"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -166,13 +166,13 @@ if ($action == 'setremise')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($soc->error, 'errors');
|
setEventMessages($soc->error, $soc->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), 'errors');
|
setEventMessages($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($discount->error, 'errors');
|
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ if ($socid > 0)
|
|||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Display tabs
|
||||||
*/
|
*/
|
||||||
$head = societe_prepare_head($object);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ if ($socid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture)
|
* Liste remises fixes restant en cours (= liees a aucune facture ni ligne de facture)
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||||
$sql.= " rc.datec as dc, rc.description,";
|
$sql.= " rc.datec as dc, rc.description,";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user