diff --git a/ChangeLog b/ChangeLog index 8255f3ca5f8..4119f205369 100644 --- a/ChangeLog +++ b/ChangeLog @@ -150,6 +150,8 @@ WARNING: Dolibarr 3.9 is not yet fully compatible with PHP 7. +Mysql minimum version is now 5.0.3 + Following changes may create regression for some external modules, but were necessary to make Dolibarr better: - Deprecated Product::setPriceExpression. Use Product::update instead diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0500ac4a0a7..77c9a4a135e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; // Langs $langs->load("accountancy"); @@ -41,12 +42,24 @@ $piece_num = GETPOST("piece_num"); $mesg = ''; -$numero_compte = GETPOST('numero_compte'); +$account_number = GETPOST('account_number'); $code_tiers = GETPOST('code_tiers'); +if ($code_tiers==-1) { + $code_tiers=null; +} $label_compte = GETPOST('label_compte'); $debit = price2num(GETPOST('debit')); $credit = price2num(GETPOST('credit')); +$save=GETPOST('save'); +if (!empty($save)) { + $action='add'; +} +$update=GETPOST('update'); +if (!empty($update)) { + $action='confirm_update'; +} + if ($action == "confirm_update") { $error = 0; @@ -63,7 +76,7 @@ if ($action == "confirm_update") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - $book->numero_compte = $numero_compte; + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; $book->debit = $debit; @@ -92,15 +105,15 @@ if ($action == "confirm_update") { else if ($action == "add") { $error = 0; - if ((intval($debit) != 0) && (intval($credit) != 0)) { - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $error ++; - } + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $error ++; + } if (empty($error)) { $book = new BookKeeping($db); - $book->numero_compte = $numero_compte; + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; $book->debit = $debit; @@ -113,11 +126,12 @@ else if ($action == "add") { $book->fk_doc = GETPOST('fk_doc'); $book->fk_docdet = GETPOST('fk_docdet'); - if (! empty($debit)) { + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } - if (! empty($credit)) { + + if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } @@ -179,6 +193,7 @@ else if ($action == "confirm_create") { llxHeader(); $html = new Form($db); +$formventilation = new FormVentilation($db); /* * Confirmation to delete the command @@ -281,9 +296,21 @@ if ($action == 'create') { } else { print load_fiche_titre($langs->trans("ListeMvts")); + + print '
'; } } - } - else { + } else { print load_fiche_titre($langs->trans("NoRecords")); } } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 26a30171677..c5fea407a12 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -19,18 +19,17 @@ */ /** - * \file htdocs/accountancy/bookkeeping/list.php - * \ingroup Accounting Expert - * \brief List operation of book keeping + * \file htdocs/accountancy/bookkeeping/list.php + * \ingroup Accounting Expert + * \brief List operation of book keeping */ - require '../../main.inc.php'; - + // Class -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Langs $langs->load("accountancy"); @@ -58,11 +57,11 @@ $formother = new FormOther($db); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $search_doc_type=""; - $search_doc_ref=""; - $search_account=""; - $search_thirdparty=""; - $search_journal=""; + $search_piece_num = ""; + $search_doc_ref = ""; + $search_account = ""; + $search_thirdparty = ""; + $search_journal = ""; } /* @@ -80,8 +79,7 @@ if ($action == 'delbookkeeping') { setEventMessages($object->error, $object->errors, 'errors'); } } -} -elseif ($action == 'delbookkeepingyear') { +} elseif ($action == 'delbookkeepingyear') { $delyear = GETPOST('delyear', 'int'); @@ -93,8 +91,7 @@ elseif ($action == 'delbookkeepingyear') { setEventMessages($object->error, $object->errors, 'errors'); } } -} -elseif ($action == 'delbookkeepingyear') { +} elseif ($action == 'delbookkeepingyear') { $delyear = GETPOST('delyear', 'int'); @@ -106,7 +103,7 @@ elseif ($action == 'delbookkeepingyear') { setEventMessages($object->error, $object->errors, 'errors'); } } -}// Export +} // Export else if ($action == 'export_csv') { header('Content-Type: text/csv'); @@ -118,19 +115,55 @@ else if ($action == 'export_csv') { setEventMessages($object->error, $object->errors, 'errors'); } - foreach ( $object->linesexport as $line ) { - print $line->id . ','; - print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; - print '"' . $line->code_journal . '",'; - print '"' . $line->numero_compte . '",'; - print '"' . substr($line->code_journal, 0, 2) . '",'; - print '"' . substr($line->doc_ref, 0, 40) . '",'; - print '"' . $line->num_piece . '",'; - print '"' . $line->montant . '",'; - print '"' . $line->sens . '",'; - print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; - print '"' . $conf->currency . '",'; - print "\n"; + // Model classic Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) { + + foreach ( $object->linesexport as $line ) { + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $line->code_journal . '",'; + print '"' . $line->numero_compte . '",'; + print '"' . substr($line->code_journal, 0, 2) . '",'; + print '"' . substr($line->doc_ref, 0, 40) . '",'; + print '"' . $line->num_piece . '",'; + print '"' . $line->debit . '",'; + print '"' . $line->credit . '",'; + print '"' . $conf->currency . '",'; + print "\n"; + } + } + // Model cegid Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { + foreach ( $object->linesexport as $line ) { + print $line->id . ','; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $line->code_journal . '",'; + print '"' . $line->numero_compte . '",'; + print '"' . substr($line->code_journal, 0, 2) . '",'; + print '"' . substr($line->doc_ref, 0, 40) . '",'; + print '"' . $line->num_piece . '",'; + print '"' . $line->montant . '",'; + print '"' . $line->sens . '",'; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $conf->currency . '",'; + print "\n"; + } + } + // Model Coala Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) { + foreach ( $object->linesexport as $line ) { + print $line->id . ','; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $line->code_journal . '",'; + print '"' . $line->numero_compte . '",'; + print '"' . substr($line->code_journal, 0, 2) . '",'; + print '"' . substr($line->doc_ref, 0, 40) . '",'; + print '"' . $line->num_piece . '",'; + print '"' . $line->montant . '",'; + print '"' . $line->sens . '",'; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $conf->currency . '",'; + print "\n"; + } } } @@ -138,16 +171,16 @@ else { llxHeader('', $langs->trans("Bookkeeping")); -/* - * List - */ + /* + * List + */ $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; if (dol_strlen(trim($search_doc_type))) { - $sql .= " WHERE bk.doc_type LIKE '%" . $search_doc_type . "%'"; + $sql .= " WHERE bk.piece_num LIKE '%" . $search_piece_num . "%'"; if (dol_strlen(trim($search_doc_ref))) { $sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'"; @@ -177,20 +210,20 @@ else { print_barre_liste($langs->trans("Bookkeeping"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num); /*print '| '; + print ' | '; print ' | '; print ' | '; print ' | '; @@ -232,9 +265,9 @@ else { print ' | '; print ' | '; print ' | '; - print ''; + print ''; print ' '; - print ''; + print ''; print ' | '; print '|
| ' . $obj->doc_type . ' | '; + /* if ($old_piecenum!=$obj->piece_num) { + $total_debit=0; + $total_credit=0; + } else { + $total_debit+=$obj->debit; + $total_credit+=$obj->credit; + } + */ + + print '' . $obj->piece_num . ' | '; print '' . dol_print_date($db->jdate($obj->doc_date), 'day') . ' | '; print '' . $obj->doc_ref . ' | '; print '' . length_accountg($obj->numero_compte) . ' | '; @@ -260,19 +302,23 @@ else { print '' . $obj->code_journal . ' | '; print '' . img_edit() . ' | '; print "||
| '.$langs->trans("BoxTitleLastLeaveRequests",min($max,$num)).' | '; + print ''.$langs->trans("from").' | '; + print ''.$langs->trans("to").' | '; + print ''.$langs->trans("DateModificationShort").' | '; + print ''; + print ' | ||
| '.$holidaystatic->getNomUrl(1).' | '; + print ''.$userstatic->getNomUrl(1).' | '; + print ''.$typeleaves[$obj->fk_type]['label'].' | '; + + $starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning'; + $endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon'; + + print ''.dol_print_date($obj->date_start,'day').' '.$langs->trans($listhalfday[$endhalfday]); + print ' | '.dol_print_date($obj->date_end,'day').' '.$langs->trans($listhalfday[$endhalfday]); + print ' | '.dol_print_date($db->jdate($obj->dm),'day').' | '; + print ''.$holidaystatic->LibStatut($obj->status,3).' | '; + print '
| '.$langs->trans("None").' | ||||||
| '.$langs->trans("Type").' | '; print ''; - $typeleaves=$cp->getTypes(1,1); + $typeleaves=$cp->getTypes(1,-1); $arraytypeleaves=array(); foreach($typeleaves as $key => $val) { @@ -1019,7 +1013,7 @@ else print ' | ||||
| '.$langs->trans("Type").' | '; print ''; - $typeleaves=$cp->getTypes(1,1); + $typeleaves=$cp->getTypes(1,-1); print $typeleaves[$cp->fk_type]['label']; print ' | '; print '||||
| '.$langs->trans("Total").' | '; - print ''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).' | '; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency); - else + if ($totalnboflines <= $limit) { - $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"),$htmltext); + print ' | |||
| '.$langs->trans("Total").' | '; + print ''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).' | '; + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency); + else + { + $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"),$htmltext); + } + print ' | '; + print ''; + print ' | '; + print " | '; - print ' | '; - print "\n"; } $db->free($result); diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index db450a09f6e..303180c2cb7 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -92,7 +92,7 @@ $sql.= ' AND cf.entity = ' . $conf->entity; if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) { $sql .= ' AND cf.fk_statut < 3'; } elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) { - $sql .= ' AND cf.fk_statut < 6'; // We want alos status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo). + $sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo). } else { $sql .= ' AND cf.fk_statut < 5'; } diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php index 39786f5ad71..e3e070a3473 100644 --- a/htdocs/projet/admin/project_extrafields.php +++ b/htdocs/projet/admin/project_extrafields.php @@ -88,7 +88,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -102,7 +102,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/projet/admin/project_task_extrafields.php b/htdocs/projet/admin/project_task_extrafields.php index e9dc8be64e1..3d6e1d78fe8 100644 --- a/htdocs/projet/admin/project_task_extrafields.php +++ b/htdocs/projet/admin/project_task_extrafields.php @@ -87,7 +87,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -101,7 +101,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 56bf58cf61d..37db7d02e4c 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -88,8 +88,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -102,7 +102,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 6a6fb7ab1df..cfbf3529bba 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -56,65 +56,78 @@ if (! $sortfield) $sortfield="c.lastname"; $now=dol_now(); +$object = new Societe($db); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartynotification','globalcard')); + + /* * Actions */ -// Add a notification -if ($action == 'add') +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$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)) { $error=0; - if (empty($contactid)) + // Add a notification + if ($action == 'add') { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Contact")), null, 'errors'); - $error++; - } - if ($actionid <= 0) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Action")), null, 'errors'); - $error++; - } - - if (! $error) - { - $db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; - $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$contactid." AND fk_action=".$actionid; - if ($db->query($sql)) + if (empty($contactid)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; - $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; - - if (! $db->query($sql)) - { - $error++; - dol_print_error($db); - } + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Contact")), null, 'errors'); + $error++; } - else + if ($actionid <= 0) { - dol_print_error($db); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), null, 'errors'); + $error++; } - + if (! $error) { - $db->commit(); - } - else - { - $db->rollback(); + $db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; + $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$contactid." AND fk_action=".$actionid; + if ($db->query($sql)) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; + $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; + + if (! $db->query($sql)) + { + $error++; + dol_print_error($db); + } + } + else + { + dol_print_error($db); + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } } } -} - -// Remove a notification -if ($action == 'delete') -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; - $db->query($sql); + + // Remove a notification + if ($action == 'delete') + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; + $db->query($sql); + } } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index a7356010185..589c102c8a3 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -49,78 +49,82 @@ if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'societe', $socid, '&societe'); +$object = new Societe($db); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartycustomerprice','globalcard')); + + /* * Actions */ -if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $update_child_soc = GETPOST('updatechildprice'); - - // add price by customer - $prodcustprice->fk_soc = $socid; - $prodcustprice->fk_product = GETPOST('prodid', 'int'); - $prodcustprice->price = price2num(GETPOST("price"), 'MU'); - $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); - $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); - $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); - $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - - $result = $prodcustprice->create($user, 0, $update_child_soc); - - if ($result < 0) - { - setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); - } - else - { - setEventMessages($langs->trans('Save'), null, 'mesgs'); - } - - $action = ''; -} - -if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { - // Delete price by customer - $prodcustprice->id = GETPOST('lineid'); - $result = $prodcustprice->delete($user); - - if ($result < 0) - { - setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); - } - else - { - setEventMessages($langs->trans('Delete'), null, 'mesgs'); - } - $action = ''; -} - -if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - - $prodcustprice->fetch(GETPOST('lineid', 'int')); - - $update_child_soc = GETPOST('updatechildprice'); - - // update price by customer - $prodcustprice->price = price2num(GETPOST("price"), 'MU'); - $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); - $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); - $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); - $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - - $result = $prodcustprice->update($user, 0, $update_child_soc); - if ($result < 0) - { - setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); - } - else - { - setEventMessages($langs->trans('Save'), null, 'mesgs'); - } - - $action = ''; +if (empty($reshook)) +{ + if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + + $update_child_soc = GETPOST('updatechildprice'); + + // add price by customer + $prodcustprice->fk_soc = $socid; + $prodcustprice->fk_product = GETPOST('prodid', 'int'); + $prodcustprice->price = price2num(GETPOST("price"), 'MU'); + $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); + $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); + $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); + $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); + + $result = $prodcustprice->create($user, 0, $update_child_soc); + + if ($result < 0) { + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); + } else { + setEventMessages($langs->trans('Save'), null, 'mesgs'); + } + + $action = ''; + } + + if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { + // Delete price by customer + $prodcustprice->id = GETPOST('lineid'); + $result = $prodcustprice->delete($user); + + if ($result < 0) { + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs'); + } else { + setEventMessages($langs->trans('Delete'), null, 'errors'); + } + $action = ''; + } + + if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + + $prodcustprice->fetch(GETPOST('lineid', 'int')); + + $update_child_soc = GETPOST('updatechildprice'); + + // update price by customer + $prodcustprice->price = price2num(GETPOST("price"), 'MU'); + $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); + $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); + $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); + $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); + + $result = $prodcustprice->update($user, 0, $update_child_soc); + if ($result < 0) { + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); + } else { + setEventMessages($langs->trans('Save'), null, 'mesgs'); + } + + $action = ''; + } } diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php index a7589566175..ceb86d102bd 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php @@ -121,8 +121,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -135,7 +135,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/user/admin/group_extrafields.php b/htdocs/user/admin/group_extrafields.php index 2301f109282..99eab0e3a88 100644 --- a/htdocs/user/admin/group_extrafields.php +++ b/htdocs/user/admin/group_extrafields.php @@ -89,8 +89,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -103,7 +103,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/webservices/admin/index.php b/htdocs/webservices/admin/index.php index f75c60c6c45..5d21c97ce5f 100644 --- a/htdocs/webservices/admin/index.php +++ b/htdocs/webservices/admin/index.php @@ -46,12 +46,12 @@ if ($actionsave) if ($i >= 1) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"), 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } |