diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2247df9493ee67c284ca53cfae331a68c6ab5bea..6094bb7e4f128682ada02a5e099caf6104542d6f 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -55,7 +55,7 @@ if ($action == "set") if (! $res > 0) $error++; $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); - $account = new Account($db, $id); + $account = new Account($db); if($account->fetch($id)>0) { diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index fc9d0489e9ab2c4311b3f9a9f3f51fbadbbf2de7..85139b56ba92b52555f95d56c640956aec06de3d 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -50,7 +50,7 @@ print "<br>\n"; $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); -$triggers = $interfaces->getTriggersList(0,'priority'); +$triggers = $interfaces->getTriggersList(); print '<table class="noborder"> <tr class="liste_titre"> diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 2da54e77712dfa91993fe921fd9ebe842bd89de8..712f60f25cd2d13e1f4a30f7c3dea0835b9fa3b2 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -65,7 +65,7 @@ llxHeader('',$langs->trans("Categories"),$help_url); $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; print_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'setup'); -$head = categoriesadmin_prepare_head(null); +$head = categoriesadmin_prepare_head(); dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category'); diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 7f8ceac853ef74370870b96e385efcaa2089ffb7..e68d2e416f8900d03fa552923cbfa49040083944 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -396,7 +396,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Member")); - $head=member_prepare_head($member, $user); + $head=member_prepare_head($member); $titre=$langs->trans("Member"); $picto='user'; dol_fiche_head($head, 'category', $titre,0,$picto); @@ -471,7 +471,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Contact")); - $head=contact_prepare_head($object, $user); + $head=contact_prepare_head($object); $titre=$langs->trans("ContactsAddresses"); $picto='contact'; dol_fiche_head($head, 'category', $titre,0,$picto); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 393082f3427abdbd84f8fce2dfa86be55b1a40aa..434cc92dcb6b449f53ebea7b51a710bd3133d783 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -258,9 +258,10 @@ class ActionComm extends CommonObject * Load object from database * * @param int $id Id of action to get + * @param string $ref Ref of action to get * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id, $ref='') { global $langs; @@ -286,7 +287,9 @@ class ActionComm extends CommonObject $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; + $sql.= " WHERE a.fk_action=c.id"; + if ($ref) $sql.= " AND a.id=".$ref; // No field ref, we use id + else $sql.= " AND a.id=".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 76176930da3f37f3689ab53883843e69e3f57d81..524901336a785eb55f5b772c46e6b15cb634025c 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -327,11 +327,11 @@ if ($id > 0) print '</td><td colspan="3">'; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'cond_reglement_id',-1,1); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id',1); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none'); } print "</td>"; print '</tr>'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4ca6175d785ef2c7365c7a38fda155053db52793..40bfbe6490dbbf7378fb967f7f559a1456a39736 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -338,9 +338,10 @@ class Account extends CommonObject /** * Create bank account into database * + * @param User $user Object user making creation * @return int < 0 if KO, > 0 if OK */ - function create() + function create($user='') { global $langs,$conf; @@ -665,10 +666,9 @@ class Account extends CommonObject return 1; } else - { + { return 0; } - $this->db->free($result); } else { diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index c118186df272e5b42e7b06ef7d5d60cce61f335a..770f2afd2efaa6e1b45a8885040eaac254f93ef8 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -102,7 +102,7 @@ if ($_POST["action"] == 'add') if (! $error) { - $id = $account->create($user->id); + $id = $account->create($user); if ($id > 0) { $_GET["id"]=$id; // Force chargement page en mode visu @@ -306,7 +306,7 @@ if ($action == 'create') $doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print '</td></tr>'; - + print '</table>'; print '<br>'; @@ -510,7 +510,7 @@ else $account->fetch(GETPOST('id','int')); print_fiche_titre($langs->trans("EditFinancialAccount")); - + if ($conf->use_javascript_ajax) { print "\n".'<script type="text/javascript" language="javascript">'; @@ -614,7 +614,7 @@ else $doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print '</td></tr>'; - + print '</table>'; print '<br>'; @@ -635,7 +635,7 @@ else // Accountancy journal print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>'; print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?$_POST["accountancy_journal"]:$account->accountancy_journal).'"></td></tr>'; - + print '</table>'; print '<center><br><input value="'.$langs->trans("Modify").'" type="submit" class="button">'; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 4d24aac9a835cafaa92584f0915c63f1ffa35452..2158307f3e0e4a1f94fe55816db4462431a73e21 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -222,13 +222,16 @@ class Deplacement extends CommonObject * Load an object from database * * @param int $id Id of record to load + * @param string $ref Ref of record * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id, $ref='') { $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; - $sql.= " WHERE rowid = ".$id; + $sql.= " WHERE entity IN (".getEntity('deplacement').")"; + if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'"; + else $sql.= " AND id = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 163242ed08ab815a61f3d5f5a91172a93ba0dcb0..b6b1cbfa277dfbdec7eeda7372d9c3c08b453c49 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -88,7 +88,7 @@ if ($object->id) { $object->fetch_thirdparty(); - $head=trip_prepare_head($object, $user); + $head=trip_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip'); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7bd05f9f80674f07c6872c163784ece0f0bb013c..c82c2ba282568c439e255c6b4034a89ff441f196 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -171,11 +171,12 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact } // Delete line -else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) { +else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) +{ $object->fetch($id); $object->fetch_thirdparty(); - $result = $object->deleteline($_GET ['lineid'], $user); + $result = $object->deleteline(GETPOST('lineid')); if ($result > 0) { // Define output language $outputlangs = $langs; @@ -203,14 +204,16 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> } // Delete link of credit note to invoice -else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) { +else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) +{ $discount = new DiscountAbsolute($db); - $result = $discount->fetch($_GET ["discountid"]); + $result = $discount->fetch(GETPOST("discountid")); $discount->unlink_invoice(); } // Validation -else if ($action == 'valid' && $user->rights->facture->creer) { +else if ($action == 'valid' && $user->rights->facture->creer) +{ $object->fetch($id); // On verifie signe facture @@ -229,7 +232,8 @@ else if ($action == 'valid' && $user->rights->facture->creer) { } } -else if ($action == 'set_thirdparty' && $user->rights->facture->creer) { +else if ($action == 'set_thirdparty' && $user->rights->facture->creer) +{ $object->fetch($id); $object->setValueFrom('fk_soc', $socid); @@ -237,12 +241,14 @@ else if ($action == 'set_thirdparty' && $user->rights->facture->creer) { exit(); } -else if ($action == 'classin' && $user->rights->facture->creer) { +else if ($action == 'classin' && $user->rights->facture->creer) +{ $object->fetch($id); $object->setProject($_POST['projectid']); } -else if ($action == 'setmode' && $user->rights->facture->creer) { +else if ($action == 'setmode' && $user->rights->facture->creer) +{ $object->fetch($id); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) @@ -268,7 +274,8 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer) if ($result < 0) dol_print_error($db, $object->error); } -else if ($action == 'setconditions' && $user->rights->facture->creer) { +else if ($action == 'setconditions' && $user->rights->facture->creer) +{ $object->fetch($id); $object->cond_reglement_code = 0; // To clean property $object->cond_reglement_id = 0; // To clean property @@ -283,7 +290,8 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) { if ($result < 0) dol_print_error($db, $object->error); } -else if ($action == 'setpaymentterm' && $user->rights->facture->creer) { +else if ($action == 'setpaymentterm' && $user->rights->facture->creer) +{ $object->fetch($id); $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']); if ($object->date_lim_reglement < $object->date) { @@ -295,7 +303,8 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer) { dol_print_error($db, $object->error); } -else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) { +else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) +{ $object->fetch($id); $object->revenuestamp = GETPOST('revenuestamp'); $result = $object->update($user); @@ -305,16 +314,19 @@ else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) { } // bank account -else if ($action == 'setbankaccount' && $user->rights->facture->creer) { +else if ($action == 'setbankaccount' && $user->rights->facture->creer) +{ $result=$object->setBankAccount(GETPOST('fk_account', 'int')); } -else if ($action == 'setremisepercent' && $user->rights->facture->creer) { +else if ($action == 'setremisepercent' && $user->rights->facture->creer) +{ $object->fetch($id); $result = $object->set_remise($user, $_POST['remise_percent']); } -else if ($action == "setabsolutediscount" && $user->rights->facture->creer) { +else if ($action == "setabsolutediscount" && $user->rights->facture->creer) +{ // POST[remise_id] ou POST[remise_id_for_payment] if (! empty($_POST["remise_id"])) { $ret = $object->fetch($id); @@ -339,7 +351,8 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) { } } -else if ($action == 'set_ref_client' && $user->rights->facture->creer) { +else if ($action == 'set_ref_client' && $user->rights->facture->creer) +{ $object->fetch($id); $object->set_ref_client($_POST['ref_client']); } @@ -359,7 +372,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu { $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; $idprof = 'idprof' . $i; - if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) { + if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) + { if (! $error) $langs->load("errors"); $error ++; @@ -376,7 +390,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu } // Check for warehouse - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) { + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + { if (! $idwarehouse || $idwarehouse == - 1) { $error ++; setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors'); @@ -412,7 +427,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu } // Go back to draft status (unvalidate) -else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) { +else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) +{ $idwarehouse = GETPOST('idwarehouse'); $object->fetch($id); @@ -426,7 +442,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_ } // Check parameters - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) { + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + { if (! $idwarehouse || $idwarehouse == - 1) { $error ++; setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors'); @@ -460,7 +477,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_ $ventilExportCompta = $object->getVentilExportCompta(); // On verifie si aucun paiement n'a ete effectue - if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) { + if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) + { $result=$object->set_draft($user, $idwarehouse); if ($result<0) setEventMessage($object->error,'errors'); @@ -484,12 +502,14 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_ } // Classify "paid" -else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) { +else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) +{ $object->fetch($id); $result = $object->set_paid($user); if ($result<0) setEventMessage($object->error,'errors'); } // Classif "paid partialy" -else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) { +else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) +{ $object->fetch($id); $close_code = $_POST["close_code"]; $close_note = $_POST["close_note"]; diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index 8cc06397e6286c1e2da8f2610792bedcbd42c091..84ef52c3a80c762c111dff56e35fd28c89381b97 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->load("bills"); $langs->load("companies"); +$id=GETPOST('id'); + /* * View @@ -39,8 +41,8 @@ $langs->load("companies"); llxHeader(); $paiement = new Paiement($db); -$paiement->fetch($_GET["id"], $user); -$paiement->info($_GET["id"]); +$paiement->fetch($id); +$paiement->info($id); $head = payment_prepare_head($paiement); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5cf872eb3d80abc4ea8711c2dca19954e3d9a5cc..153ff769eb6e8b40951adf4187aea4435421aa11 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3043,7 +3043,7 @@ class Form * @param int $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field - * @param int $addempty Ajoute entree vide + * @param int $addempty Add empty entry * @return void */ function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 229f2dee541a1acb80449843df1d8976ec6a99b6..24cb1a6203de2f6390c5e30d6674eeb0328330a9 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -18,6 +18,7 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +ALTER TABLE llx_bank_account ADD COLUMN fk_user_author integer; ALTER TABLE llx_propal ADD COLUMN fk_user_modif integer after fk_user_author; ALTER TABLE llx_commande ADD COLUMN fk_user_modif integer after fk_user_author; @@ -26,6 +27,8 @@ ALTER TABLE llx_product ADD COLUMN fk_user_modif integer after fk_user_author; ALTER TABLE llx_fichinter ADD COLUMN fk_user_modif integer after fk_user_author; ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_modif integer after fk_user_author; ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_bank_account ADD COLUMN fk_user_modif integer after fk_user_author; + ALTER TABLE llx_fichinter ADD COLUMN ref_ext varchar(255); diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index 63a0e23762d1abdda8a995d3c6eb785432fcbb2a..bb2da7841b817993c660d07db1ac01177b3d4c3d 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -30,6 +30,8 @@ create table llx_bank_account ref varchar(12) NOT NULL, label varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_user_author integer, + fk_user_modif integer, bank varchar(60), code_banque varchar(8), code_guichet varchar(6),