From be965bdbabe26231d14f837a1cf240cd5691f7d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Apr 2018 13:28:48 +0200 Subject: [PATCH] Clean code --- htdocs/adherents/type.php | 6 +++--- htdocs/assets/type.php | 6 +++--- htdocs/categories/card.php | 2 +- htdocs/categories/edit.php | 2 +- htdocs/comm/action/card.php | 4 ++-- htdocs/commande/card.php | 2 +- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/bank/card.php | 4 ++-- htdocs/compta/facture/card.php | 2 +- htdocs/contact/card.php | 4 ++-- htdocs/contrat/card.php | 2 +- htdocs/core/class/html.formticketsup.class.php | 2 +- htdocs/core/tpl/extrafields_add.tpl.php | 2 +- htdocs/core/tpl/extrafields_edit.tpl.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- htdocs/don/card.php | 4 ++-- htdocs/expedition/card.php | 2 +- htdocs/expensereport/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/commande/orderstoinvoice.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/product/card.php | 4 ++-- htdocs/projet/card.php | 4 ++-- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/task.php | 2 +- htdocs/resource/card.php | 2 +- htdocs/societe/card.php | 4 ++-- htdocs/supplier_proposal/card.php | 2 +- htdocs/user/card.php | 4 ++-- htdocs/user/group/card.php | 4 ++-- 30 files changed, 43 insertions(+), 43 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c695d0cc699..d942038b0bc 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -338,7 +338,7 @@ if ($action == 'create') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -736,7 +736,7 @@ if ($rowid > 0) $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -744,7 +744,7 @@ if ($rowid > 0) print ''; // Extra field - if (empty($reshook) + if (empty($reshook)) { print '

'; foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/assets/type.php b/htdocs/assets/type.php index 15d93f598f8..f9e725acafa 100644 --- a/htdocs/assets/type.php +++ b/htdocs/assets/type.php @@ -317,7 +317,7 @@ if ($action == 'create') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -715,7 +715,7 @@ if ($rowid > 0) $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -723,7 +723,7 @@ if ($rowid > 0) print '
'; // Extra field - if (empty($reshook) + if (empty($reshook)) { print '

'; foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 9911ad01b0b..60689dd37aa 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -268,7 +268,7 @@ if ($user->rights->categorie->creer) $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index ed6783ea59e..67190aee2e2 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -176,7 +176,7 @@ print ''; $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (empty($reshook) +if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c42bf4b8c70..fb9c5944baf 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -908,7 +908,7 @@ if ($action == 'create') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -1260,7 +1260,7 @@ if ($id > 0) $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e0f29d5f7ee..76a290a79cd 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1646,7 +1646,7 @@ if ($action == 'create' && $user->rights->commande->creer) $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by print $hookmanager->resPrint; - if (empty($reshook) { + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 63c590af3be..c9acc111dc4 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -472,7 +472,7 @@ if ($action == 'create' && !$error) $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { $object=new Facture($db); print $object->showOptionals($extrafields,'edit'); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index ee7adeb57d7..6a9ce1d2ba1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -413,7 +413,7 @@ if ($action == 'create') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit',$parameters); } @@ -914,7 +914,7 @@ else $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d21d6a637ad..ec14ec3da14 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2857,7 +2857,7 @@ if ($action == 'create') $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="2"', 'cols'=>2); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) { + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index bf05d802438..bb67f0f183d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -686,7 +686,7 @@ else $parameters=array('socid' => $socid, 'objsoc' => $objsoc, 'colspan' => ' colspan="3"', 'cols' => 3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -963,7 +963,7 @@ else $parameters=array('colspan' => ' colspan="3"', 'cols'=>3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3ea527c80b9..17beae4be46 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1287,7 +1287,7 @@ if ($action == 'create') print $hookmanager->resPrint; // Other attributes - if (empty($reshook) { + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 1a8897c0a7d..7248e2b9a8e 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -386,7 +386,7 @@ class FormTicketsup // Other attributes $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && is_array($extrafields->attributes[$ticketstat->table_element]['label'])) + if (empty($reshook)) { print $ticketstat->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php index 0dc6e81321f..f4f74d35428 100644 --- a/htdocs/core/tpl/extrafields_add.tpl.php +++ b/htdocs/core/tpl/extrafields_add.tpl.php @@ -40,7 +40,7 @@ if (empty($conf) || ! is_object($conf)) $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) { +if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 5c63233d373..c6d0cf61043 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -40,7 +40,7 @@ if (empty($conf) || ! is_object($conf)) $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) { +if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 3b75905370f..05d4eeab36e 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -46,7 +46,7 @@ print $hookmanager->resPrint; if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); //var_dump($extrafields->attributes); -if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) +if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { diff --git a/htdocs/don/card.php b/htdocs/don/card.php index d15fe10ec0b..375b49bd4d1 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -387,7 +387,7 @@ if ($action == 'create') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit',$parameters); } @@ -513,7 +513,7 @@ if (! empty($id) && $action == 'edit') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 338b07edca4..078d77c47c9 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1059,7 +1059,7 @@ if ($action == 'create') $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) { + if (empty($reshook)) { // copy from order $orderExtrafields = new Extrafields($db); $orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 0474cde1128..1faa521d8b7 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1412,7 +1412,7 @@ if ($action == 'create') $parameters = array('colspan' => ' colspan="3"'); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by print $hookmanager->resPrint; - if (empty($reshook) { + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ef13353ed64..c0842bc253a 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1609,7 +1609,7 @@ if ($action=='create') $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 330a404790c..13a40d9fe64 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -371,7 +371,7 @@ if ($action == 'create' && !$error) { $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { $object=new FactureFournisseur($db); print $object->showOptionals($extrafields,'edit'); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d79005ea9a2..0725043f680 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1998,7 +1998,7 @@ if ($action == 'create') // print ''; print ''; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 99cf8654006..549eca022b0 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1097,7 +1097,7 @@ else $parameters=array('cols' => 3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit',$parameters); } @@ -1470,7 +1470,7 @@ else $parameters=array('colspan' => ' colspan="3"', 'cols'=>3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 96bb5b99795..89144482c25 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -869,7 +869,7 @@ elseif ($object->id > 0) $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -1055,7 +1055,7 @@ elseif ($object->id > 0) if (parseFloat(oldpercent) != 100) { jQuery("#opp_percent").val(oldpercent); } else { jQuery("#opp_percent").val(defaultpercent); } } - else + else { if ((parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))); { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d8b4e3ef72c..e29a1d6826e 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -418,7 +418,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) && ! empty($extrafields_task->attribute_label)) + if (empty($reshook)) { print $object->showOptionals($extrafields_task,'edit'); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fa837607f41..735b5a81195 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -416,7 +416,7 @@ if ($id > 0 || ! empty($ref)) $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index f8ff77c035e..afdc26db622 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -285,7 +285,7 @@ if ($action == 'create' || $object->fetch($id) > 0) $parameters=array('objectsrc' => $objectsrc); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 66795cfd8e7..f318d49f98d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1431,7 +1431,7 @@ else $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -2018,7 +2018,7 @@ else $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index fd74932d57e..8e391b0f1dd 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1151,7 +1151,7 @@ if ($action == 'create') $parameters = array('colspan' => ' colspan="3"'); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) { + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 4fd1c105055..192ff3b1191 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1070,7 +1070,7 @@ if ($action == 'create' || $action == 'adduserldap') $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -2322,7 +2322,7 @@ else $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index c3adb2f2f20..11850940f85 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -304,7 +304,7 @@ if ($action == 'create') $parameters=array('object' => $object, 'colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } @@ -570,7 +570,7 @@ else $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (empty($reshook) + if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); }