From b41ac00b9828e7cc6856c3da3629f7d34882090b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 15:05:19 +0200 Subject: [PATCH] add new rule --- dev/examples/code/create_invoice.php | 6 +- dev/examples/code/create_order.php | 6 +- dev/examples/code/create_product.php | 6 +- dev/examples/code/create_user.php | 9 +- htdocs/accountancy/admin/account.php | 15 +- htdocs/accountancy/admin/accountmodel.php | 81 +- htdocs/accountancy/admin/card.php | 21 +- htdocs/accountancy/admin/categories_list.php | 90 +-- htdocs/accountancy/admin/defaultaccounts.php | 3 +- htdocs/accountancy/admin/fiscalyear_card.php | 4 +- htdocs/accountancy/admin/journals_list.php | 51 +- htdocs/accountancy/admin/productaccount.php | 64 +- htdocs/accountancy/bookkeeping/card.php | 21 +- htdocs/accountancy/bookkeeping/list.php | 36 +- .../accountancy/bookkeeping/listbyaccount.php | 24 +- .../class/accountancycategory.class.php | 18 +- .../class/accountancyexport.class.php | 26 +- .../class/accountingaccount.class.php | 18 +- .../class/accountingjournal.class.php | 9 +- .../accountancy/class/bookkeeping.class.php | 6 +- htdocs/accountancy/customer/card.php | 3 +- htdocs/accountancy/customer/index.php | 15 +- htdocs/accountancy/customer/list.php | 6 +- htdocs/accountancy/expensereport/card.php | 3 +- htdocs/accountancy/expensereport/index.php | 12 +- htdocs/accountancy/expensereport/list.php | 3 +- htdocs/accountancy/index.php | 3 +- htdocs/accountancy/journal/bankjournal.php | 84 +- .../journal/expensereportsjournal.php | 33 +- .../accountancy/journal/purchasesjournal.php | 42 +- htdocs/accountancy/journal/sellsjournal.php | 36 +- htdocs/accountancy/supplier/card.php | 3 +- htdocs/accountancy/supplier/index.php | 15 +- htdocs/accountancy/supplier/list.php | 6 +- htdocs/accountancy/tpl/export_journal.tpl.php | 3 +- htdocs/api/admin/index.php | 12 +- htdocs/api/class/api.class.php | 6 +- htdocs/api/class/api_access.class.php | 6 +- htdocs/api/class/api_login.class.php | 3 +- htdocs/api/class/api_setup.class.php | 36 +- htdocs/api/index.php | 6 +- htdocs/asset/admin/setup.php | 3 +- htdocs/asset/card.php | 6 +- htdocs/asset/class/asset.class.php | 21 +- htdocs/asset/class/asset_type.class.php | 27 +- htdocs/asset/document.php | 3 +- htdocs/asset/list.php | 6 +- htdocs/asset/type.php | 24 +- htdocs/barcode/codeinit.php | 30 +- htdocs/barcode/printsheet.php | 3 +- htdocs/blockedlog/admin/blockedlog.php | 6 +- htdocs/blockedlog/admin/blockedlog_list.php | 24 +- htdocs/blockedlog/ajax/authority.php | 9 +- htdocs/blockedlog/ajax/block-info.php | 12 +- htdocs/blockedlog/class/authority.class.php | 21 +- htdocs/blockedlog/class/blockedlog.class.php | 129 +-- htdocs/bom/bom_agenda.php | 6 +- htdocs/bom/bom_card.php | 15 +- htdocs/bom/bom_document.php | 3 +- htdocs/bom/bom_list.php | 24 +- htdocs/bom/class/api_boms.class.php | 6 +- htdocs/bom/class/bom.class.php | 45 +- htdocs/bom/tpl/objectline_create.tpl.php | 3 +- htdocs/bookmarks/admin/bookmark.php | 3 +- htdocs/bookmarks/bookmarks.lib.php | 6 +- htdocs/bookmarks/card.php | 18 +- htdocs/bookmarks/class/bookmark.class.php | 18 +- htdocs/bookmarks/list.php | 12 +- htdocs/cashdesk/admin/cashdesk.php | 9 +- htdocs/cashdesk/affContenu.php | 6 +- htdocs/cashdesk/class/Auth.class.php | 3 +- htdocs/cashdesk/class/Facturation.class.php | 36 +- htdocs/cashdesk/facturation.php | 15 +- htdocs/cashdesk/facturation_dhtml.php | 6 +- htdocs/cashdesk/facturation_verif.php | 24 +- htdocs/cashdesk/index.php | 9 +- htdocs/cashdesk/index_verif.php | 6 +- htdocs/cashdesk/tpl/facturation1.tpl.php | 9 +- htdocs/cashdesk/tpl/validation1.tpl.php | 3 +- htdocs/cashdesk/validation_verif.php | 18 +- htdocs/categories/admin/categorie.php | 12 +- htdocs/categories/card.php | 45 +- .../categories/class/api_categories.class.php | 6 +- htdocs/categories/class/categorie.class.php | 114 +-- htdocs/categories/edit.php | 6 +- htdocs/categories/index.php | 6 +- htdocs/categories/photos.php | 9 +- htdocs/categories/traduction.php | 3 +- htdocs/categories/viewcat.php | 93 +-- htdocs/collab/index.php | 9 +- htdocs/comm/action/card.php | 72 +- htdocs/comm/action/class/actioncomm.class.php | 72 +- .../action/class/actioncommreminder.class.php | 15 +- .../action/class/api_agendaevents.class.php | 3 +- .../comm/action/class/cactioncomm.class.php | 9 +- htdocs/comm/action/class/ical.class.php | 12 +- htdocs/comm/action/document.php | 6 +- htdocs/comm/action/index.php | 136 ++-- htdocs/comm/action/list.php | 33 +- htdocs/comm/action/pertype.php | 45 +- htdocs/comm/action/peruser.php | 51 +- htdocs/comm/action/rapport/index.php | 6 +- htdocs/comm/card.php | 57 +- htdocs/comm/contact.php | 3 +- htdocs/comm/index.php | 66 +- htdocs/comm/mailing/advtargetemailing.php | 3 +- htdocs/comm/mailing/card.php | 114 +-- htdocs/comm/mailing/cibles.php | 54 +- .../mailing/class/advtargetemailing.class.php | 21 +- .../html.formadvtargetemailing.class.php | 6 +- htdocs/comm/mailing/class/mailing.class.php | 39 +- htdocs/comm/mailing/index.php | 9 +- htdocs/comm/mailing/list.php | 9 +- htdocs/comm/multiprix.php | 3 +- htdocs/comm/propal/card.php | 75 +- .../comm/propal/class/api_proposals.class.php | 9 +- htdocs/comm/propal/class/propal.class.php | 216 ++--- htdocs/comm/propal/contact.php | 15 +- htdocs/comm/propal/document.php | 3 +- htdocs/comm/propal/index.php | 15 +- htdocs/comm/propal/list.php | 18 +- htdocs/comm/propal/stats/index.php | 12 +- htdocs/comm/prospect/index.php | 3 +- htdocs/comm/prospect/recap-prospect.php | 3 +- htdocs/comm/recap-client.php | 3 +- htdocs/comm/remise.php | 18 +- htdocs/comm/remx.php | 90 +-- htdocs/commande/card.php | 128 +-- htdocs/commande/class/api_orders.class.php | 8 +- htdocs/commande/class/commande.class.php | 237 ++---- htdocs/commande/class/commandestats.class.php | 3 +- htdocs/commande/contact.php | 15 +- htdocs/commande/customer.php | 3 +- htdocs/commande/document.php | 6 +- htdocs/commande/index.php | 15 +- htdocs/commande/list.php | 12 +- htdocs/commande/orderstoinvoice.php | 27 +- htdocs/commande/stats/index.php | 12 +- htdocs/compta/accounting-files.php | 15 +- .../bank/account_statement_document.php | 6 +- htdocs/compta/bank/annuel.php | 30 +- htdocs/compta/bank/bankentries_list.php | 120 +-- htdocs/compta/bank/budget.php | 3 +- htdocs/compta/bank/card.php | 33 +- htdocs/compta/bank/categ.php | 3 +- htdocs/compta/bank/class/account.class.php | 103 +-- .../bank/class/api_bankaccounts.class.php | 9 +- .../bank/class/paymentvarious.class.php | 45 +- htdocs/compta/bank/document.php | 6 +- htdocs/compta/bank/graph.php | 54 +- htdocs/compta/bank/line.php | 102 +-- htdocs/compta/bank/list.php | 9 +- htdocs/compta/bank/releve.php | 69 +- htdocs/compta/bank/transfer.php | 9 +- htdocs/compta/bank/treso.php | 12 +- htdocs/compta/bank/various_payment/card.php | 27 +- .../compta/bank/various_payment/document.php | 3 +- htdocs/compta/bank/various_payment/list.php | 9 +- .../compta/cashcontrol/cashcontrol_card.php | 51 +- .../compta/cashcontrol/cashcontrol_list.php | 3 +- .../cashcontrol/class/cashcontrol.class.php | 3 +- htdocs/compta/cashcontrol/report.php | 9 +- htdocs/compta/charges/index.php | 33 +- htdocs/compta/clients.php | 3 +- htdocs/compta/deplacement/card.php | 63 +- .../deplacement/class/deplacement.class.php | 36 +- htdocs/compta/deplacement/document.php | 3 +- htdocs/compta/deplacement/index.php | 6 +- htdocs/compta/deplacement/list.php | 3 +- htdocs/compta/deplacement/stats/index.php | 6 +- htdocs/compta/facture/card-rec.php | 103 +-- htdocs/compta/facture/card.php | 231 ++---- .../facture/class/api_invoices.class.php | 21 +- .../facture/class/facture-rec.class.php | 159 ++-- htdocs/compta/facture/class/facture.class.php | 246 ++---- .../facture/class/paymentterm.class.php | 18 +- htdocs/compta/facture/contact.php | 15 +- htdocs/compta/facture/document.php | 6 +- .../compta/facture/invoicetemplate_list.php | 18 +- htdocs/compta/facture/list.php | 33 +- htdocs/compta/facture/prelevement.php | 51 +- htdocs/compta/facture/stats/index.php | 6 +- .../facture/tpl/linkedobjectblock.tpl.php | 3 +- htdocs/compta/index.php | 51 +- htdocs/compta/journal/purchasesjournal.php | 6 +- htdocs/compta/journal/sellsjournal.php | 9 +- htdocs/compta/localtax/card.php | 15 +- .../compta/localtax/class/localtax.class.php | 45 +- htdocs/compta/localtax/clients.php | 18 +- htdocs/compta/localtax/index.php | 15 +- htdocs/compta/localtax/list.php | 3 +- htdocs/compta/localtax/quadri_detail.php | 21 +- htdocs/compta/paiement.php | 24 +- htdocs/compta/paiement/card.php | 24 +- htdocs/compta/paiement/cheque/card.php | 60 +- .../cheque/class/remisecheque.class.php | 78 +- htdocs/compta/paiement/cheque/index.php | 6 +- htdocs/compta/paiement/cheque/list.php | 6 +- .../compta/paiement/class/paiement.class.php | 69 +- htdocs/compta/paiement/list.php | 6 +- htdocs/compta/paiement/rapport.php | 3 +- htdocs/compta/paiement/tovalidate.php | 3 +- htdocs/compta/paiement_charge.php | 9 +- htdocs/compta/payment_sc/card.php | 9 +- htdocs/compta/paymentbybanktransfer/index.php | 9 +- htdocs/compta/prelevement/bons.php | 3 +- htdocs/compta/prelevement/card.php | 6 +- .../class/bonprelevement.class.php | 123 +-- .../class/ligneprelevement.class.php | 15 +- .../class/rejetprelevement.class.php | 24 +- htdocs/compta/prelevement/create.php | 21 +- htdocs/compta/prelevement/demandes.php | 6 +- htdocs/compta/prelevement/factures.php | 12 +- htdocs/compta/prelevement/fiche-rejet.php | 9 +- htdocs/compta/prelevement/fiche-stat.php | 6 +- htdocs/compta/prelevement/index.php | 9 +- htdocs/compta/prelevement/line.php | 28 +- htdocs/compta/prelevement/list.php | 3 +- htdocs/compta/prelevement/rejets.php | 3 +- htdocs/compta/prelevement/stats.php | 6 +- htdocs/compta/recap-compta.php | 9 +- htdocs/compta/resultat/clientfourn.php | 75 +- htdocs/compta/resultat/index.php | 87 +-- htdocs/compta/resultat/result.php | 15 +- htdocs/compta/sociales/card.php | 60 +- .../sociales/class/cchargesociales.class.php | 15 +- .../sociales/class/chargesociales.class.php | 30 +- .../class/paymentsocialcontribution.class.php | 30 +- htdocs/compta/sociales/document.php | 3 +- htdocs/compta/sociales/list.php | 12 +- htdocs/compta/sociales/payments.php | 24 +- htdocs/compta/stats/byratecountry.php | 12 +- htdocs/compta/stats/cabyprodserv.php | 18 +- htdocs/compta/stats/cabyuser.php | 21 +- htdocs/compta/stats/casoc.php | 24 +- htdocs/compta/stats/index.php | 51 +- htdocs/compta/stats/supplier_turnover.php | 48 +- .../stats/supplier_turnover_by_prodserv.php | 18 +- .../stats/supplier_turnover_by_thirdparty.php | 24 +- htdocs/compta/tva/card.php | 18 +- htdocs/compta/tva/class/tva.class.php | 54 +- htdocs/compta/tva/clients.php | 18 +- htdocs/compta/tva/document.php | 3 +- htdocs/compta/tva/index.php | 21 +- htdocs/compta/tva/list.php | 12 +- htdocs/compta/tva/quadri_detail.php | 24 +- htdocs/contact/agenda.php | 6 +- .../actions_contactcard_common.class.php | 12 +- .../actions_contactcard_default.class.php | 3 +- htdocs/contact/card.php | 84 +- htdocs/contact/class/contact.class.php | 63 +- htdocs/contact/consumption.php | 33 +- htdocs/contact/ldap.php | 15 +- htdocs/contact/list.php | 24 +- htdocs/contact/perso.php | 24 +- htdocs/contrat/agenda.php | 3 +- htdocs/contrat/card.php | 173 ++--- htdocs/contrat/class/api_contracts.class.php | 9 +- htdocs/contrat/class/contrat.class.php | 150 ++-- htdocs/contrat/contact.php | 6 +- htdocs/contrat/document.php | 3 +- htdocs/contrat/index.php | 33 +- htdocs/contrat/list.php | 6 +- htdocs/contrat/services_list.php | 12 +- htdocs/core/actions_addupdatedelete.inc.php | 52 +- htdocs/core/actions_builddoc.inc.php | 9 +- htdocs/core/actions_comments.inc.php | 9 +- htdocs/core/actions_extrafields.inc.php | 36 +- htdocs/core/actions_fetchobject.inc.php | 6 +- htdocs/core/actions_linkedfiles.inc.php | 36 +- htdocs/core/actions_massactions.inc.php | 123 +-- htdocs/core/actions_printing.inc.php | 3 +- htdocs/core/actions_sendmails.inc.php | 57 +- htdocs/core/actions_setmoduleoptions.inc.php | 6 +- htdocs/core/ajax/ajaxdirpreview.php | 24 +- htdocs/core/ajax/ajaxdirtree.php | 15 +- htdocs/core/ajax/check_notifications.php | 6 +- htdocs/core/ajax/constantonoff.php | 3 +- htdocs/core/ajax/extraparams.php | 13 +- htdocs/core/ajax/loadinplace.php | 12 +- htdocs/core/ajax/objectonoff.php | 6 +- htdocs/core/ajax/pingresult.php | 3 +- htdocs/core/ajax/price.php | 3 +- htdocs/core/ajax/saveinplace.php | 27 +- htdocs/core/ajax/selectsearchbox.php | 3 +- htdocs/core/ajax/vatrates.php | 3 +- htdocs/core/ajax/ziptown.php | 6 +- htdocs/core/boxes/box_actions.php | 3 +- htdocs/core/boxes/box_activity.php | 3 +- htdocs/core/boxes/box_birthdays.php | 6 +- htdocs/core/boxes/box_birthdays_members.php | 6 +- htdocs/core/boxes/box_bookmarks.php | 3 +- htdocs/core/boxes/box_clients.php | 6 +- htdocs/core/boxes/box_external_rss.php | 3 +- htdocs/core/boxes/box_factures_imp.php | 6 +- htdocs/core/boxes/box_ficheinter.php | 6 +- htdocs/core/boxes/box_goodcustomers.php | 6 +- .../boxes/box_graph_invoices_permonth.php | 15 +- .../box_graph_invoices_supplier_permonth.php | 15 +- .../core/boxes/box_graph_orders_permonth.php | 15 +- .../box_graph_orders_supplier_permonth.php | 15 +- .../boxes/box_graph_product_distribution.php | 6 +- .../boxes/box_graph_propales_permonth.php | 15 +- htdocs/core/boxes/box_produits.php | 6 +- .../core/boxes/box_produits_alerte_stock.php | 12 +- htdocs/core/boxes/box_services_contracts.php | 9 +- htdocs/core/boxes/box_services_expired.php | 6 +- htdocs/core/boxes/box_supplier_orders.php | 3 +- ...box_supplier_orders_awaiting_reception.php | 3 +- htdocs/core/boxes/box_task.php | 9 +- htdocs/core/boxes/modules_boxes.php | 12 +- htdocs/core/class/CMailFile.class.php | 69 +- htdocs/core/class/CSMSFile.class.php | 18 +- htdocs/core/class/ccountry.class.php | 15 +- htdocs/core/class/comment.class.php | 9 +- .../core/class/commondocgenerator.class.php | 36 +- htdocs/core/class/commoninvoice.class.php | 66 +- htdocs/core/class/commonobject.class.php | 735 ++++++------------ htdocs/core/class/commonobjectline.class.php | 3 +- .../class/commonstickergenerator.class.php | 3 +- htdocs/core/class/conf.class.php | 6 +- htdocs/core/class/coreobject.class.php | 36 +- htdocs/core/class/cstate.class.php | 9 +- htdocs/core/class/ctypent.class.php | 12 +- htdocs/core/class/cunits.class.php | 24 +- htdocs/core/class/discount.class.php | 63 +- htdocs/core/class/dolgeoip.class.php | 39 +- htdocs/core/class/dolgraph.class.php | 27 +- .../core/class/emailsenderprofile.class.php | 18 +- htdocs/core/class/events.class.php | 6 +- htdocs/core/class/extrafields.class.php | 264 +++---- htdocs/core/class/fileupload.class.php | 42 +- htdocs/core/class/fiscalyear.class.php | 39 +- htdocs/core/class/html.form.class.php | 605 +++++--------- .../core/class/html.formaccounting.class.php | 18 +- htdocs/core/class/html.formactions.class.php | 18 +- htdocs/core/class/html.formadmin.class.php | 12 +- htdocs/core/class/html.formbarcode.class.php | 3 +- htdocs/core/class/html.formcompany.class.php | 57 +- htdocs/core/class/html.formcontract.class.php | 12 +- htdocs/core/class/html.formfile.class.php | 195 ++--- .../class/html.formintervention.class.php | 12 +- htdocs/core/class/html.formmail.class.php | 84 +- htdocs/core/class/html.formmargin.class.php | 12 +- htdocs/core/class/html.formother.class.php | 72 +- htdocs/core/class/html.formprojet.class.php | 57 +- htdocs/core/class/html.formpropal.class.php | 9 +- htdocs/core/class/html.formsms.class.php | 33 +- .../class/html.formsocialcontrib.class.php | 9 +- htdocs/core/class/html.formwebsite.class.php | 24 +- htdocs/core/class/infobox.class.php | 21 +- htdocs/core/class/interfaces.class.php | 27 +- htdocs/core/class/ldap.class.php | 99 +-- htdocs/core/class/lessc.class.php | 3 +- htdocs/core/class/link.class.php | 18 +- htdocs/core/class/menubase.class.php | 27 +- htdocs/core/class/notify.class.php | 36 +- htdocs/core/class/openid.class.php | 12 +- htdocs/core/class/rssparser.class.php | 115 +-- htdocs/core/class/smtps.class.php | 24 +- htdocs/core/class/stats.class.php | 39 +- htdocs/core/class/translate.class.php | 48 +- htdocs/core/class/utils.class.php | 51 +- htdocs/core/commonfieldsinexport.inc.php | 3 +- htdocs/core/customreports.php | 39 +- htdocs/core/datepicker.php | 18 +- htdocs/core/db/DoliDB.class.php | 15 +- htdocs/core/db/mssql.class.php | 60 +- htdocs/core/db/mysqli.class.php | 33 +- htdocs/core/db/pgsql.class.php | 33 +- htdocs/core/db/sqlite3.class.php | 39 +- .../filemanagerdol/connectors/php/basexml.php | 3 +- .../connectors/php/commands.php | 21 +- .../core/filemanagerdol/connectors/php/io.php | 9 +- .../filemanagerdol/connectors/php/util.php | 6 +- htdocs/core/get_info.php | 12 +- htdocs/core/get_menudiv.php | 3 +- htdocs/core/lib/admin.lib.php | 90 +-- htdocs/core/lib/agenda.lib.php | 6 +- htdocs/core/lib/ajax.lib.php | 3 +- htdocs/core/lib/barcode.lib.php | 18 +- htdocs/core/lib/company.lib.php | 110 +-- htdocs/core/lib/cron.lib.php | 3 +- htdocs/core/lib/date.lib.php | 66 +- htdocs/core/lib/doc.lib.php | 18 +- htdocs/core/lib/doleditor.lib.php | 3 +- htdocs/core/lib/ecm.lib.php | 3 +- htdocs/core/lib/files.lib.php | 182 ++--- htdocs/core/lib/format_cards.lib.php | 3 +- htdocs/core/lib/functions.lib.php | 721 ++++++----------- htdocs/core/lib/functions2.lib.php | 252 ++---- htdocs/core/lib/functionsnumtoword.lib.php | 18 +- htdocs/core/lib/geturl.lib.php | 24 +- htdocs/core/lib/images.lib.php | 45 +- htdocs/core/lib/invoice.lib.php | 3 +- htdocs/core/lib/invoice2.lib.php | 9 +- htdocs/core/lib/json.lib.php | 12 +- htdocs/core/lib/ldap.lib.php | 12 +- htdocs/core/lib/memory.lib.php | 24 +- htdocs/core/lib/modulebuilder.lib.php | 12 +- htdocs/core/lib/parsemd.lib.php | 3 +- htdocs/core/lib/payments.lib.php | 12 +- htdocs/core/lib/pdf.lib.php | 99 +-- htdocs/core/lib/price.lib.php | 18 +- htdocs/core/lib/product.lib.php | 9 +- htdocs/core/lib/project.lib.php | 63 +- htdocs/core/lib/security.lib.php | 117 +-- htdocs/core/lib/security2.lib.php | 36 +- htdocs/core/lib/sendings.lib.php | 12 +- htdocs/core/lib/signature.lib.php | 3 +- htdocs/core/lib/tax.lib.php | 66 +- htdocs/core/lib/ticket.lib.php | 69 +- htdocs/core/lib/treeview.lib.php | 12 +- htdocs/core/lib/usergroups.lib.php | 117 +-- htdocs/core/lib/website.lib.php | 69 +- htdocs/core/lib/website2.lib.php | 6 +- htdocs/core/lib/ws.lib.php | 3 +- htdocs/core/lib/xcal.lib.php | 9 +- htdocs/core/login/functions_dolibarr.php | 9 +- htdocs/core/login/functions_ldap.php | 6 +- htdocs/core/login/functions_openid.php | 12 +- htdocs/core/menus/standard/auguria.lib.php | 24 +- htdocs/core/menus/standard/auguria_menu.php | 30 +- htdocs/core/menus/standard/eldy.lib.php | 33 +- htdocs/core/menus/standard/eldy_menu.php | 30 +- htdocs/core/menus/standard/empty.php | 27 +- htdocs/core/modules/DolibarrModules.class.php | 102 +-- htdocs/core/modules/action/modules_action.php | 9 +- .../core/modules/bank/doc/pdf_ban.modules.php | 18 +- .../bank/doc/pdf_sepamandate.modules.php | 21 +- .../barcode/mod_barcode_product_standard.php | 21 +- .../bom/doc/doc_generic_bom_odt.modules.php | 39 +- htdocs/core/modules/bom/mod_bom_standard.php | 3 +- .../modules/cheque/mod_chequereceipt_mint.php | 3 +- .../modules/cheque/modules_chequereceipts.php | 9 +- .../doc/doc_generic_order_odt.modules.php | 39 +- .../commande/doc/pdf_einstein.modules.php | 39 +- .../commande/doc/pdf_eratosthene.modules.php | 60 +- .../modules/commande/mod_commande_marbre.php | 3 +- .../doc/doc_generic_contract_odt.modules.php | 39 +- .../contract/doc/pdf_strato.modules.php | 30 +- .../modules/contract/mod_contract_olive.php | 3 +- .../modules/contract/mod_contract_serpis.php | 3 +- .../modules/dons/html_cerfafr.modules.php | 75 +- .../doc/doc_generic_shipment_odt.modules.php | 60 +- .../expedition/doc/pdf_espadon.modules.php | 51 +- .../expedition/doc/pdf_merou.modules.php | 30 +- .../expedition/doc/pdf_rouget.modules.php | 45 +- .../expedition/mod_expedition_safor.php | 3 +- .../doc/pdf_standard.modules.php | 39 +- .../expensereport/mod_expensereport_jade.php | 3 +- .../modules/export/export_csv.modules.php | 6 +- .../export/export_excel2007new.modules.php | 15 +- .../doc/doc_generic_invoice_odt.modules.php | 36 +- .../modules/facture/doc/pdf_crabe.modules.php | 45 +- .../facture/doc/pdf_sponge.modules.php | 78 +- .../core/modules/facture/mod_facture_mars.php | 12 +- .../modules/facture/mod_facture_mercure.php | 3 +- .../modules/facture/mod_facture_terre.php | 12 +- .../fichinter/doc/pdf_soleil.modules.php | 30 +- htdocs/core/modules/fichinter/mod_pacific.php | 3 +- .../modules/fichinter/modules_fichinter.php | 9 +- .../modules/holiday/mod_holiday_madonna.php | 3 +- .../modules/import/import_csv.modules.php | 87 +-- .../modules/import/import_xlsx.modules.php | 75 +- .../livraison/doc/pdf_typhon.modules.php | 33 +- .../modules/livraison/mod_livraison_jade.php | 3 +- .../mailings/advthirdparties.modules.php | 9 +- .../modules/mailings/contacts1.modules.php | 30 +- .../core/modules/mailings/fraise.modules.php | 9 +- .../modules/mailings/modules_mailings.php | 9 +- .../core/modules/mailings/pomme.modules.php | 3 +- .../modules/mailings/thirdparties.modules.php | 24 +- .../thirdparties_services_expired.modules.php | 6 +- .../modules/mailings/xinputfile.modules.php | 15 +- .../modules/mailings/xinputuser.modules.php | 6 +- .../modules/member/doc/pdf_standard.class.php | 27 +- htdocs/core/modules/member/modules_cards.php | 16 +- htdocs/core/modules/modAgenda.class.php | 3 +- htdocs/core/modules/modBlockedLog.class.php | 3 +- .../mrp/doc/doc_generic_mo_odt.modules.php | 39 +- htdocs/core/modules/mrp/mod_mo_standard.php | 3 +- .../modules/oauth/github_oauthcallback.php | 6 +- .../modules/oauth/google_oauthcallback.php | 6 +- .../oauth/stripelive_oauthcallback.php | 6 +- .../oauth/stripetest_oauthcallback.php | 6 +- .../modules/payment/mod_payment_cicada.php | 3 +- .../modules/printing/printgcp.modules.php | 18 +- .../modules/printing/printipp.modules.php | 6 +- .../doc/pdf_standardlabel.class.php | 18 +- .../printsheet/doc/pdf_tcpdflabel.class.php | 27 +- .../modules/printsheet/modules_labels.php | 15 +- .../doc/doc_generic_product_odt.modules.php | 36 +- .../product/doc/pdf_standard.modules.php | 18 +- .../product/mod_codeproduct_elephant.php | 18 +- .../product/mod_codeproduct_leopard.php | 3 +- .../modules/product/modules_product.class.php | 9 +- .../doc/doc_generic_project_odt.modules.php | 69 +- .../project/doc/pdf_baleine.modules.php | 27 +- .../project/doc/pdf_beluga.modules.php | 27 +- .../project/doc/pdf_timespent.modules.php | 27 +- .../modules/project/mod_project_simple.php | 6 +- .../task/doc/doc_generic_task_odt.modules.php | 48 +- .../modules/project/task/mod_task_simple.php | 6 +- .../doc/doc_generic_proposal_odt.modules.php | 39 +- .../modules/propale/doc/pdf_azur.modules.php | 54 +- .../modules/propale/doc/pdf_cyan.modules.php | 66 +- .../modules/propale/mod_propale_marbre.php | 6 +- .../modules/rapport/pdf_paiement.class.php | 3 +- .../doc/doc_generic_reception_odt.modules.php | 30 +- .../reception/doc/pdf_squille.modules.php | 42 +- .../modules/reception/mod_reception_beryl.php | 3 +- .../societe/doc/doc_generic_odt.modules.php | 30 +- .../societe/mod_codeclient_elephant.php | 18 +- .../societe/mod_codeclient_leopard.php | 3 +- .../modules/societe/mod_codeclient_monkey.php | 27 +- .../societe/mod_codecompta_aquarium.php | 15 +- .../societe/mod_codecompta_digitaria.php | 21 +- .../modules/societe/modules_societe.class.php | 3 +- .../doc/doc_generic_stock_odt.modules.php | 36 +- .../stock/doc/pdf_standard.modules.php | 45 +- .../stock/doc/pdf_stdmovement.modules.php | 48 +- .../doc/pdf_canelle.modules.php | 33 +- .../mod_facture_fournisseur_cactus.php | 12 +- .../mod_facture_fournisseur_tulip.php | 3 +- ...doc_generic_supplier_order_odt.modules.php | 42 +- .../supplier_order/doc/pdf_cornas.modules.php | 54 +- .../doc/pdf_muscadet.modules.php | 42 +- .../mod_commande_fournisseur_muguet.php | 3 +- .../doc/pdf_standard.modules.php | 30 +- .../mod_supplier_payment_bronan.php | 3 +- ..._generic_supplier_proposal_odt.modules.php | 42 +- .../doc/pdf_aurore.modules.php | 45 +- .../mod_supplier_proposal_marbre.php | 6 +- .../core/modules/syslog/mod_syslog_file.php | 6 +- .../core/modules/syslog/mod_syslog_syslog.php | 6 +- .../takepos/mod_takepos_ref_simple.php | 9 +- .../user/doc/doc_generic_user_odt.modules.php | 24 +- .../doc/doc_generic_usergroup_odt.modules.php | 36 +- htdocs/core/photos_resize.php | 84 +- htdocs/core/search.php | 3 +- htdocs/core/search_page.php | 6 +- .../core/tpl/admin_extrafields_edit.tpl.php | 6 +- .../core/tpl/admin_extrafields_view.tpl.php | 6 +- htdocs/core/tpl/bloc_comment.tpl.php | 6 +- htdocs/core/tpl/card_presend.tpl.php | 18 +- htdocs/core/tpl/commonfields_view.tpl.php | 3 +- htdocs/core/tpl/contacts.tpl.php | 29 +- .../tpl/extrafields_list_print_fields.tpl.php | 3 +- .../tpl/extrafields_list_search_input.tpl.php | 6 +- .../tpl/extrafields_list_search_sql.tpl.php | 6 +- .../tpl/extrafields_list_search_title.tpl.php | 3 +- htdocs/core/tpl/extrafields_view.tpl.php | 9 +- htdocs/core/tpl/filemanager.tpl.php | 9 +- htdocs/core/tpl/list_print_total.tpl.php | 3 +- htdocs/core/tpl/login.tpl.php | 6 +- htdocs/core/tpl/massactions_pre.tpl.php | 6 +- htdocs/core/tpl/notes.tpl.php | 12 +- htdocs/core/tpl/object_discounts.tpl.php | 3 +- htdocs/core/tpl/objectline_create.tpl.php | 42 +- htdocs/core/tpl/objectline_edit.tpl.php | 3 +- htdocs/core/tpl/objectline_view.tpl.php | 27 +- htdocs/core/tpl/passwordforgotten.tpl.php | 6 +- htdocs/core/tpl/resource_view.tpl.php | 6 +- .../interface_20_all_Logevents.class.php | 21 +- ...terface_50_modAgenda_ActionsAuto.class.php | 180 ++--- ..._modBlockedlog_ActionsBlockedLog.class.php | 9 +- ...interface_50_modLdap_Ldapsynchro.class.php | 54 +- ...odMailmanspip_Mailmanspipsynchro.class.php | 27 +- ..._50_modNotification_Notification.class.php | 3 +- ...terface_50_modTicket_TicketEmail.class.php | 3 +- .../interface_80_modStripe_Stripe.class.php | 12 +- htdocs/core/website.inc.php | 3 +- htdocs/cron/admin/cron.php | 6 +- htdocs/cron/card.php | 72 +- htdocs/cron/class/cronjob.class.php | 45 +- htdocs/cron/list.php | 18 +- .../datapolicy/class/datapolicycron.class.php | 6 +- htdocs/dav/dav.class.php | 18 +- .../class/DataCollector/DolLogsCollector.php | 3 +- htdocs/don/admin/donation.php | 37 +- htdocs/don/card.php | 36 +- htdocs/don/class/api_donations.class.php | 6 +- htdocs/don/class/don.class.php | 57 +- htdocs/don/class/paymentdonation.class.php | 27 +- htdocs/don/document.php | 3 +- htdocs/don/index.php | 3 +- htdocs/don/list.php | 6 +- htdocs/don/payment/card.php | 12 +- htdocs/don/payment/payment.php | 6 +- htdocs/don/stats/index.php | 6 +- htdocs/ecm/ajax/ecmdatabase.php | 12 +- htdocs/ecm/class/ecmdirectory.class.php | 51 +- htdocs/ecm/class/ecmfiles.class.php | 27 +- htdocs/ecm/class/htmlecm.form.class.php | 6 +- htdocs/ecm/dir_add_card.php | 18 +- htdocs/ecm/dir_card.php | 54 +- htdocs/ecm/file_card.php | 27 +- htdocs/ecm/index.php | 21 +- htdocs/ecm/index_auto.php | 21 +- .../class/emailcollector.class.php | 99 +-- .../class/emailcollectoraction.class.php | 24 +- .../class/emailcollectorfilter.class.php | 24 +- htdocs/expedition/card.php | 206 ++--- .../expedition/class/api_shipments.class.php | 9 +- htdocs/expedition/class/expedition.class.php | 183 ++--- .../class/expeditionbatch.class.php | 12 +- htdocs/expedition/contact.php | 6 +- htdocs/expedition/document.php | 6 +- htdocs/expedition/index.php | 6 +- htdocs/expedition/list.php | 6 +- htdocs/expedition/shipment.php | 33 +- htdocs/expedition/stats/index.php | 6 +- htdocs/expensereport/ajax/ajaxprojet.php | 6 +- htdocs/expensereport/card.php | 162 ++-- .../class/api_expensereports.class.php | 6 +- .../class/expensereport.class.php | 192 ++--- .../class/expensereport_ik.class.php | 12 +- .../class/expensereport_rule.class.php | 9 +- .../class/paymentexpensereport.class.php | 30 +- htdocs/expensereport/document.php | 3 +- htdocs/expensereport/index.php | 6 +- htdocs/expensereport/list.php | 21 +- htdocs/expensereport/payment/card.php | 12 +- htdocs/expensereport/payment/payment.php | 6 +- htdocs/expensereport/stats/index.php | 6 +- .../tpl/expensereport_linktofile.tpl.php | 9 +- htdocs/exports/class/export.class.php | 36 +- htdocs/exports/export.php | 54 +- htdocs/externalsite/admin/externalsite.php | 3 +- htdocs/externalsite/frames.php | 15 +- htdocs/fichinter/card-rec.php | 6 +- htdocs/fichinter/card.php | 108 +-- .../class/api_interventions.class.php | 3 +- htdocs/fichinter/class/fichinter.class.php | 90 +-- htdocs/fichinter/contact.php | 6 +- htdocs/fichinter/document.php | 3 +- htdocs/fichinter/index.php | 9 +- htdocs/fichinter/list.php | 3 +- htdocs/fichinter/stats/index.php | 12 +- htdocs/fourn/card.php | 39 +- .../class/api_supplier_invoices.class.php | 6 +- .../fourn/class/api_supplier_orders.class.php | 3 +- htdocs/fourn/class/fournisseur.class.php | 12 +- .../class/fournisseur.commande.class.php | 225 ++---- .../fournisseur.commande.dispatch.class.php | 30 +- .../fourn/class/fournisseur.facture.class.php | 141 ++-- .../fourn/class/fournisseur.product.class.php | 51 +- htdocs/fourn/class/paiementfourn.class.php | 51 +- htdocs/fourn/commande/card.php | 204 ++--- htdocs/fourn/commande/contact.php | 15 +- htdocs/fourn/commande/dispatch.php | 27 +- htdocs/fourn/commande/document.php | 3 +- htdocs/fourn/commande/index.php | 12 +- htdocs/fourn/commande/info.php | 6 +- htdocs/fourn/commande/list.php | 18 +- htdocs/fourn/commande/note.php | 3 +- htdocs/fourn/commande/orderstoinvoice.php | 6 +- htdocs/fourn/contact.php | 3 +- htdocs/fourn/facture/card.php | 179 ++--- htdocs/fourn/facture/contact.php | 15 +- htdocs/fourn/facture/document.php | 3 +- htdocs/fourn/facture/impayees.php | 3 +- htdocs/fourn/facture/list.php | 6 +- htdocs/fourn/facture/paiement.php | 33 +- htdocs/fourn/facture/rapport.php | 3 +- .../facture/tpl/linkedobjectblock.tpl.php | 3 +- htdocs/fourn/index.php | 9 +- htdocs/fourn/paiement/card.php | 24 +- htdocs/fourn/product/list.php | 3 +- htdocs/fourn/recap-fourn.php | 9 +- htdocs/ftp/admin/ftpclient.php | 15 +- htdocs/ftp/index.php | 84 +- htdocs/holiday/card.php | 78 +- htdocs/holiday/class/holiday.class.php | 129 +-- htdocs/holiday/define_holiday.php | 12 +- htdocs/holiday/document.php | 12 +- htdocs/holiday/list.php | 12 +- htdocs/holiday/month_report.php | 3 +- htdocs/holiday/view_log.php | 3 +- htdocs/hrm/admin/admin_establishment.php | 6 +- htdocs/hrm/class/establishment.class.php | 27 +- htdocs/hrm/establishment/card.php | 22 +- htdocs/hrm/index.php | 15 +- htdocs/imports/class/import.class.php | 12 +- htdocs/imports/import.php | 84 +- htdocs/install/check.php | 75 +- htdocs/install/inc.php | 18 +- htdocs/install/lib/repair.lib.php | 6 +- htdocs/install/repair.php | 131 ++-- htdocs/install/step1.php | 58 +- htdocs/install/step2.php | 51 +- htdocs/install/step5.php | 33 +- htdocs/install/upgrade.php | 21 +- htdocs/install/upgrade2.php | 504 ++++-------- htdocs/livraison/card.php | 34 +- htdocs/livraison/class/livraison.class.php | 51 +- htdocs/loan/card.php | 66 +- htdocs/loan/class/loan.class.php | 27 +- htdocs/loan/class/loanschedule.class.php | 18 +- htdocs/loan/class/paymentloan.class.php | 24 +- htdocs/loan/document.php | 3 +- htdocs/loan/list.php | 6 +- htdocs/loan/payment/card.php | 12 +- htdocs/loan/payment/payment.php | 18 +- htdocs/loan/schedule.php | 3 +- .../mailmanspip/class/mailmanspip.class.php | 51 +- htdocs/margin/admin/margin.php | 33 +- htdocs/margin/agentMargins.php | 3 +- htdocs/margin/customerMargins.php | 18 +- htdocs/margin/lib/margins.lib.php | 6 +- htdocs/margin/productMargins.php | 21 +- htdocs/margin/tabs/productMargins.php | 3 +- htdocs/margin/tabs/thirdpartyMargins.php | 9 +- htdocs/master.inc.php | 19 +- htdocs/mrp/ajax/ajax_bom.php | 3 +- htdocs/mrp/class/mo.class.php | 48 +- htdocs/mrp/index.php | 9 +- htdocs/mrp/mo_agenda.php | 6 +- htdocs/mrp/mo_card.php | 12 +- htdocs/mrp/mo_document.php | 3 +- htdocs/mrp/mo_list.php | 6 +- htdocs/mrp/mo_production.php | 9 +- .../class/multicurrency.class.php | 12 +- htdocs/opensurvey/card.php | 21 +- .../class/opensurveysondage.class.php | 21 +- htdocs/opensurvey/exportcsv.php | 9 +- htdocs/opensurvey/fonctions.php | 3 +- htdocs/opensurvey/index.php | 3 +- htdocs/opensurvey/list.php | 6 +- htdocs/opensurvey/results.php | 36 +- htdocs/opensurvey/wizard/choix_date.php | 6 +- htdocs/opensurvey/wizard/create_survey.php | 6 +- htdocs/paybox/admin/paybox.php | 3 +- htdocs/paypal/admin/paypal.php | 9 +- htdocs/paypal/lib/paypal.lib.php | 15 +- htdocs/paypal/lib/paypalfunctions.lib.php | 3 +- htdocs/printing/admin/printing.php | 21 +- htdocs/product/admin/dynamic_prices.php | 6 +- htdocs/product/admin/product.php | 51 +- htdocs/product/admin/product_extrafields.php | 3 +- .../admin/product_supplier_extrafields.php | 3 +- htdocs/product/admin/product_tools.php | 21 +- htdocs/product/agenda.php | 3 +- htdocs/product/ajax/products.php | 3 +- .../product/actions_card_product.class.php | 12 +- .../service/actions_card_service.class.php | 9 +- htdocs/product/card.php | 155 ++-- htdocs/product/class/api_products.class.php | 9 +- .../product/class/html.formproduct.class.php | 30 +- htdocs/product/class/product.class.php | 270 +++---- htdocs/product/class/productbatch.class.php | 21 +- .../class/propalmergepdfproduct.class.php | 24 +- htdocs/product/composition/card.php | 42 +- htdocs/product/document.php | 6 +- .../class/price_expression.class.php | 24 +- .../class/price_global_variable.class.php | 18 +- .../price_global_variable_updater.class.php | 27 +- .../class/price_parser.class.php | 14 +- htdocs/product/dynamic_price/editor.php | 30 +- htdocs/product/fournisseurs.php | 46 +- htdocs/product/index.php | 9 +- .../product/inventory/ajax/ajax.inventory.php | 6 +- htdocs/product/inventory/card.php | 15 +- .../inventory/class/inventory.class.php | 6 +- htdocs/product/inventory/inventory.php | 15 +- htdocs/product/inventory/list.php | 9 +- htdocs/product/list.php | 21 +- htdocs/product/popucom.php | 9 +- htdocs/product/popuprop.php | 9 +- htdocs/product/price.php | 69 +- htdocs/product/reassort.php | 9 +- htdocs/product/reassortlot.php | 9 +- htdocs/product/stats/card.php | 24 +- htdocs/product/stats/contrat.php | 6 +- htdocs/product/stats/facture.php | 3 +- htdocs/product/stats/mo.php | 6 +- htdocs/product/stock/card.php | 24 +- .../stock/class/api_stockmovements.class.php | 3 +- .../stock/class/api_warehouses.class.php | 3 +- htdocs/product/stock/class/entrepot.class.php | 39 +- .../stock/class/mouvementstock.class.php | 12 +- .../product/stock/class/productlot.class.php | 3 +- .../class/productstockentrepot.class.php | 15 +- htdocs/product/stock/fiche-valo.php | 3 +- htdocs/product/stock/index.php | 3 +- .../product/stock/lib/replenishment.lib.php | 3 +- htdocs/product/stock/list.php | 12 +- htdocs/product/stock/massstockmove.php | 18 +- htdocs/product/stock/movement_card.php | 33 +- htdocs/product/stock/movement_list.php | 33 +- htdocs/product/stock/product.php | 51 +- htdocs/product/stock/productlot_card.php | 12 +- htdocs/product/stock/productlot_document.php | 3 +- htdocs/product/stock/productlot_list.php | 3 +- htdocs/product/stock/replenish.php | 15 +- htdocs/product/stock/replenishorders.php | 3 +- .../product/stock/tpl/stocktransfer.tpl.php | 6 +- htdocs/product/stock/valo.php | 3 +- htdocs/product/traduction.php | 18 +- htdocs/projet/activity/index.php | 24 +- htdocs/projet/activity/perday.php | 30 +- htdocs/projet/activity/permonth.php | 24 +- htdocs/projet/activity/perweek.php | 24 +- htdocs/projet/admin/project.php | 84 +- htdocs/projet/card.php | 60 +- htdocs/projet/class/api_projects.class.php | 6 +- htdocs/projet/class/api_tasks.class.php | 6 +- htdocs/projet/class/project.class.php | 144 ++-- htdocs/projet/class/projectstats.class.php | 12 +- htdocs/projet/class/task.class.php | 114 +-- htdocs/projet/class/taskstats.class.php | 3 +- htdocs/projet/contact.php | 12 +- htdocs/projet/document.php | 3 +- htdocs/projet/element.php | 93 +-- htdocs/projet/ganttchart.inc.php | 6 +- htdocs/projet/ganttview.php | 9 +- htdocs/projet/graph_opportunities.inc.php | 3 +- htdocs/projet/index.php | 12 +- htdocs/projet/info.php | 3 +- htdocs/projet/list.php | 18 +- htdocs/projet/stats/index.php | 3 +- htdocs/projet/tasks.php | 36 +- htdocs/projet/tasks/comment.php | 6 +- htdocs/projet/tasks/contact.php | 27 +- htdocs/projet/tasks/document.php | 12 +- htdocs/projet/tasks/list.php | 18 +- htdocs/projet/tasks/note.php | 9 +- htdocs/projet/tasks/stats/index.php | 3 +- htdocs/projet/tasks/task.php | 27 +- htdocs/projet/tasks/time.php | 162 ++-- htdocs/public/agenda/agendaexport.php | 9 +- htdocs/public/cron/cron_run_jobs.php | 15 +- htdocs/public/demo/index.php | 12 +- htdocs/public/donations/donateurs_code.php | 9 +- htdocs/public/members/new.php | 54 +- htdocs/public/members/public_card.php | 3 +- htdocs/public/members/public_list.php | 6 +- htdocs/public/notice.php | 3 +- htdocs/public/onlinesign/newonlinesign.php | 12 +- htdocs/public/opensurvey/studs.php | 33 +- htdocs/public/payment/newpayment.php | 123 +-- htdocs/public/payment/paymentko.php | 15 +- htdocs/public/payment/paymentok.php | 96 +-- htdocs/public/stripe/confirm_payment.php | 9 +- htdocs/public/stripe/ipn.php | 72 +- htdocs/public/test/test_arrays.php | 3 +- htdocs/public/ticket/create_ticket.php | 3 +- htdocs/public/ticket/view.php | 6 +- htdocs/public/website/index.php | 9 +- htdocs/public/website/styles.css.php | 3 +- htdocs/reception/card.php | 123 +-- htdocs/reception/class/reception.class.php | 102 +-- htdocs/reception/contact.php | 6 +- htdocs/reception/index.php | 9 +- htdocs/reception/list.php | 21 +- htdocs/reception/stats/index.php | 6 +- htdocs/resource/agenda.php | 3 +- htdocs/resource/card.php | 30 +- htdocs/resource/class/dolresource.class.php | 48 +- .../class/html.formresource.class.php | 6 +- htdocs/resource/contact.php | 6 +- htdocs/resource/document.php | 3 +- htdocs/resource/element_resource.php | 21 +- htdocs/resource/list.php | 3 +- htdocs/salaries/admin/salaries.php | 6 +- htdocs/salaries/card.php | 18 +- htdocs/salaries/class/paymentsalary.class.php | 27 +- htdocs/salaries/document.php | 3 +- htdocs/salaries/list.php | 9 +- htdocs/salaries/stats/index.php | 3 +- htdocs/societe/admin/societe.php | 99 +-- htdocs/societe/agenda.php | 3 +- htdocs/societe/ajax/company.php | 3 +- htdocs/societe/ajaxcompanies.php | 9 +- .../canvas/actions_card_common.class.php | 24 +- .../company/actions_card_company.class.php | 21 +- .../actions_card_individual.class.php | 3 +- htdocs/societe/card.php | 144 ++-- htdocs/societe/checkvat/checkVatPopup.php | 21 +- htdocs/societe/class/api_contacts.class.php | 3 +- .../societe/class/api_thirdparties.class.php | 19 +- htdocs/societe/class/client.class.php | 3 +- .../class/companybankaccount.class.php | 33 +- .../class/companypaymentmode.class.php | 15 +- htdocs/societe/class/societe.class.php | 243 ++---- htdocs/societe/class/societeaccount.class.php | 24 +- htdocs/societe/consumption.php | 24 +- htdocs/societe/document.php | 3 +- htdocs/societe/index.php | 15 +- htdocs/societe/list.php | 6 +- htdocs/societe/note.php | 3 +- htdocs/societe/notify/card.php | 24 +- htdocs/societe/paymentmodes.php | 123 +-- htdocs/societe/price.php | 9 +- htdocs/societe/societecontact.php | 21 +- .../tpl/linesalesrepresentative.tpl.php | 3 +- htdocs/stripe/admin/stripe.php | 18 +- htdocs/stripe/charge.php | 18 +- htdocs/stripe/class/actions_stripe.class.php | 24 +- htdocs/stripe/class/stripe.class.php | 81 +- htdocs/stripe/config.php | 3 +- htdocs/stripe/payout.php | 6 +- htdocs/stripe/transaction.php | 6 +- htdocs/supplier_proposal/card.php | 57 +- .../class/api_supplier_proposals.class.php | 3 +- .../class/supplier_proposal.class.php | 162 ++-- htdocs/supplier_proposal/contact.php | 15 +- htdocs/supplier_proposal/document.php | 3 +- htdocs/supplier_proposal/index.php | 12 +- htdocs/supplier_proposal/list.php | 6 +- htdocs/support/inc.php | 6 +- htdocs/takepos/admin/bar.php | 3 +- htdocs/takepos/admin/orderprinters.php | 16 +- htdocs/takepos/admin/receipt.php | 21 +- htdocs/takepos/admin/setup.php | 6 +- htdocs/takepos/admin/terminal.php | 9 +- htdocs/takepos/ajax/ajax.php | 9 +- htdocs/takepos/genimg/index.php | 9 +- htdocs/takepos/index.php | 21 +- htdocs/takepos/invoice.php | 48 +- htdocs/takepos/pay.php | 6 +- htdocs/takepos/phone.php | 33 +- htdocs/takepos/reduction.php | 6 +- htdocs/theme/eldy/global.inc.php | 6 +- htdocs/theme/eldy/style.css.php | 12 +- htdocs/theme/eldy/theme_vars.inc.php | 3 +- htdocs/theme/md/style.css.php | 18 +- htdocs/theme/md/theme_vars.inc.php | 3 +- htdocs/ticket/agenda.php | 3 +- htdocs/ticket/card.php | 6 +- htdocs/ticket/class/actions_ticket.class.php | 3 +- htdocs/ticket/class/api_tickets.class.php | 3 +- htdocs/ticket/class/ticket.class.php | 39 +- htdocs/ticket/document.php | 3 +- htdocs/ticket/list.php | 12 +- htdocs/ticket/messaging.php | 3 +- htdocs/ticket/stats/index.php | 12 +- htdocs/user/bank.php | 18 +- htdocs/user/card.php | 207 ++--- htdocs/user/class/api_users.class.php | 12 +- htdocs/user/class/user.class.php | 210 ++--- htdocs/user/class/userbankaccount.class.php | 9 +- htdocs/user/class/usergroup.class.php | 57 +- htdocs/user/clicktodial.php | 9 +- htdocs/user/document.php | 3 +- htdocs/user/group/card.php | 33 +- htdocs/user/group/ldap.php | 12 +- htdocs/user/group/list.php | 6 +- htdocs/user/group/perms.php | 9 +- htdocs/user/hierarchy.php | 12 +- htdocs/user/home.php | 18 +- htdocs/user/ldap.php | 15 +- htdocs/user/list.php | 15 +- htdocs/user/note.php | 3 +- htdocs/user/notify/card.php | 33 +- htdocs/user/param_ihm.php | 12 +- htdocs/user/passwordforgotten.php | 33 +- htdocs/user/perms.php | 21 +- htdocs/viewimage.php | 7 +- scripts/cron/cron_run_jobs.php | 6 +- 961 files changed, 9487 insertions(+), 19110 deletions(-) diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index 0b2c4e54697..1acf181a4ba 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -91,8 +91,7 @@ if ($idobject > 0) $error++; dol_print_error($db, $obj->error); } -} -else { +} else { $error++; dol_print_error($db, $obj->error); } @@ -104,8 +103,7 @@ if (! $error) { $db->commit(); print '--- end ok'."\n"; -} -else { +} else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index d46913f3fcf..7fe1a82251a 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -89,8 +89,7 @@ if ($idobject > 0) $error++; dol_print_error($db, $com->error); } -} -else { +} else { $error++; dol_print_error($db, $com->error); } @@ -102,8 +101,7 @@ if (! $error) { $db->commit(); print '--- end ok'."\n"; -} -else { +} else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php index fb09c5f6e43..20b898a92aa 100755 --- a/dev/examples/code/create_product.php +++ b/dev/examples/code/create_product.php @@ -82,8 +82,7 @@ $idobject = $myproduct->create($user); if ($idobject > 0) { print "OK Object created with id ".$idobject."\n"; -} -else { +} else { $error++; dol_print_error($db, $myproduct->error); } @@ -94,8 +93,7 @@ if (! $error) { $db->commit(); print '--- end ok'."\n"; -} -else { +} else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php index 79fe30b73bf..d585b490a9c 100755 --- a/dev/examples/code/create_user.php +++ b/dev/examples/code/create_user.php @@ -78,12 +78,10 @@ if ($idobject > 0) $error++; dol_print_error($db, $obj->error); } -} -elseif ($obj->error == 'ErrorLoginAlreadyExists') +} elseif ($obj->error == 'ErrorLoginAlreadyExists') { print "User with login ".$obj->login." already exists\n"; -} -else { +} else { $error++; dol_print_error($db, $obj->error); } @@ -95,8 +93,7 @@ if (! $error) { $db->commit(); print '--- end ok'."\n"; -} -else { +} else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index d131e228f44..1b54469551c 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -119,8 +119,7 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); $country_code = $obj->code; - } - else dol_print_error($db); + } else dol_print_error($db); // Try to load sql file if ($country_code) @@ -143,8 +142,7 @@ if (empty($reshook)) if ($result > 0) { setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings'); } } @@ -234,8 +232,7 @@ if (strlen(trim($search_account))) { } $sql .= " AND (aa.account_number LIKE '".$startchar.$search_account_tmp_clean."'"; $sql .= " OR aa.account_number LIKE '".$startchar.$search_account_clean."%')"; - } - else $sql .= natural_search("aa.account_number", $search_account_tmp); + } else $sql .= natural_search("aa.account_number", $search_account_tmp); } } if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label); @@ -327,8 +324,7 @@ if ($resql) $i++; } - } - else dol_print_error($db); + } else dol_print_error($db); print ""; print ajax_combobox("chartofaccounts"); print ''; @@ -430,8 +426,7 @@ if ($resql) print $accountparent->getNomUrl(1); print "\n"; if (!$i) $totalarray['nbfield']++; - } - else { + } else { print ' '; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 66f1e3c0fa3..9794198332e 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -228,8 +228,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); - } - elseif ($value == 'entity') { + } elseif ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql .= ","; @@ -245,12 +244,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only - } - else { + } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); - } - else { + } else { dol_print_error($db); } } @@ -259,8 +256,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Si verif ok et action modify, on modifie la ligne if ($ok && GETPOST('actionmodify', 'alpha')) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } // Modify entry $sql = "UPDATE ".$tabname[$id]." SET "; @@ -275,8 +271,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); - } - elseif ($field == 'entity') { + } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql .= ","; @@ -305,8 +300,7 @@ if (GETPOST('actioncancel', 'alpha')) if ($action == 'confirm_delete' && $confirm == 'yes') // delete { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; @@ -317,8 +311,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); - } - else { + } else { dol_print_error($db); } } @@ -327,13 +320,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'"; } @@ -347,13 +338,11 @@ if ($action == $acts[0]) // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'"; } @@ -367,13 +356,11 @@ if ($action == $acts[1]) // favorite if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$code."'"; } @@ -387,13 +374,11 @@ if ($action == 'activate_favorite') // disable favorite if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$code."'"; } @@ -579,8 +564,7 @@ if ($id) print ''; print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; - } - else { + } else { print ''; } } @@ -626,8 +610,7 @@ if ($id) print ' '; print ' '; - } - else { + } else { $tmpaction = 'view'; $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -648,25 +631,20 @@ if ($id) if ($value == 'element') { $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; - } - elseif ($value == 'source') + } elseif ($value == 'source') { $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow; - } - elseif ($valuetoshow == 'all') { + } elseif ($valuetoshow == 'all') { $valuetoshow = $langs->trans('All'); - } - elseif ($fieldlist[$field] == 'country') { + } elseif ($fieldlist[$field] == 'country') { if (empty($obj->country_code)) { $valuetoshow = '-'; - } - else { + } else { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } - } - elseif ($fieldlist[$field] == 'country_id') { + } elseif ($fieldlist[$field] == 'country_id') { $showfield = 0; } @@ -703,8 +681,7 @@ if ($id) $i++; } } - } - else { + } else { dol_print_error($db); } @@ -756,8 +733,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = $fieldname = 'country'; print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; - } - elseif ($fieldlist[$field] == 'country_id') + } elseif ($fieldlist[$field] == 'country_id') { if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) { @@ -766,8 +742,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = print ''; print ''; } - } - elseif ($fieldlist[$field] == 'type_cdr') { + } elseif ($fieldlist[$field] == 'type_cdr') { if ($fieldlist[$field] == 'type_cdr') print ''; else print ''; if ($fieldlist[$field] == 'type_cdr') { @@ -776,11 +751,9 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); } print ''; - } - elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { + } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; - } - else { + } else { print ''; $size = ''; $class = ''; if ($fieldlist[$field] == 'code') $size = 'size="8" '; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 0fc2f9001a1..bc695da0203 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -75,16 +75,14 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) { $account_number = GETPOST('account_number', 'string'); - } - else { + } else { $account_number = clean_account(GETPOST('account_number', 'string')); } if (GETPOST('account_parent', 'int') <= 0) { $account_parent = 0; - } - else { + } else { $account_parent = GETPOST('account_parent', 'int'); } @@ -102,13 +100,11 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $error = 1; $action = "create"; setEventMessages($object->error, $object->errors, 'errors'); - } - elseif ($res == - 4) { + } elseif ($res == - 4) { $error = 2; $action = "create"; setEventMessages($object->error, $object->errors, 'errors'); - } - elseif ($res < 0) + } elseif ($res < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -138,16 +134,14 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) { $account_number = GETPOST('account_number', 'string'); - } - else { + } else { $account_number = clean_account(GETPOST('account_number', 'string')); } if (GETPOST('account_parent', 'int') <= 0) { $account_parent = 0; - } - else { + } else { $account_parent = GETPOST('account_parent', 'int'); } @@ -265,8 +259,7 @@ if ($action == 'create') { print ''; print ''; -} -elseif ($id > 0 || $ref) { +} elseif ($id > 0 || $ref) { $result = $object->fetch($id, $ref, 1); if ($result > 0) { diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 04c8cbce12a..ddd4240a073 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -235,12 +235,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only - } - else { + } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); - } - else { + } else { dol_print_error($db); } } @@ -249,8 +247,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Si verif ok et action modify, on modifie la ligne if ($ok && GETPOST('actionmodify', 'alpha')) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } // Modify entry $sql = "UPDATE ".$tabname[$id]." SET "; @@ -265,8 +262,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($field == 'fk_country' && $_POST['country'] > 0) { $_POST[$listfieldvalue[$i]] = $_POST['country']; - } - elseif ($field == 'entity') { + } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql .= ","; @@ -295,8 +291,7 @@ if (GETPOST('actioncancel', 'alpha')) if ($action == 'confirm_delete' && $confirm == 'yes') // delete { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; @@ -307,8 +302,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); - } - else { + } else { dol_print_error($db); } } @@ -317,13 +311,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code = '".$db->escape($code)."'"; } @@ -337,13 +329,11 @@ if ($action == $acts[0]) // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code = '".$db->escape($code)."'"; } @@ -357,13 +347,11 @@ if ($action == $acts[1]) // favorite if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape($code)."'"; } @@ -377,13 +365,11 @@ if ($action == 'activate_favorite') // disable favorite if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape($code)."'"; } @@ -595,8 +581,7 @@ if ($id) print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; $filterfound++; - } - else { + } else { print ''; } } @@ -723,8 +708,7 @@ if ($id) print ''; print ''; print ''; - } - else { + } else { $tmpaction = 'view'; $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -741,34 +725,27 @@ if ($id) if ($value == 'category_type') { $valuetoshow = yn($valuetoshow); - } - elseif ($valuetoshow == 'all') { + } elseif ($valuetoshow == 'all') { $valuetoshow = $langs->trans('All'); - } - elseif ($fieldlist[$field] == 'country') { + } elseif ($fieldlist[$field] == 'country') { if (empty($obj->country_code)) { $valuetoshow = '-'; - } - else { + } else { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } - } - elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') { + } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') { $key = $langs->trans("Country".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } - elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') { + } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') { $langs->loadLangs(array("propal")); $key = $langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } - elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') { + } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') { $key = $langs->trans("Action".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } - elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { + } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; } @@ -810,8 +787,7 @@ if ($id) if ($user->admin) print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ''; - } - else print ' '; + } else print ' '; // Link to setup the group print ''; @@ -827,8 +803,7 @@ if ($id) $i++; } } - } - else { + } else { dol_print_error($db); } @@ -876,13 +851,11 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co { $fieldname = 'country_id'; print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); - } - else { + } else { print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); } print ''; - } - elseif ($fieldlist[$field] == 'country_id') + } elseif ($fieldlist[$field] == 'country_id') { if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) { @@ -891,16 +864,13 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co print ''; print ''; } - } - elseif ($fieldlist[$field] == 'category_type') { + } elseif ($fieldlist[$field] == 'category_type') { print ''; print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); print ''; - } - elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { + } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; - } - else { + } else { print ''; $size = ''; $class = ''; if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index ad22a88f415..96303f36b1d 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -193,8 +193,7 @@ foreach ($list_account as $key) { $reg = array(); if (preg_match('/---(.*)---/', $key, $reg)) { print ''.$langs->trans($reg[1]).''; - } - else { + } else { print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 88890aa004f..27ef1ea7bd1 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -71,9 +71,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") { } else { setEventMessages($object->error, $object->errors, 'errors'); } -} - -elseif ($action == 'add') { +} elseif ($action == 'add') { if (!GETPOST('cancel', 'alpha')) { $error = 0; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 93942946b26..74247c5fccd 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -238,12 +238,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only - } - else { + } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); - } - else { + } else { dol_print_error($db); } } @@ -252,8 +250,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Si verif ok et action modify, on modifie la ligne if ($ok && GETPOST('actionmodify', 'alpha')) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } // Modify entry $sql = "UPDATE ".$tabname[$id]." SET "; @@ -268,8 +265,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); - } - elseif ($field == 'entity') { + } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql .= ","; @@ -299,8 +295,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($action == 'confirm_delete' && $confirm == 'yes') // delete { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; $sql .= " AND entity = ".$conf->entity; @@ -312,8 +307,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); - } - else { + } else { dol_print_error($db); } } @@ -322,13 +316,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'"; } $sql .= " AND entity = ".$conf->entity; @@ -343,13 +335,11 @@ if ($action == $acts[0]) // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } - else { $rowidcol = "rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { + } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'"; } $sql .= " AND entity = ".$conf->entity; @@ -593,8 +583,7 @@ if ($id) print ''; print '
'; print ''; - } - else { + } else { $tmpaction = 'view'; $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -611,12 +600,10 @@ if ($id) $valuetoshow = $obj->{$fieldlist[$field]}; if ($valuetoshow == 'all') { $valuetoshow = $langs->trans('All'); - } - elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { + } elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { $key = $langs->trans("AccountingJournalType".strtoupper($obj->nature)); $valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]}); - } - elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { + } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { $valuetoshow = $langs->trans($obj->label); } @@ -664,8 +651,7 @@ if ($id) if ($user->admin) print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ''; - } - else print ' '; + } else print ' '; print ''; @@ -676,8 +662,7 @@ if ($id) $i++; } } - } - else { + } else { dol_print_error($db); } @@ -721,11 +706,9 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') print ''; print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')); print ''; - } - elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { + } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; - } - else { + } else { print ''; $size = ''; $class = ''; if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 6006e97b8da..b6465b95355 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -252,20 +252,16 @@ $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON"; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { $sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; -} -elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') +} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { $sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; -} -elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') +} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { $sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; -} -elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') +} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') { $sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; -} -elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') +} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { $sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; } else { @@ -288,13 +284,11 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { if (strlen(trim($search_current_account))) { $sql .= natural_search("p.accountancy_code_sell", $search_current_account); } -} -elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { +} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { if (strlen(trim($search_current_account))) { $sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account); } -} -else { +} else { if (strlen(trim($search_current_account))) { $sql .= natural_search("p.accountancy_code_sell_export", $search_current_account); } @@ -490,34 +484,27 @@ if ($result) if ($accounting_product_mode == 'ACCOUNTANCY_SELL') { $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_prodsell; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_prodsell_intra; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_prodsell_export; - } - else { + } else { $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_prodsell; } - } - else { + } else { if ($accounting_product_mode == 'ACCOUNTANCY_SELL') { $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_servsell; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_servsell_intra; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_servsell_export; - } - else { + } else { $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_servsell; } @@ -528,34 +515,27 @@ if ($result) if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_prodbuy; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_prodbuy_intra; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_prodbuy_export; - } - else { + } else { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_prodbuy; } - } - else { + } else { if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_servbuy; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_servbuy_intra; - } - elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_servbuy_export; - } - else { + } else { $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_servbuy; } @@ -618,7 +598,7 @@ if ($result) if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print ''; - } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { // Accounting account buy intra (In EEC) print ''; //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code @@ -628,7 +608,7 @@ if ($result) if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print ''; - } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { + } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { // Accounting account buy export (Out of EEC) print ''; //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 8ab554c08e7..1fcce431b24 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -138,9 +138,7 @@ if ($action == "confirm_update") { } } } -} - -elseif ($action == "add") { +} elseif ($action == "add") { $error = 0; if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) @@ -199,9 +197,7 @@ elseif ($action == "add") { $action = ''; } } -} - -elseif ($action == "confirm_delete") { +} elseif ($action == "confirm_delete") { $object = new BookKeeping($db); $result = $object->fetch($id, null, $mode); @@ -216,9 +212,7 @@ elseif ($action == "confirm_delete") { } } $action = ''; -} - -elseif ($action == "confirm_create") { +} elseif ($action == "confirm_create") { $error = 0; $object = new BookKeeping($db); @@ -628,8 +622,7 @@ if ($action == 'create') if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); - } - else { + } else { print 'subledger_account).'">'; } print ''; @@ -684,8 +677,7 @@ if ($action == 'create') if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount('', 'subledger_account', 1); - } - else { + } else { print ''; } print ''; @@ -705,8 +697,7 @@ if ($action == 'create') if ($total_debit == $total_credit) { print ''.$langs->trans("ValidTransaction").''; - } - else { + } else { print ''; } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 87808e95500..3282f7f363f 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -351,16 +351,14 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0)); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { setEventMessages("RecordDeleted", null, 'mesgs'); } // Make a redirect to avoid to launch the delete later after a back button header("Location: list.php".($param ? '?'.$param : '')); exit; - } - else { + } else { setEventMessages("NoRecordDeleted", null, 'warnings'); } } @@ -371,8 +369,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri $result = $object->deleteMvtNum($mvt_num); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } @@ -477,8 +474,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { // Export files $accountancyexport = new AccountancyExport($db); $accountancyexport->export($object->lines, $formatexportset); @@ -486,8 +482,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { if (!empty($accountancyexport->errors)) { setEventMessages('', $accountancyexport->errors, 'errors'); - } - else { + } else { // Specify as export : update field date_export $error = 0; $db->begin(); @@ -516,8 +511,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { { $db->commit(); // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); - } - else { + } else { $error++; $db->rollback(); setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); @@ -553,8 +547,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -714,8 +707,7 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); - } - else { + } else { print ''; } print ''; @@ -726,8 +718,7 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); - } - else { + } else { print ''; } print ''; @@ -920,8 +911,7 @@ while ($i < min($num, $limit)) $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - } - elseif ($line->doc_type == 'supplier_invoice') + } elseif ($line->doc_type == 'supplier_invoice') { $langs->loadLangs(array('bills')); @@ -934,8 +924,7 @@ while ($i < min($num, $limit)) $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); - } - elseif ($line->doc_type == 'expense_report') + } elseif ($line->doc_type == 'expense_report') { $langs->loadLangs(array('trips')); @@ -948,8 +937,7 @@ while ($i < min($num, $limit)) $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - } - else { + } else { // Other type } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index a2b456b52b3..1f4ac513806 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -254,16 +254,14 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0)); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { setEventMessages("RecordDeleted", null, 'mesgs'); } // Make a redirect to avoid to launch the delete later after a back button header("Location: listbyaccount.php".($param ? '?'.$param : '')); exit; - } - else { + } else { setEventMessages("NoRecordDeleted", null, 'warnings'); } } @@ -274,8 +272,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri $result = $object->deleteMvtNum($mvt_num); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } @@ -534,8 +531,7 @@ while ($i < min($num, $limit)) print price($sous_total_debit - $sous_total_credit); print ''; print ''; - } - else { + } else { print ''; print ''; print price($sous_total_credit - $sous_total_debit); @@ -607,8 +603,7 @@ while ($i < min($num, $limit)) $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - } - elseif ($line->doc_type == 'supplier_invoice') + } elseif ($line->doc_type == 'supplier_invoice') { $langs->loadLangs(array('bills')); @@ -621,8 +616,7 @@ while ($i < min($num, $limit)) $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); - } - elseif ($line->doc_type == 'expense_report') + } elseif ($line->doc_type == 'expense_report') { $langs->loadLangs(array('trips')); @@ -635,8 +629,7 @@ while ($i < min($num, $limit)) $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - } - else { + } else { // Other type } @@ -737,8 +730,7 @@ if ($balance > 0 ) print price($sous_total_debit - $sous_total_credit); print ''; print ''; -} -else { +} else { print ''; print ''; print price($sous_total_credit - $sous_total_debit); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 0150e1d155d..c7f7f8cf68c 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -209,8 +209,7 @@ class AccountancyCategory // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -268,8 +267,7 @@ class AccountancyCategory // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -332,8 +330,7 @@ class AccountancyCategory // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -371,8 +368,7 @@ class AccountancyCategory // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -704,8 +700,7 @@ class AccountancyCategory // extends CommonObject $listofaccount .= "'".$cptcursor."'"; } $sql .= " AND t.numero_compte IN (".$listofaccount.")"; - } - else { + } else { $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'"; } if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end @@ -827,8 +822,7 @@ class AccountancyCategory // extends CommonObject $sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql .= " AND t.entity = ".$conf->entity; $sql .= " ORDER BY t.account_number"; - } - else { + } else { $sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; $sql .= " WHERE ".$predefinedgroupwhere; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 33c2537f600..1c76d0408da 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -362,7 +362,7 @@ class AccountancyExport if ($line->sens == 'D') { print price($line->montant).$separator; print ''.$separator; - }elseif ($line->sens == 'C') { + } elseif ($line->sens == 'C') { print ''.$separator; print price($line->montant).$separator; } @@ -602,8 +602,7 @@ class AccountancyExport $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); - } - else { + } else { $Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -899,12 +898,10 @@ class AccountancyExport if ($aIndex - 2 >= 0 && $objectLines[$aIndex - 2]->piece_num == $line->piece_num) { $sammelBuchung = true; - } - elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num) + } elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num) { $sammelBuchung = true; - } - elseif ($aIndex + 1 < $aSize + } elseif ($aIndex + 1 < $aSize && $objectLines[$aIndex + 1]->piece_num == $line->piece_num && $aIndex - 1 < $aSize && $objectLines[$aIndex - 1]->piece_num == $line->piece_num @@ -926,8 +923,7 @@ class AccountancyExport if ($line->sens == 'D') { print 'S'.$this->separator; - } - else { + } else { print 'H'.$this->separator; } //Grp @@ -938,12 +934,10 @@ class AccountancyExport if ($line->piece_num == $thisPieceNum) { print length_accounta($thisPieceAccountNr).$this->separator; - } - else { + } else { print "div".$this->separator; } - } - else { + } else { print length_accounta($line->code_tiers).$this->separator; } //SId @@ -959,8 +953,7 @@ class AccountancyExport if ($sammelBuchung) { print "2".$this->separator; - } - else { + } else { print "1".$this->separator; } // Code @@ -969,8 +962,7 @@ class AccountancyExport if ($line->montant >= 0) { print $line->montant.$this->separator; - } - else { + } else { print ($line->montant * -1).$this->separator; } // Steuer diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index bcd17793db1..6a3fa8e7998 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -609,8 +609,7 @@ class AccountingAccount extends CommonObject if ($mode == 0) { $fieldtouse = 'active'; - } - elseif ($mode == 1) + } elseif ($mode == 1) { $fieldtouse = 'reconcilable'; } @@ -661,28 +660,23 @@ class AccountingAccount extends CommonObject { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 7b78cbca84b..6067f557cfb 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -109,8 +109,7 @@ class AccountingJournal extends CommonObject $sql .= " WHERE"; if ($rowid) { $sql .= " rowid = ".(int) $rowid; - } - elseif ($journal_code) + } elseif ($journal_code) { $sql .= " code = '".$this->db->escape($journal_code)."'"; $sql .= " AND entity = ".$conf->entity; @@ -136,8 +135,7 @@ class AccountingJournal extends CommonObject } else { return 0; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror(); } @@ -310,8 +308,7 @@ class AccountingJournal extends CommonObject elseif ($nature == 3) return $langs->trans('AccountingJournalType3'); elseif ($nature == 2) return $langs->trans('AccountingJournalType2'); elseif ($nature == 1) return $langs->trans('AccountingJournalType1'); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($nature == 9) return $langs->trans('AccountingJournalType9'); elseif ($nature == 5) return $langs->trans('AccountingJournalType5'); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 2f197d7919f..713d5175d31 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -258,8 +258,7 @@ class BookKeeping extends CommonObject if (in_array($this->doc_type, array('bank', 'expense_report'))) { $this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type); - } - else { + } else { //$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte); $mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte; if ($this->subledger_account && $this->subledger_account != $this->numero_compte) @@ -476,8 +475,7 @@ class BookKeeping extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 7c184cced45..4d24110f7e6 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -59,8 +59,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) $resql = $db->query($sql); if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); - } - else { + } else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($backtopage) { diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index c2ba41d7368..425e8aecc81 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -201,8 +201,7 @@ if ($action == 'validatehistory') { if ($error) { $db->rollback(); - } - else { + } else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } @@ -277,15 +276,13 @@ if ($resql) { if ($row[0] == 'tobind') { print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); + } else print length_accountg($row[0]); print ''; print ''; if ($row[0] == 'tobind') { print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; + } else print $row[1]; print ''; for ($i = 2; $i <= 12; $i++) { print ''.price($row[$i]).''; @@ -352,16 +349,14 @@ if ($resql) { if ($row[0] == 'tobind') { print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); + } else print length_accountg($row[0]); print ''; print ''; if ($row[0] == 'tobind') { print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; + } else print $row[1]; print ''; for ($i = 2; $i <= 12; $i++) { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4e551fef9e8..bf28da1d5d2 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -159,8 +159,7 @@ if ($massaction == 'ventil') { { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; - } - else { + } else { $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet"; $sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " WHERE rowid = ".$monId; @@ -628,8 +627,7 @@ if ($result) { $suggestedid = $tmpaccount->id; } $accountingaccount_codetotid_cache[$objp->code_sell_l] = $tmpaccount->id; - } - else { + } else { $suggestedid = $accountingaccount_codetotid_cache[$objp->code_sell_l]; } } diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index acea87f95a6..8b04ca74c81 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -63,8 +63,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) $resql = $db->query($sql); if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); - } - else { + } else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($backtopage) { diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 9573cbfc257..9fe07b18a37 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -189,15 +189,13 @@ if ($resql) { if ($row[0] == 'tobind') { print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); + } else print length_accountg($row[0]); print ''; print ''; if ($row[0] == 'tobind') { print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; + } else print $row[1]; print ''; for ($i = 2; $i <= 12; $i++) { print ''.price($row[$i]).''; @@ -260,16 +258,14 @@ if ($resql) { if ($row[0] == 'tobind') { print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); + } else print length_accountg($row[0]); print ''; print ''; if ($row[0] == 'tobind') { print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; + } else print $row[1]; print ''; for ($i = 2; $i <= 12; $i++) { print ''.price($row[$i]).''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 706bd41f2b0..c7c3146e85a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -138,8 +138,7 @@ if ($massaction == 'ventil') { { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; - } - else { + } else { $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det"; $sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " WHERE rowid = ".$monId; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 2fbbfe4b104..e92d42266a8 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -240,8 +240,7 @@ if ($conf->accounting->enabled) print $boxlist; print ''; -} -else { +} else { print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); print $langs->trans("Module10Desc")."
\n"; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 96fa45bcfd1..07614dcc618 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -276,8 +276,7 @@ if ($result) { // We save tabtype for a future use, to remember what kind of payment it is $tabpay[$obj->rowid]['type'] = $links[$key]['type']; $tabtype[$obj->rowid] = $links[$key]['type']; - } - elseif (in_array($links[$key]['type'], array('company', 'user'))) + } elseif (in_array($links[$key]['type'], array('company', 'user'))) { if ($tabpay[$obj->rowid]['type'] == 'unknown') { @@ -549,8 +548,7 @@ if (!$error && $action == 'writebookkeeping') { $error++; $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -574,8 +572,7 @@ if (!$error && $action == 'writebookkeeping') { if ($tabtype[$key] == 'banktransfert') { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); - } - else { + } else { $reflabel .= dol_string_nohtmltag($val['soclib']); } @@ -697,8 +694,7 @@ if (!$error && $action == 'writebookkeeping') { $error++; $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -706,8 +702,7 @@ if (!$error && $action == 'writebookkeeping') { } } } - } - else { // If thirdparty unknown, output the waiting account + } else { // If thirdparty unknown, output the waiting account foreach ($tabbq[$key] as $k => $mt) { if ($mt) { @@ -744,8 +739,7 @@ if (!$error && $action == 'writebookkeeping') { $error++; $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -766,8 +760,7 @@ if (!$error && $action == 'writebookkeeping') { if (!$errorforline) { $db->commit(); - } - else { + } else { //print 'KO for line '.$key.' '.$error.'
'; $db->rollback(); @@ -782,12 +775,10 @@ if (!$error && $action == 'writebookkeeping') { if (empty($error) && count($tabpay) > 0) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); - } - elseif (count($tabpay) == $error) + } elseif (count($tabpay) == $error) { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); - } - else { + } else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } @@ -873,8 +864,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if ($tabtype[$key] == 'banktransfert') { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); - } - else { + } else { $reflabel .= dol_string_nohtmltag($val['soclib']); } @@ -972,8 +962,7 @@ if (empty($action) || $action == 'view') { print '
'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); print ' : '.$langs->trans("AccountancyAreaDescBank", 9, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").''); } - } - else dol_print_error($db); + } else dol_print_error($db); // Button to write into Ledger @@ -992,8 +981,7 @@ if (empty($action) || $action == 'view') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; - } - else { + } else { if ($in_bookkeeping == 'notyet') print ''; else print '
'.$langs->trans("WriteBookKeeping").''; } @@ -1065,8 +1053,7 @@ if (empty($action) || $action == 'view') { if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { print ''.$langs->trans("BankAccountNotDefined").''; - } - else print $accounttoshow; + } else print $accounttoshow; print ""; // Subledger account print ""; @@ -1097,8 +1084,7 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'banktransfert') { $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; - } - else { + } else { $reflabel .= $val['soclib']; } @@ -1126,12 +1112,10 @@ if (empty($action) || $action == 'view') { if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') { print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; - } - else { + } else { print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account } - } - else { + } else { // We will refuse writing $errorstring = 'UnknownAccountForThirdpartyBlocking'; if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined'; @@ -1142,8 +1126,7 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; print ''.$langs->trans($errorstring).''; } - } - else print $accounttoshow; + } else print $accounttoshow; print ""; // Subledger account @@ -1167,12 +1150,10 @@ if (empty($action) || $action == 'view') { } else { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } - } - else { + } else { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; } - } - else print $accounttoshowsubledger; + } else print $accounttoshowsubledger; } } print ""; @@ -1278,57 +1259,49 @@ function getSourceDocRef($val, $typerecord) $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"]; $ref = $langs->transnoentitiesnoconv("Invoice"); - } - elseif ($typerecord == 'payment_supplier') + } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f"; $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"]; $ref = $langs->transnoentitiesnoconv("SupplierInvoice"); - } - elseif ($typerecord == 'payment_expensereport') + } elseif ($typerecord == 'payment_expensereport') { $sqlmid = 'SELECT e.rowid as id, e.ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e"; $sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid"; $ref = $langs->transnoentitiesnoconv("ExpenseReport"); - } - elseif ($typerecord == 'payment_salary') + } elseif ($typerecord == 'payment_salary') { $sqlmid = 'SELECT s.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sqlmid .= " WHERE s.rowid=".$val["paymentsalid"]; $ref = $langs->transnoentitiesnoconv("SalaryPayment"); - } - elseif ($typerecord == 'sc') + } elseif ($typerecord == 'sc') { $sqlmid = 'SELECT sc.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc"; $sqlmid .= " WHERE sc.rowid=".$val["paymentscid"]; $ref = $langs->transnoentitiesnoconv("SocialContribution"); - } - elseif ($typerecord == 'payment_vat') + } elseif ($typerecord == 'payment_vat') { $sqlmid = 'SELECT v.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v"; $sqlmid .= " WHERE v.rowid=".$val["paymentvatid"]; $ref = $langs->transnoentitiesnoconv("PaymentVat"); - } - elseif ($typerecord == 'payment_donation') + } elseif ($typerecord == 'payment_donation') { $sqlmid = 'SELECT payd.fk_donation as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd"; $sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"]; $ref = $langs->transnoentitiesnoconv("Donation"); - } - elseif ($typerecord == 'payment_loan') + } elseif ($typerecord == 'payment_loan') { $sqlmid = 'SELECT l.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l"; $sqlmid .= " WHERE l.rowid=".$val["paymentloanid"]; $ref = $langs->transnoentitiesnoconv("LoanPayment"); - } - elseif ($typerecord == 'payment_various') + } elseif ($typerecord == 'payment_various') { $sqlmid = 'SELECT v.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v"; @@ -1351,8 +1324,7 @@ function getSourceDocRef($val, $typerecord) { $ref .= ' '.$objmid->ref; } - } - else dol_print_error($db); + } else dol_print_error($db); } $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300 diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 6ed33f56ef1..bffd533d312 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -231,8 +231,7 @@ if ($action == 'writebookkeeping') { $error++; $errorforline++; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -280,8 +279,7 @@ if ($action == 'writebookkeeping') { $error++; $errorforline++; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -339,8 +337,7 @@ if ($action == 'writebookkeeping') { $error++; $errorforline++; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -362,8 +359,7 @@ if ($action == 'writebookkeeping') { if (!$errorforline) { $db->commit(); - } - else { + } else { $db->rollback(); if ($error >= 10) @@ -378,12 +374,10 @@ if ($action == 'writebookkeeping') { if (empty($error) && count($tabpay) > 0) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); - } - elseif (count($tabpay) == $error) + } elseif (count($tabpay) == $error) { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); - } - else { + } else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } @@ -506,8 +500,7 @@ if (empty($action) || $action == 'view') { if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { print ''; - } - else { + } else { if ($in_bookkeeping == 'notyet') print ''; else print ''.$langs->trans("WriteBookKeeping").''; } @@ -577,8 +570,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("FeeAccountNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ''; // Subledger account print ""; @@ -607,8 +599,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForUsersNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ""; // Subledger account print ""; @@ -616,8 +607,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("UserAccountNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ''; print "".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount").""; print ''.($mt < 0 ? -price(-$mt) : '').""; @@ -644,8 +634,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ""; // Subledger account print ""; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c7cff6443ca..acdc3fbface 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -227,8 +227,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice { $errorforinvoice[$key] = 'somelinesarenotbound'; } - } - else dol_print_error($db); + } else dol_print_error($db); } //var_dump($errorforinvoice);exit; @@ -332,8 +331,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -383,8 +381,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -445,8 +442,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -497,8 +493,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -521,8 +516,7 @@ if ($action == 'writebookkeeping') { if (!$errorforline) { $db->commit(); - } - else { + } else { $db->rollback(); if ($error >= 10) @@ -537,12 +531,10 @@ if ($action == 'writebookkeeping') { if (empty($error) && count($tabpay) > 0) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); - } - elseif (count($tabpay) == $error) + } elseif (count($tabpay) == $error) { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); - } - else { + } else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } @@ -738,8 +730,7 @@ if (empty($action) || $action == 'view') { if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; - } - else { + } else { if ($in_bookkeeping == 'notyet') print ''; else print ''.$langs->trans("WriteBookKeeping").''; } @@ -866,8 +857,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ''; // Subledger account print ""; @@ -875,8 +865,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ''; print "".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount").""; print ''.($mt < 0 ? price(-$mt) : '').""; @@ -899,8 +888,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ProductAccountNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ""; // Subledger account print ""; @@ -932,8 +920,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'; - } - else print $accountoshow; + } else print $accountoshow; print ""; // Subledger account print ""; @@ -963,8 +950,7 @@ if (empty($action) || $action == 'view') { if ($accountoshow == '' || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'; - } - else print $accountoshow; + } else print $accountoshow; print ''; // Subledger account print ""; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 9bfa10dd3f1..77a911db9b3 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -241,8 +241,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice { $errorforinvoice[$key] = 'somelinesarenotbound'; } - } - else dol_print_error($db); + } else dol_print_error($db); } //var_dump($errorforinvoice);exit; @@ -343,8 +342,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -394,8 +392,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -455,8 +452,7 @@ if ($action == 'writebookkeeping') { $errorforline++; $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else { + } else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -480,8 +476,7 @@ if ($action == 'writebookkeeping') { if (!$errorforline) { $db->commit(); - } - else { + } else { $db->rollback(); if ($error >= 10) @@ -496,11 +491,9 @@ if ($action == 'writebookkeeping') { if (empty($error) && count($tabpay) > 0) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); - } - elseif (count($tabpay) == $error) { + } elseif (count($tabpay) == $error) { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); - } - else { + } else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } @@ -676,8 +669,7 @@ if (empty($action) || $action == 'view') { if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { print ''; - } - else { + } else { if ($in_bookkeeping == 'notyet') print ''; else print ''.$langs->trans("WriteBookKeeping").''; } @@ -803,8 +795,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForCustomersNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ''; // Subledger account print ""; @@ -812,8 +803,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ''; print "".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount").""; print ''.($mt >= 0 ? price($mt) : '').""; @@ -837,8 +827,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ProductNotDefined").''; - } - else print $accountoshow; + } else print $accountoshow; print ""; // Subledger account print ""; @@ -871,8 +860,7 @@ if (empty($action) || $action == 'view') { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'; - } - else print $accountoshow; + } else print $accountoshow; print ""; // Subledger account print ""; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index b8d32e690a1..40bd99c5582 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -63,8 +63,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) $resql = $db->query($sql); if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); - } - else { + } else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($backtopage) { diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 9cd2b0c61e4..8b37418a3bc 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -191,8 +191,7 @@ if ($action == 'validatehistory') { if ($error) { $db->rollback(); - } - else { + } else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } @@ -261,15 +260,13 @@ if ($resql) { if ($row[0] == 'tobind') { print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); + } else print length_accountg($row[0]); print ''; print ''; if ($row[0] == 'tobind') { print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; + } else print $row[1]; print ''; for ($i = 2; $i <= 12; $i++) { print ''.price($row[$i]).''; @@ -331,15 +328,13 @@ if ($resql) { if ($row[0] == 'tobind') { print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); + } else print length_accountg($row[0]); print ''; print ''; if ($row[0] == 'tobind') { print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; + } else print $row[1]; print ''; for ($i = 2; $i <= 12; $i++) { print ''.price($row[$i]).''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2c7110bf65d..fffef9147a9 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -163,8 +163,7 @@ if ($massaction == 'ventil') { { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; - } - else { + } else { $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; $sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " WHERE rowid = ".$monId; @@ -608,8 +607,7 @@ if ($result) { $suggestedid = $tmpaccount->id; } $accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id; - } - else { + } else { $suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l]; } } diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index a6addb536a2..44e103059d7 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -58,8 +58,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$ $endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard'); $completefilename = $siren."FEC".$endaccountingperiod.".txt"; -} -else { +} else { $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; } diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 25481ccb39d..8cc22578f2a 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -54,8 +54,7 @@ if ($action == 'setproductionmode') setEventMessages($langs->trans("ErrorFailedToCreateDir", $conf->api->dir_temp), null, 'errors'); $error++; } - } - else { + } else { // Delete the cache file otherwise it does not update $result = dol_delete_file($conf->api->dir_temp.'/routes.php'); if ($result < 0) @@ -70,8 +69,7 @@ if ($action == 'setproductionmode') header("Location: ".$_SERVER["PHP_SELF"]); exit; } - } - else { + } else { dol_print_error($db); } } @@ -117,8 +115,7 @@ if ($production_mode) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; -} -else { +} else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -162,8 +159,7 @@ if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/e { $url = DOL_MAIN_URL_ROOT.'/api/index.php/explorer'; print img_picto('', 'globe').' '.$url."
\n"; -} -else { +} else { print $langs->trans("NotAvailableWithThisDistribution"); } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fa96788f585..83bd00555d6 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -250,8 +250,7 @@ class DolibarrApi $featuresarray = array($resource); if (preg_match('/&/', $resource)) { $featuresarray = explode("&", $resource); - } - elseif (preg_match('/\|/', $resource)) { + } elseif (preg_match('/\|/', $resource)) { $featuresarray = explode("|", $resource); } @@ -317,8 +316,7 @@ class DolibarrApi if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { $tmpescaped = "'".$db->escape($regbis[1])."'"; - } - else { + } else { $tmpescaped = $db->escape($tmpescaped); } return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index e0551cf07d9..a6d0d72b8de 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -128,8 +128,7 @@ class DolibarrApiAccess implements iAuthenticate $conf->setValues($db); } } - } - else { + } else { throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg); } @@ -157,8 +156,7 @@ class DolibarrApiAccess implements iAuthenticate if ($fuser->admin) { static::$role = 'admin'; } - } - else { + } else { throw new RestException(401, "Failed to login to API. No parameter 'HTTP_DOLAPIKEY' on HTTP header (and no parameter DOLAPIKEY in URL)."); } diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 0a9b8b63e7b..078d631aa3d 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -122,8 +122,7 @@ class Login { throw new RestException(500, 'Error when updating api_key for user :'.$this->db->lasterror()); } - } - else { + } else { $token = $tmpuser->api_key; } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index e5bf7a00eea..5dade088fd0 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -878,8 +878,7 @@ class Setup extends DolibarrApi $list[$tab->elementtype][$tab->name]['list'] = $tab->list; } } - } - else { + } else { throw new RestException(503, 'Error when retrieving list of extra fields : '.$this->db->lasterror()); } @@ -1483,12 +1482,10 @@ class Setup extends DolibarrApi if (dol_is_file($xmlfile)) { $xml = simplexml_load_file($xmlfile); - } - else { + } else { throw new RestException(500, $langs->trans('XmlNotFound').': '.$xmlfile); } - } - else { + } else { $xmlarray = getURLContent($xmlremote); // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) @@ -1497,8 +1494,7 @@ class Setup extends DolibarrApi $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."endxmlfile"; $xml = simplexml_load_string($xmlfile); - } - else { + } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; throw new RestException(500, $errormsg); } @@ -1605,8 +1601,7 @@ class Setup extends DolibarrApi $out .= ''.$file['expectedmd5'].''."\n"; $out .= "\n"; } - } - else { + } else { $out .= ''.$langs->trans("None").''; } $out .= ''; @@ -1654,8 +1649,7 @@ class Setup extends DolibarrApi $out .= ''.dol_print_size($totalsize).''."\n"; $out .= ''."\n"; $out .= "\n"; - } - else { + } else { $out .= ''.$langs->trans("None").''; } $out .= ''; @@ -1703,8 +1697,7 @@ class Setup extends DolibarrApi $out .= ''.dol_print_size($totalsize).''."\n"; $out .= ''."\n"; $out .= "\n"; - } - else { + } else { $out .= ''.$langs->trans("None").''; } $out .= ''; @@ -1715,12 +1708,10 @@ class Setup extends DolibarrApi if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) { //setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); - } - else { + } else { //setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); } - } - else { + } else { throw new RestException(500, 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile); } @@ -1742,22 +1733,19 @@ class Setup extends DolibarrApi $resultcomment = 'FileIntegrityIsOkButFilesWereAdded'; //$outcurrentchecksum = $checksumget.' - '.$langs->trans("FileIntegrityIsOkButFilesWereAdded").''; $outcurrentchecksum = $checksumget; - } - else { + } else { $resultcode = 'ok'; $resultcomment = 'Success'; //$outcurrentchecksum = ''.$checksumget.''; $outcurrentchecksum = $checksumget; } - } - else { + } else { $resultcode = 'error'; $resultcomment = 'Error'; //$outcurrentchecksum = ''.$checksumget.''; $outcurrentchecksum = $checksumget; } - } - else { + } else { throw new RestException(404, 'No signature file known'); } diff --git a/htdocs/api/index.php b/htdocs/api/index.php index fca0e027081..0cc50b07302 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -202,13 +202,11 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ { //dol_syslog("Found API by index.php: classname=".$classname."Api for module ".$dir." into ".$dir_part.$file_searched); $listofapis[strtolower($classname.'Api')] = $classname.'Api'; - } - elseif (class_exists($classname)) + } elseif (class_exists($classname)) { //dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched); $listofapis[strtolower($classname)] = $classname; - } - else { + } else { dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING); } } diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 12f5fb1fbc7..c1afe7ba472 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -87,8 +87,7 @@ if ($action == 'edit') print ''; print '
'; -} -else { +} else { print ''; print ''; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index fc42f0b00d6..540de545baf 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -314,16 +314,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->asset->write) { print ''.$langs->trans("Modify").''."\n"; - } - else { + } else { print ''.$langs->trans('Modify').''."\n"; } if ($user->rights->asset->delete) { print ''.$langs->trans('Delete').''."\n"; - } - else { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 1570fe438ad..30f2a64bb0a 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -351,8 +351,7 @@ class Asset extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -395,28 +394,23 @@ class Asset extends CommonObject { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 6) + } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); @@ -469,8 +463,7 @@ class Asset extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index 2e275ae1e65..db2407a9376 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -154,14 +154,12 @@ class AssetType extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -221,14 +219,12 @@ class AssetType extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -$error; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -259,8 +255,7 @@ class AssetType extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -298,8 +293,7 @@ class AssetType extends CommonObject } return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -338,8 +332,7 @@ class AssetType extends CommonObject $i++; } } - } - else { + } else { print $this->db->error(); } return $assettypes; @@ -383,8 +376,7 @@ class AssetType extends CommonObject $assetstatic->fetch($obj->rowid); } $ret[$obj->rowid] = $assetstatic; - } - else $ret[$obj->rowid] = $obj->rowid; + } else $ret[$obj->rowid] = $obj->rowid; } } @@ -393,8 +385,7 @@ class AssetType extends CommonObject $this->asset = $ret; return $ret; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 9b5294605ba..d2890ea5b19 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -144,8 +144,7 @@ if ($object->id) $relativepathwithnofile = 'asset/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { accessforbidden('', 0, 1); } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index da2a4d80b27..0f6624f1254 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -253,8 +253,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; -} -else { +} else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -387,8 +386,7 @@ foreach ($object->fields as $key => $val) if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); - } - elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index f9931a927b4..a2c6bab3f90 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -107,8 +107,7 @@ if ($action == 'add' && $user->rights->asset->write) if (empty($object->label)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); - } - else { + } else { $sql = "SELECT label FROM ".MAIN_DB_PREFIX."asset_type WHERE label='".$db->escape($object->label)."'"; $result = $db->query($sql); if ($result) { @@ -128,13 +127,11 @@ if ($action == 'add' && $user->rights->asset->write) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } - } - else { + } else { $action = 'create'; } } @@ -160,8 +157,7 @@ if ($action == 'update' && $user->rights->asset->write) if ($ret >= 0 && !count($object->errors)) { setEventMessages($langs->trans("AssetsTypeModified"), null, 'mesgs'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -179,8 +175,7 @@ if ($action == 'confirm_delete' && $user->rights->asset->write) setEventMessages($langs->trans("AssetsTypeDeleted"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($langs->trans("AssetsTypeCanNotBeDeleted"), null, 'errors'); $action = ''; } @@ -312,8 +307,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') print ''; print ''; - } - else { + } else { dol_print_error($db); } } @@ -361,8 +355,7 @@ if ($action == 'create') print ''; - } - else // For external software + } else // For external software { // Accountancy_code_asset print ''; @@ -572,8 +565,7 @@ if ($rowid > 0) print ''; - } - else // For external software + } else // For external software { // Accountancy_code_asset print ''; diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index f77b50924e2..a70e6f8a04b 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -71,8 +71,7 @@ if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) try { dol_include_once($dirroot.$file.'.php'); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -109,13 +108,11 @@ if ($action == 'initbarcodeproducts') if ($resql) { setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs'); - } - else { + } else { $error++; dol_print_error($db); } - } - else { + } else { $sql = "SELECT rowid, ref, fk_product_type"; $sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " WHERE barcode IS NULL or barcode = ''"; @@ -148,8 +145,7 @@ if ($action == 'initbarcodeproducts') $i++; } - } - else { + } else { $error++; dol_print_error($db); } @@ -164,8 +160,7 @@ if ($action == 'initbarcodeproducts') { //$db->rollback(); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -216,8 +211,7 @@ if ($conf->societe->enabled) { $obj = $db->fetch_object($resql); $nbno = $obj->nb; - } - else dol_print_error($db); + } else dol_print_error($db); $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe"; $resql = $db->query($sql); @@ -225,8 +219,7 @@ if ($conf->societe->enabled) { $obj = $db->fetch_object($resql); $nbtotal = $obj->nb; - } - else dol_print_error($db); + } else dol_print_error($db); print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'
'."\n"; @@ -270,8 +263,7 @@ if ($conf->product->enabled || $conf->product->service) $i++; } - } - else dol_print_error($db); + } else dol_print_error($db); $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product"; $resql = $db->query($sql); @@ -279,8 +271,7 @@ if ($conf->product->enabled || $conf->product->service) { $obj = $db->fetch_object($resql); $nbtotal = $obj->nb; - } - else dol_print_error($db); + } else dol_print_error($db); print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'
'."\n"; @@ -290,8 +281,7 @@ if ($conf->product->enabled || $conf->product->service) $objproduct = new Product($db); print ''.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).' - '.$langs->trans("NextValue").': '.$modBarCodeProduct->getNextValue($objproduct).'
'; $disabled = 0; - } - else { + } else { $disabled = 1; $titleno = $langs->trans("NoBarcodeNumberingTemplateDefined"); print ''.$langs->trans("NoBarcodeNumberingTemplateDefined").' (
'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").')
'; diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 7c692998723..8c883e55e75 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -161,8 +161,7 @@ if ($action == 'builddoc') setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors'); setEventMessages($module->error, null, 'errors'); } - } - else { + } else { $error++; setEventMessages("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, null, 'errors'); } diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 0a649a380cf..1b6ff1fa021 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -51,8 +51,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -64,8 +63,7 @@ if (preg_match('/del_(.*)/', $action, $reg)) { Header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 10b14a29039..ab36caedba4 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -133,13 +133,11 @@ if ($action === 'downloadblockchain') { { $previoushash = $block_static->getPreviousHash(0, $obj->rowid); $firstid = $obj->rowid; - } - else { // If not data found for filter, we do not need previoushash neither firstid + } else { // If not data found for filter, we do not need previoushash neither firstid $previoushash = 'nodata'; $firstid = ''; } - } - else { + } else { $error++; setEventMessages($db->lasterror, null, 'errors'); } @@ -209,8 +207,7 @@ if ($action === 'downloadblockchain') { $statusofrecord = 'Valid'; if ($loweridinerror > 0) $statusofrecordnote = 'ValidButFoundAPreviousKO'; else $statusofrecordnote = ''; - } - else { + } else { $statusofrecord = 'KO'; $statusofrecordnote = 'LineCorruptedOrNotMatchingPreviousOne'; $loweridinerror = $obj->rowid; @@ -242,8 +239,7 @@ if ($action === 'downloadblockchain') { } exit; - } - else { + } else { setEventMessages($db->lasterror, null, 'errors'); } } @@ -259,8 +255,7 @@ $form = new Form($db); if (GETPOST('withtab', 'alpha')) { $title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'); -} -else { +} else { $title = $langs->trans("BrowseBlockedLog"); } @@ -274,8 +269,7 @@ if (!is_array($blocks)) if ($blocks == -2) { setEventMessages($langs->trans("TooManyRecordToScanRestrictFilters", $MAXLINES), null, 'errors'); - } - else { + } else { dol_print_error($block_static->db, $block_static->error, $block_static->errors); exit; } @@ -434,8 +428,7 @@ if (!empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) { // TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests // to find the $loweridinerror. -} -else { +} else { // This is version that optimize the memory (but will not report errors that are outside the filter range) $loweridinerror = 0; $checkresult = array(); @@ -503,8 +496,7 @@ if (is_array($blocks)) { if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut4'); else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8'); - } - else { + } else { print img_picto($langs->trans('OkCheckFingerprintValidity'), 'statut4'); } diff --git a/htdocs/blockedlog/ajax/authority.php b/htdocs/blockedlog/ajax/authority.php index 936ad5edb9c..64992bb33d6 100644 --- a/htdocs/blockedlog/ajax/authority.php +++ b/htdocs/blockedlog/ajax/authority.php @@ -52,18 +52,15 @@ if ($auth->fetch(0, $signature) <= 0) { if (!empty($hash)) { echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk'; -} -elseif (!empty($newblock)) { +} elseif (!empty($newblock)) { if ($auth->checkBlock($newblock)) { $auth->addBlock($newblock); $auth->update($user); echo 'blockadded'; - } - else { + } else { echo 'blockalreadyadded'; } -} -else { +} else { echo 'idontunderstandwhatihavetodo'; } diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index e2d588f1798..e83a71ea9b7 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -51,8 +51,7 @@ if ($block->fetch($id) > 0) { $objtoshow = $block->object_data; print formatObject($objtoshow, ''); -} -else { +} else { print 'Error, failed to get unalterable log with id '.$id; } @@ -94,17 +93,14 @@ function formatObject($objtoshow, $prefix) var_dump(@get_class($val)); var_dump($val);*/ $s .= dol_print_date($val, 'dayhour'); - } - else { + } else { $s .= $val; } $s .= ''; - } - elseif (is_array($val)) + } elseif (is_array($val)) { $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key); - } - elseif (is_object($val)) + } elseif (is_object($val)) { $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key); } diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 95106bba4d2..69967d503a1 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -128,8 +128,7 @@ class BlockedLogAuthority if (!in_array($block, $blocks)) { return true; - } - else { + } else { return false; } } @@ -179,13 +178,11 @@ class BlockedLogAuthority $this->tms = $this->db->jdate($obj->tms); return 1; - } - else { + } else { $this->error = $langs->trans("RecordNotFound"); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -230,13 +227,11 @@ class BlockedLogAuthority $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -272,8 +267,7 @@ class BlockedLogAuthority $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -311,8 +305,7 @@ class BlockedLogAuthority echo $block->signature.' '.$url.' '.$res.'
'; if ($res === 'blockalreadyadded' || $res === 'blockadded') { $block->setCertified(); - } - else { + } else { $this->error = $langs->trans('ImpossibleToContactAuthority ', $url); return -1; } diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 0226486116b..44311f1a580 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -201,8 +201,7 @@ class BlockedLog $object = new Facture($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } } @@ -212,98 +211,80 @@ class BlockedLog $object = new FactureFournisseur($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'payment') { + } elseif ($this->element === 'payment') { require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; $object = new Paiement($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'payment_supplier') { + } elseif ($this->element === 'payment_supplier') { require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; $object = new PaiementFourn($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'payment_donation') { + } elseif ($this->element === 'payment_donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; $object = new PaymentDonation($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'payment_various') { + } elseif ($this->element === 'payment_various') { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; $object = new PaymentVarious($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'don' || $this->element === 'donation') { + } elseif ($this->element === 'don' || $this->element === 'donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; $object = new Don($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'subscription') { + } elseif ($this->element === 'subscription') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $object = new Subscription($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->element === 'cashcontrol') { + } elseif ($this->element === 'cashcontrol') { require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; $object = new CashControl($this->db); if ($object->fetch($this->fk_object) > 0) { return $object->getNomUrl(1); - } - else { + } else { $this->error++; } - } - elseif ($this->action == 'MODULE_SET') + } elseif ($this->action == 'MODULE_SET') { return 'System to track events into unalterable logs were enabled'; - } - elseif ($this->action == 'MODULE_RESET') + } elseif ($this->action == 'MODULE_RESET') { if ($this->signature == '0000000000') { return 'System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.'; - } - else { + } else { return 'System to track events into unalterable logs were disabled. This is possible because no record were done yet.'; } } @@ -360,24 +341,19 @@ class BlockedLog if ($object->element == 'payment' || $object->element == 'payment_supplier') { $this->date_object = $object->datepaye; - } - elseif ($object->element == 'payment_salary') + } elseif ($object->element == 'payment_salary') { $this->date_object = $object->datev; - } - elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') + } elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') { $this->date_object = $object->datepaid ? $object->datepaid : $object->datep; - } - elseif ($object->element == 'subscription') + } elseif ($object->element == 'subscription') { $this->date_object = $object->dateh; - } - elseif ($object->element == 'cashcontrol') + } elseif ($object->element == 'cashcontrol') { $this->date_object = $object->date_creation; - } - else { + } else { $this->date_object = $object->date; } // ref @@ -476,13 +452,11 @@ class BlockedLog $this->object_data->invoiceline[$lineid]->{$keyline} = $valueline; } } - } - elseif (!is_object($value)) $this->object_data->{$key} = $value; + } elseif (!is_object($value)) $this->object_data->{$key} = $value; } if (!empty($object->newref)) $this->object_data->ref = $object->newref; - } - elseif ($this->element == 'invoice_supplier') + } elseif ($this->element == 'invoice_supplier') { foreach ($object as $key=>$value) { @@ -494,8 +468,7 @@ class BlockedLog } if (!empty($object->newref)) $this->object_data->ref = $object->newref; - } - elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various') + } elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various') { $datepayment = $object->datepaye ? $object->datepaye : ($object->datepaid ? $object->datepaid : $object->datep); $paymenttypeid = $object->paiementid ? $object->paiementid : ($object->paymenttype ? $object->paymenttype : $object->type_payment); @@ -527,18 +500,15 @@ class BlockedLog { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $tmpobject = new FactureFournisseur($this->db); - } - elseif ($this->element == 'payment') + } elseif ($this->element == 'payment') { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $tmpobject = new Facture($this->db); - } - elseif ($this->element == 'payment_donation') + } elseif ($this->element == 'payment_donation') { include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; $tmpobject = new Don($this->db); - } - elseif ($this->element == 'payment_various') + } elseif ($this->element == 'payment_various') { include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; $tmpobject = new PaymentVarious($this->db); @@ -571,8 +541,7 @@ class BlockedLog $this->errors[] = $this->error; dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR); return -1; - } - elseif ($result < 0) + } elseif ($result < 0) { $this->error = $tmpobject->error; $this->errors = $tmpobject->errors; @@ -619,14 +588,12 @@ class BlockedLog $this->object_data->amount = $totalamount; if (!empty($object->newref)) $this->object_data->ref = $object->newref; - } - elseif ($this->element == 'payment_salary') + } elseif ($this->element == 'payment_salary') { $this->object_data->amounts = array($object->amount); if (!empty($object->newref)) $this->object_data->ref = $object->newref; - } - elseif ($this->element == 'subscription') + } elseif ($this->element == 'subscription') { foreach ($object as $key=>$value) { @@ -638,8 +605,7 @@ class BlockedLog } if (!empty($object->newref)) $this->object_data->ref = $object->newref; - } - else // Generic case + } else // Generic case { foreach ($object as $key=>$value) { @@ -712,13 +678,11 @@ class BlockedLog $this->certified = ($obj->certified == 1); return 1; - } - else { + } else { $this->error = $langs->trans("RecordNotFound"); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -861,13 +825,11 @@ class BlockedLog $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -948,8 +910,7 @@ class BlockedLog { $previoussignature = $obj->signature; } - } - else { + } else { dol_print_error($this->db); exit; } @@ -989,16 +950,13 @@ class BlockedLog if ($element == 'all') { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity; - } - elseif ($element == 'not_certified') { + } elseif ($element == 'not_certified') { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity." AND certified = 0"; - } - elseif ($element == 'just_certified') { + } elseif ($element == 'just_certified') { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity." AND certified = 1"; - } - else { + } else { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity." AND element='".$element."' AND fk_object=".(int) $fk_object; } @@ -1091,8 +1049,7 @@ class BlockedLog { $obj = $this->db->fetch_object($res); if ($obj) $result = true; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index 68c09977cbd..a764a2cd5ae 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -45,8 +45,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -215,8 +214,7 @@ if ($object->id > 0) if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { print ''.$langs->trans("AddAction").''; - } - else { + } else { print ''.$langs->trans("AddAction").''; } } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f0f4a2f7b7d..5d072036851 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -176,8 +176,7 @@ if (empty($reshook)) { setEventMessages($bomline->error, $bomline->errors, 'errors'); $action = ''; - } - else { + } else { unset($_POST['idprod']); unset($_POST['qty']); unset($_POST['qty_frozen']); @@ -215,8 +214,7 @@ if (empty($reshook)) { setEventMessages($bomline->error, $bomline->errors, 'errors'); $action = ''; - } - else { + } else { unset($_POST['idprod']); unset($_POST['qty']); unset($_POST['qty_frozen']); @@ -618,8 +616,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoadd) { print ''.$langs->trans("Modify").''."\n"; - } - else { + } else { print ''.$langs->trans('Modify').''."\n"; } } @@ -632,8 +629,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (is_array($object->lines) && count($object->lines) > 0) { print ''.$langs->trans("Validate").''; - } - else { + } else { $langs->load("errors"); print ''.$langs->trans("Validate").''; } @@ -684,8 +680,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontodelete) { print ''.$langs->trans('Delete').''."\n"; - } - else { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 0a68c799171..45aedbe8ee2 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -141,8 +141,7 @@ if ($object->id) $relativepathwithnofile = 'bom/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { accessforbidden('', 0, 1); } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 2159564aeed..3ff2b2138b4 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -196,10 +196,8 @@ if (empty($reshook)) setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -211,8 +209,7 @@ if (empty($reshook)) if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } //var_dump($listofobjectthirdparties);exit; @@ -249,10 +246,8 @@ if (empty($reshook)) setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -264,8 +259,7 @@ if (empty($reshook)) if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } //var_dump($listofobjectthirdparties);exit; @@ -360,8 +354,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; -} -else { +} else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -495,8 +488,7 @@ foreach ($object->fields as $key => $val) if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); - } - elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 995f2c29f3a..f61df86fe69 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -164,8 +164,7 @@ class Boms extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve bom list'); } if (!count($obj_ret)) { @@ -228,8 +227,7 @@ class Boms extends DolibarrApi if ($this->bom->update($id, DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->bom->error); } } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index c3e7faede2c..8d6927c10cf 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -381,14 +381,11 @@ class BOM extends CommonObject foreach ($filter as $key => $value) { if ($key == 't.rowid') { $sqlwhere[] = $key.'='.$value; - } - elseif (strpos($key, 'date') !== false) { + } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 'customsql') { + } elseif ($key == 'customsql') { $sqlwhere[] = $value; - } - else { + } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -513,14 +510,12 @@ class BOM extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { print $langs->trans("Error")." ".$langs->trans("Error_BOM_ADDON_NotDefined"); return ""; } @@ -565,8 +560,7 @@ class BOM extends CommonObject { $this->fetch_product(); $num = $this->getNextNumRef($this->product); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -647,8 +641,7 @@ class BOM extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -784,8 +777,7 @@ class BOM extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -891,8 +883,7 @@ class BOM extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -914,8 +905,7 @@ class BOM extends CommonObject $this->error = $this->error; $this->errors = $this->errors; return $result; - } - else { + } else { $this->lines = $result; return $this->lines; } @@ -1207,14 +1197,11 @@ class BOMLine extends CommonObjectLine foreach ($filter as $key => $value) { if ($key == 't.rowid') { $sqlwhere[] = $key.'='.$value; - } - elseif (strpos($key, 'date') !== false) { + } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 'customsql') { + } elseif ($key == 'customsql') { $sqlwhere[] = $value; - } - else { + } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -1328,8 +1315,7 @@ class BOMLine extends CommonObjectLine $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -1422,8 +1408,7 @@ class BOMLine extends CommonObjectLine } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 1019911b89f..e8fbbac28d2 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -99,8 +99,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { // hide products in closed warehouse, but show products for internal transfer $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); - } - else { + } else { $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 60e4a1b9756..2d8501130dc 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -44,8 +44,7 @@ if ($action == 'setvalue') { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 10452ddbd05..0f8c3763228 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -41,8 +41,7 @@ function printDropdownBookmarksList() if (!empty($_SERVER["QUERY_STRING"])) { $url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''); - } - else { + } else { global $sortfield, $sortorder; $tmpurl = ''; // No urlencode, all param $url will be urlencoded later @@ -121,8 +120,7 @@ function printDropdownBookmarksList() } $searchForm .= ''; } - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 28ce42b6b70..69c7207a817 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -100,20 +100,17 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if (empty($backtopage)) $backtopage = ($urlsource ? $urlsource : ((!empty($url) && !preg_match('/^http/i', $url)) ? $url : DOL_URL_ROOT.'/bookmarks/list.php')); header("Location: ".$backtopage); exit; - } - else { + } else { if ($object->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->transnoentities("WarningBookmarkAlreadyExists"), null, 'warnings'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } $action = $invertedaction; } - } - else { + } else { $action = $invertedaction; } } @@ -262,8 +259,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { $liste = array(1=>$langs->trans("OpenANewWindow"), 0=>$langs->trans("ReplaceWindow")); print $form->selectarray('target', $liste, isset($_POST["target"]) ? $_POST["target"] : $object->target); - } - else { + } else { if ($object->target == 0) print $langs->trans("ReplaceWindow"); if ($object->target == 1) print $langs->trans("OpenANewWindow"); } @@ -273,15 +269,13 @@ if ($id > 0 && !preg_match('/^add/i', $action)) if ($action == 'edit' && $user->admin) { print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); - } - else { + } else { if ($object->fk_user > 0) { $fuser = new User($db); $fuser->fetch($object->fk_user); print $fuser->getNomUrl(1); - } - else { + } else { print $langs->trans("Public"); } } diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index 3a00d38eedc..5fab4496f6e 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -127,8 +127,7 @@ class Bookmark extends CommonObject $this->db->free($resql); return $this->id; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -173,15 +172,13 @@ class Bookmark extends CommonObject $this->id = $id; $this->db->commit(); return $id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); $this->db->rollback(); @@ -215,8 +212,7 @@ class Bookmark extends CommonObject if ($this->db->query($sql)) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -238,8 +234,7 @@ class Bookmark extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -315,8 +310,7 @@ class Bookmark extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index ad944d93208..a132b708c20 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -72,8 +72,7 @@ if ($action == 'delete') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -114,8 +113,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -228,8 +226,7 @@ while ($i < min($num, $limit)) } $tmpuser = $cacheOfUsers[$obj->fk_user]; print $tmpuser->getNomUrl(1); - } - else { + } else { print $langs->trans("Public"); } print "\n"; @@ -249,8 +246,7 @@ while ($i < min($num, $limit)) if ($user->rights->bookmark->supprimer) { print 'rowid.'">'.img_delete().''; - } - else { + } else { print " "; } print ""; diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 9542d0f2b48..dfd6e99a9ea 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -68,8 +68,7 @@ if (GETPOST('action', 'alpha') == 'set') { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -148,8 +147,7 @@ if (!empty($conf->stock->enabled)) print ''; diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index bfad032c0b5..799c95b6b5b 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -36,8 +36,7 @@ if (isset($_SESSION['serObjFacturation'])) { $obj_facturation = unserialize($_SESSION['serObjFacturation']); unset($_SESSION['serObjFacturation']); -} -else { +} else { // ... sinon, c'est une nouvelle vente $obj_facturation = new Facturation(); } @@ -71,8 +70,7 @@ if (in_array( )) { include $page.'.php'; -} -else { +} else { dol_print_error('', 'menu param '.$page.' is not inside allowed list'); } diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index f5de48aa3cb..cc71d1c20d8 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -129,8 +129,7 @@ class Auth $this->login($aLogin); $this->passwd($aPasswd); $ret = 0; - } - else { + } else { $ret = -1; } } diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index a3c4f7e0a48..2fc93b0d155 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -294,12 +294,10 @@ class Facturation if (!$aId) { return $this->id; - } - elseif ($aId == 'RESET') + } elseif ($aId == 'RESET') { $this->id = null; - } - else { + } else { $this->id = $aId; } } @@ -316,12 +314,10 @@ class Facturation if (is_null($aRef)) { return $this->ref; - } - elseif ($aRef == 'RESET') + } elseif ($aRef == 'RESET') { $this->ref = null; - } - else { + } else { $this->ref = $aRef; } } @@ -337,12 +333,10 @@ class Facturation if (is_null($aQte)) { return $this->qte; - } - elseif ($aQte == 'RESET') + } elseif ($aQte == 'RESET') { $this->qte = null; - } - else { + } else { $this->qte = $aQte; } } @@ -359,12 +353,10 @@ class Facturation if (is_null($aStock)) { return $this->stock; - } - elseif ($aStock == 'RESET') + } elseif ($aStock == 'RESET') { $this->stock = null; - } - else { + } else { $this->stock = $aStock; } } @@ -381,12 +373,10 @@ class Facturation if (is_null($aRemisePercent)) { return $this->remise_percent; - } - elseif ($aRemisePercent == 'RESET') + } elseif ($aRemisePercent == 'RESET') { $this->remise_percent = null; - } - else { + } else { $this->remise_percent = $aRemisePercent; } } @@ -577,12 +567,10 @@ class Facturation if (is_null($aTotalTtc)) { return $this->prix_total_ttc; - } - elseif ($aTotalTtc == 'RESET') + } elseif ($aTotalTtc == 'RESET') { $this->prix_total_ttc = null; - } - else { + } else { $this->prix_total_ttc = $aTotalTtc; } } diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index fd49ad952b4..48032c3e840 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -80,8 +80,7 @@ if (GETPOST('filtre', 'alpha')) { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } $tab_designations = $ret; @@ -114,8 +113,7 @@ if (GETPOST('filtre', 'alpha')) { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } $tab_designations = $ret; @@ -128,16 +126,13 @@ if ($nbr_enreg > 1) if ($nbr_enreg > $conf_taille_listes) { $top_liste_produits = '----- '.$conf_taille_listes.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----'; - } - else { + } else { $top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----'; } -} -elseif ($nbr_enreg == 1) +} elseif ($nbr_enreg == 1) { $top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound").' -----'; -} -else { +} else { $top_liste_produits = '----- '.$langs->transnoentitiesnoconv("NoProductFound").' -----'; } diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php index 0235c3dd788..99e1ed2f942 100644 --- a/htdocs/cashdesk/facturation_dhtml.php +++ b/htdocs/cashdesk/facturation_dhtml.php @@ -55,8 +55,7 @@ if (dol_strlen($search) >= 0) // If search criteria is on char length at least $sql .= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'"; if (!empty($conf->barcode->enabled)) $sql .= " OR p.barcode LIKE '".$db->escape($search)."%'"; $sql .= ")"; - } - else { + } else { $sql .= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'"; if (!empty($conf->barcode->enabled)) $sql .= " OR p.barcode LIKE '%".$db->escape($search)."%'"; $sql .= ")"; @@ -97,8 +96,7 @@ if (dol_strlen($search) >= 0) // If search criteria is on char length at least $resultat .= ''; print $resultat; - } - else { + } else { $langs->load("cashdesk"); print ''); -} -else { +} else { echo (''); } ?> diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index a7a938fd828..b2711479596 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -96,8 +96,7 @@ switch ($action) $encaisse = $obj_facturation->montantEncaisse(); $obj_facturation->montantRendu($encaisse - $total); - } - else { + } else { //$txtDatePaiement=$_POST['txtDatePaiement']; $datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']); $txtDatePaiement = dol_print_date($datePaiement, 'dayrfc'); @@ -251,15 +250,13 @@ switch ($action) } } } - } - else { + } else { setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } $id = $invoice->id; - } - else { + } else { $resultcreate = $invoice->create($user, 0, 0); if ($resultcreate > 0) { @@ -327,13 +324,11 @@ switch ($action) //print 'set paid';exit; } } - } - else { + } else { setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } - } - else { + } else { setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } @@ -344,8 +339,7 @@ switch ($action) { $db->commit(); $redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr - } - else { + } else { $db->rollback(); $redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr } diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index 017de5cd1e6..eb8af1ee44a 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -47,8 +47,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($db->lasterror(), null, 'errors'); } } @@ -60,8 +59,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($db->lasterror(), null, 'errors'); } } @@ -105,13 +103,11 @@ print '\n"; } print "
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1); print '
'.$langs->trans("AccountancyCodeAsset").''; print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1); print '
'.$langs->trans("AccountancyCodeAsset").'
'; if (empty($conf->productbatch->enabled)) { print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1); - } - else { + } else { if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity); } @@ -167,8 +165,7 @@ if (!empty($conf->stock->enabled)) { print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled); print ' ('.$langs->trans("Create").')'; - } - else { + } else { print ''.$langs->trans("StockDecreaseForPointOfSaleDisabled").''; } print '
'.$langs->trans("VAT").''.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("VAT").''.$langs->trans("NoVAT").'
'; if ($conf->use_javascript_ajax) { print ajax_constantonoff('CATEGORIE_RECURSIV_ADD'); -} -else { +} else { if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; - } - else { + } else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index a91a3df7827..8eb6c3d8eda 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -88,38 +88,31 @@ if ($action == 'add' && $user->rights->categorie->creer) { header("Location: ".$urlfrom); exit; - } - elseif ($idProdOrigin) + } elseif ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type); exit; - } - elseif ($idCompanyOrigin) + } elseif ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type); exit; - } - elseif ($idSupplierOrigin) + } elseif ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type); exit; - } - elseif ($idMemberOrigin) + } elseif ($idMemberOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type); exit; - } - elseif ($idContactOrigin) + } elseif ($idContactOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type); exit; - } - elseif ($idProjectOrigin) + } elseif ($idProjectOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type); exit; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); exit; } @@ -154,8 +147,7 @@ if ($action == 'add' && $user->rights->categorie->creer) { $action = 'confirmed'; $_POST["addcat"] = ''; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -171,38 +163,31 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr { header("Location: ".$urlfrom); exit; - } - elseif ($backtopage) + } elseif ($backtopage) { header("Location: ".$backtopage); exit; - } - elseif ($idProdOrigin) + } elseif ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idCompanyOrigin) + } elseif ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idSupplierOrigin) + } elseif ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idMemberOrigin) + } elseif ($idMemberOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idContactOrigin) + } elseif ($idContactOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idProjectOrigin) + } elseif ($idProjectOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 205e38f3e5e..1cbaf4cbe14 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -179,8 +179,7 @@ class Categories extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -243,8 +242,7 @@ class Categories extends DolibarrApi if ($this->category->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->category->error); } } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index d8f5ef4eeeb..b6255221fa3 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -316,12 +316,10 @@ class Categorie extends CommonObject if ($id > 0) { $sql .= " WHERE rowid = ".$id; - } - elseif (!empty($ref_ext)) + } elseif (!empty($ref_ext)) { $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; - } - else { + } else { $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; if (!is_null($type)) $sql .= " AND type = ".$this->db->escape($type); } @@ -360,12 +358,10 @@ class Categorie extends CommonObject if (!empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); return 1; - } - else { + } else { return 0; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -479,18 +475,15 @@ class Categorie extends CommonObject { $this->db->commit(); return $id; - } - else { + } else { $this->db->rollback(); return -3; } - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -567,8 +560,7 @@ class Categorie extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_print_error($this->db); return -1; @@ -653,8 +645,7 @@ class Categorie extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -713,8 +704,7 @@ class Categorie extends CommonObject } } } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -738,20 +728,17 @@ class Categorie extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $this->db->lasterrno(); return -3; - } - else { + } else { $this->error = $this->db->lasterror(); } return -1; @@ -802,13 +789,11 @@ class Categorie extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -859,16 +844,14 @@ class Categorie extends CommonObject if ($onlyids) { $objs[] = $rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]; - } - else { + } else { $obj = new $this->MAP_OBJ_CLASS[$type]($this->db); $obj->fetch($rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]); $objs[] = $obj; } } return $objs; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -993,8 +976,7 @@ class Categorie extends CommonObject } $i++; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1029,8 +1011,7 @@ class Categorie extends CommonObject $cats[] = $cat; } return $cats; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1062,8 +1043,7 @@ class Categorie extends CommonObject $this->motherof[$obj->id_son] = $obj->id_parent; } return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1099,18 +1079,15 @@ class Categorie extends CommonObject if (is_string($markafterid)) { $markafterid = explode(',', $markafterid); - } - elseif (is_numeric($markafterid)) + } elseif (is_numeric($markafterid)) { if ($markafterid > 0) { $markafterid = array($markafterid); - } - else { + } else { $markafterid = array(); } - } - elseif (!is_array($markafterid)) + } elseif (!is_array($markafterid)) { $markafterid = array(); } @@ -1146,8 +1123,7 @@ class Categorie extends CommonObject $this->cats[$obj->rowid]['ref_ext'] = $obj->ref_ext; $i++; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1291,8 +1267,7 @@ class Categorie extends CommonObject $cats[$rec['rowid']] = $cat; } return $cats; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1354,8 +1329,7 @@ class Categorie extends CommonObject } dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent." than category id=".$this->id, LOG_DEBUG); return 0; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1407,8 +1381,7 @@ class Categorie extends CommonObject $link = ''; $linkend = ''; $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; - } - else { + } else { $w[] = "".($addpicto ? img_object('', 'category') : '').$cat->label.""; } } @@ -1449,8 +1422,7 @@ class Categorie extends CommonObject } } return $parents; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1529,13 +1501,11 @@ class Categorie extends CommonObject $cats[] = $cat; } } - } - else { + } else { dol_print_error($this->db); return -1; } - } - else { + } else { $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type])." as ct, ".MAIN_DB_PREFIX."categorie as c"; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".(int) $id." AND c.type = ".$this->MAP_ID[$type]; @@ -1556,8 +1526,7 @@ class Categorie extends CommonObject $cats[] = $cat; } } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1623,8 +1592,7 @@ class Categorie extends CommonObject } return $cats; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -1849,8 +1817,7 @@ class Categorie extends CommonObject $sql2 .= " SET label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; $sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->label); $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; @@ -1861,8 +1828,7 @@ class Categorie extends CommonObject $this->error = $this->db->lasterror(); return -1; } - } - elseif (isset($this->multilangs["$key"])) + } elseif (isset($this->multilangs["$key"])) { if ($this->db->num_rows($result)) // si aucune ligne dans la base { @@ -1870,8 +1836,7 @@ class Categorie extends CommonObject $sql2 .= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; $sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->multilangs["$key"]["label"]); $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; @@ -1929,8 +1894,7 @@ class Categorie extends CommonObject $this->multilangs["$obj->lang"]["description"] = $obj->description; } return 1; - } - else { + } else { $this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql; return -1; } @@ -2022,8 +1986,7 @@ class Categorie extends CommonObject if (intval($searchCategory) == -2) { $searchCategorySqlList[] = " cp.fk_categorie IS NULL"; - } - elseif (intval($searchCategory) > 0) + } elseif (intval($searchCategory) > 0) { $searchCategorySqlList[] = " ".$rowIdName ." IN (SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type @@ -2034,8 +1997,7 @@ class Categorie extends CommonObject if (!empty($searchCategorySqlList)) { return " AND (".implode(' AND ', $searchCategorySqlList).")"; - } - else { + } else { return ""; } } diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index dfd8f01f381..53a343046b7 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -108,12 +108,10 @@ if ($action == 'update' && $user->rights->categorie->creer) { header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index d88e1a0ff8c..026ff2f24ac 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -134,8 +134,7 @@ if ($catname || $id > 0) print "\t
"; -} -else print ' '; +} else print ' '; //print ''; @@ -206,8 +205,7 @@ if ($nbofentries > 0) print ''; tree_recur($data, $data[0], 0); print ''; -} -else { +} else { print ''; print ''; print ''; print ''; print ''; -} -else { +} else { $categstatic = new Categorie($db); $fulltree = $categstatic->get_full_arbo($type, $object->id, 1); @@ -403,8 +391,7 @@ else { print ''; print ''; - } - else { + } else { print ''; print '\n"; } - } - else { + } else { print ''; } print "
'.img_picto_common('', 'treemenu/branchbottom.gif').''; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 7443bc5b532..ba09852d61b 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -179,8 +179,7 @@ if ($object->id) { print ''; print $langs->trans("AddPhoto").''; - } - else { + } else { print ''; print $langs->trans("AddPhoto").''; } @@ -230,8 +229,7 @@ if ($object->id) if ($obj['photo_vignette']) { $filename = $obj['photo_vignette']; - } - else { + } else { $filename = $obj['photo']; } @@ -278,8 +276,7 @@ if ($object->id) print '
'.$langs->trans("NoPhotoYet")."
"; } } -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index c3f87e404b7..ea36ce40edd 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -292,8 +292,7 @@ if ($action == 'edit') print ''; print ''; -} -elseif ($action != 'add') +} elseif ($action != 'add') { if ($cnt_trans) print '
'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 921a1f12061..6c2a71fe21e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -103,47 +103,40 @@ if ($id > 0 && $removeelem > 0) $tmpobject = new Product($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; - } - elseif ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) + } elseif ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'supplier'; - } - elseif ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) + } elseif ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'customer'; - } - elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) + } elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; - } - elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { + } elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'contact'; - } - elseif ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) + } elseif ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $tmpobject = new Account($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'account'; - } - elseif ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) + } elseif ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $tmpobject = new Project($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'project'; - } - elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) + } elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $tmpobject = new User($db); @@ -161,8 +154,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi { header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -179,13 +171,11 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' if ($result >= 0) { setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs'); - } - else { + } else { if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -327,14 +317,12 @@ $cats = $object->get_filles(); if ($cats < 0) { dol_print_error($db, $cats->error, $cats->errors); -} -elseif (count($cats) < 1) +} elseif (count($cats) < 1) { print '
'.$langs->trans("NoSubCat").'
'; print ''; @@ -445,8 +432,7 @@ if ($type == Categorie::TYPE_PRODUCT) if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); - } - else { + } else { // Form to add record into a category $showclassifyform = 1; if ($showclassifyform) @@ -508,8 +494,7 @@ if ($type == Categorie::TYPE_PRODUCT) print ''; print "\n"; } - } - else { + } else { print ''; } print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; @@ -526,8 +511,7 @@ if ($type == Categorie::TYPE_SUPPLIER) if ($socs < 0) { dol_print_error($db, $socs->error, $socs->errors); - } - else { + } else { print '
'; print ''; print ''; @@ -567,8 +551,7 @@ if ($type == Categorie::TYPE_SUPPLIER) print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; @@ -585,8 +568,7 @@ if ($type == Categorie::TYPE_CUSTOMER) if ($socs < 0) { dol_print_error($db, $socs->error, $socs->errors); - } - else { + } else { print ''; print ''; print ''; @@ -625,8 +607,7 @@ if ($type == Categorie::TYPE_CUSTOMER) print ''; print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -646,8 +627,7 @@ if ($type == Categorie::TYPE_MEMBER) if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); - } - else { + } else { print ''; print ''; print ''; @@ -688,8 +668,7 @@ if ($type == Categorie::TYPE_MEMBER) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -707,8 +686,7 @@ if ($type == Categorie::TYPE_CONTACT) if ($contacts < 0) { dol_print_error($db, $contacts->error, $contacts->errors); - } - else { + } else { print ''; print ''; print ''; @@ -750,8 +728,7 @@ if ($type == Categorie::TYPE_CONTACT) print ''; print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -771,8 +748,7 @@ if ($type == Categorie::TYPE_ACCOUNT) if ($accounts < 0) { dol_print_error($db, $accounts->error, $accounts->errors); - } - else { + } else { print ''; print ''; print ''; @@ -812,8 +788,7 @@ if ($type == Categorie::TYPE_ACCOUNT) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -833,8 +808,7 @@ if ($type == Categorie::TYPE_PROJECT) if ($objects < 0) { dol_print_error($db, $object->error, $object->errors); - } - else { + } else { print ''; print ''; print ''; @@ -875,8 +849,7 @@ if ($type == Categorie::TYPE_PROJECT) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -894,8 +867,7 @@ if ($type == Categorie::TYPE_USER) if ($users < 0) { dol_print_error($db, $object->error, $object->errors); - } - else { + } else { print ''; print ''; print ''; @@ -933,8 +905,7 @@ if ($type == Categorie::TYPE_USER) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -955,8 +926,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) if ($objects < 0) { dol_print_error($db, $object->error, $object->errors); - } - else { + } else { print ''; print ''; print ''; @@ -997,8 +967,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index f6344f4ebf0..0c457fb6f47 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -94,8 +94,7 @@ if ($action == 'add') $db->commit(); setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs'); $action = ''; - } - else { + } else { $db->rollback(); } @@ -128,12 +127,10 @@ if ($action == 'delete') header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website); exit; - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8a4018a5458..55cca00d7d7 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -172,8 +172,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes') if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($id > 0) { //$object->fetch($id); if (!empty($object->socpeopleassigned)) { @@ -241,8 +240,7 @@ if (empty($reshook) && $action == 'add') $error++; $donotclearsession = 1; $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - } - else { + } else { $object->type_code = GETPOST('actioncode', 'aZ09'); } @@ -260,13 +258,11 @@ if (empty($reshook) && $action == 'add') if (GETPOST('actioncode', 'aZ09') == 'AC_RDV' && $contact->getFullName($langs)) { $object->label = $langs->transnoentitiesnoconv("TaskRDVWith", $contact->getFullName($langs)); - } - else { + } else { if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code) { $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; - } - else { + } else { $cactioncomm->fetch($object->type_code); $object->label = $cactioncomm->label; } @@ -386,17 +382,14 @@ if (empty($reshook) && $action == 'add') { dol_syslog("Back to ".$backtopage.($moreparam ? (preg_match('/\?/', $backtopage) ? '&'.$moreparam : '?'.$moreparam) : '')); header("Location: ".$backtopage.($moreparam ? (preg_match('/\?/', $backtopage) ? '&'.$moreparam : '?'.$moreparam) : '')); - } - elseif ($idaction) + } elseif ($idaction) { header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.($moreparam ? '&'.$moreparam : '')); - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam ? '?'.$moreparam : '')); } exit; - } - else { + } else { // If error $db->rollback(); $langs->load("errors"); @@ -404,8 +397,7 @@ if (empty($reshook) && $action == 'add') setEventMessages($error, null, 'errors'); $action = 'create'; $donotclearsession = 1; } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; $donotclearsession = 1; @@ -482,8 +474,7 @@ if (empty($reshook) && $action == 'update') { if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']] = $val; } - } - else { + } else { $assignedtouser = (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0); if ($assignedtouser) $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first } @@ -510,8 +501,7 @@ if (empty($reshook) && $action == 'update') $error++; $donotclearsession = 1; $action = 'edit'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - } - else { + } else { $result = $cactioncomm->fetch(GETPOST('actioncode', 'aZ09')); } if (empty($object->userownerid)) @@ -599,8 +589,7 @@ if (empty($reshook) && $action == 'update') unset($_SESSION['assignedtouser']); $db->commit(); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -637,8 +626,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes { header("Location: index.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -746,8 +734,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { header("Location: ".$backtopage); exit; - } - else { + } else { $action = ''; } } @@ -969,8 +956,7 @@ if ($action == 'create') if ($assignedtouser) $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first $listofuserid[$user->id]['transparency'] = GETPOSTISSET('transparency') ?GETPOST('transparency', 'alpha') : 1; // 1 by default at first init $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -1022,8 +1008,7 @@ if ($action == 'create') $societe->fetch(GETPOST('socid', 'int')); print $societe->getNomUrl(1); print ''; - } - else { + } else { $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company @@ -1252,8 +1237,7 @@ if ($id > 0) if ($object->type_code != 'AC_OTH_AUTO') { $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ?GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto"); - } - else { + } else { print ''.$langs->trans("Action".$object->type_code); } print ''; @@ -1383,8 +1367,7 @@ if ($id > 0) } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -1507,8 +1490,7 @@ if ($id > 0) print ''; print ''; - } - else { + } else { print ''; print dolGetElementUrl($object->fk_element, $object->elementtype, 1); print ''; @@ -1547,8 +1529,7 @@ if ($id > 0) print ''; print ''; - } - else { + } else { dol_fiche_head($head, 'card', $langs->trans("Action"), -1, 'action'); @@ -1691,8 +1672,7 @@ if ($id > 0) } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -1778,8 +1758,7 @@ if ($id > 0) print '
'; } } - } - else { + } else { print ''.$langs->trans("None").''; } print ''; @@ -1836,8 +1815,7 @@ if ($id > 0) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { print '
'.$langs->trans("Modify").'
'; - } - else { + } else { print '
'.$langs->trans("Modify").'
'; } @@ -1845,8 +1823,7 @@ if ($id > 0) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { print '
'.$langs->trans("ToClone").'
'; - } - else { + } else { print '
'.$langs->trans("ToClone").'
'; } @@ -1854,8 +1831,7 @@ if ($id > 0) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { print '
'.$langs->trans("Delete").'
'; - } - else { + } else { print '
'.$langs->trans("Delete").'
'; } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2c21f311e5d..7c35b9979c7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -417,13 +417,11 @@ class ActionComm extends CommonObject { $this->type_id = $cactioncomm->id; $this->type_code = $cactioncomm->code; - } - elseif ($result == 0) + } elseif ($result == 0) { $this->error = 'Failed to get record with id '.$this->type_id.' code '.$this->type_code.' from dictionary "type of events"'; return -1; - } - else { + } else { $this->error = $cactioncomm->error; return -1; } @@ -577,13 +575,11 @@ class ActionComm extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -647,8 +643,7 @@ class ActionComm extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -762,8 +757,7 @@ class ActionComm extends CommonObject $this->fetchResources(); } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -808,8 +802,7 @@ class ActionComm extends CommonObject } return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -862,8 +855,7 @@ class ActionComm extends CommonObject } return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -945,13 +937,11 @@ class ActionComm extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -1097,14 +1087,12 @@ class ActionComm extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::update ".join(',', $this->errors), LOG_ERR); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -1163,8 +1151,7 @@ class ActionComm extends CommonObject } $db->free($resql); return $resarray; - } - else { + } else { return $db->lasterror(); } } @@ -1223,8 +1210,7 @@ class ActionComm extends CommonObject $this->db->free($resql); if (empty($load_state_board)) return $response; else return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1274,8 +1260,7 @@ class ActionComm extends CommonObject if (!empty($obj->fk_user_mod)) $this->date_modification = $this->db->jdate($obj->datem); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -1404,8 +1389,7 @@ class ActionComm extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); */ - } - else $linkclose .= ' class="'.$classname.'"'; + } else $linkclose .= ' class="'.$classname.'"'; $url = ''; if ($option == 'birthday') @@ -1435,8 +1419,7 @@ class ActionComm extends CommonObject $libelle = $label; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle = $labeltype; $libelleshort = ''; - } - else { + } else { $libelle = (empty($this->libelle) ? $label : $this->libelle.(($label && $label != $this->libelle) ? ' '.$label : '')); if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle = $labeltype; if ($maxlength < 0) $libelleshort = $this->ref; @@ -1677,8 +1660,7 @@ class ActionComm extends CommonObject { $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); - } - else { + } else { // use start date as fall-back to avoid import erros on empty end date $dateend = $datestart; } @@ -1734,8 +1716,7 @@ class ActionComm extends CommonObject { $eventarray = $hookmanager->resArray; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1768,15 +1749,13 @@ class ActionComm extends CommonObject $timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0); $timestampEnd = dol_stringtotime($obj->date_end." 12:00:00", 0); - } - elseif ($obj->halfday == 1) + } elseif ($obj->halfday == 1) { $event['fulldayevent'] = false; $timestampStart = dol_stringtotime($obj->date_start." 12:00:00", 0); $timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0); - } - else { + } else { $event['fulldayevent'] = true; $timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0); @@ -1810,8 +1789,7 @@ class ActionComm extends CommonObject { // 2 = leave wait for approval $event['summary'] = $title." - ".$obj->lastname." (wait for approval)"; - } - else { + } else { // 3 = leave approved $event['summary'] = $title." - ".$obj->lastname; } @@ -1836,8 +1814,7 @@ class ActionComm extends CommonObject $title = 'Dolibarr actions '.$mysoc->name.' - '.$more; $desc = $more; $desc .= ' ('.$mysoc->name.' - built by Dolibarr)'; - } - else { + } else { $title = 'Dolibarr actions '.$mysoc->name; $desc = $langs->transnoentities('ListOfActions'); $desc .= ' ('.$mysoc->name.' - built by Dolibarr)'; @@ -1861,8 +1838,7 @@ class ActionComm extends CommonObject dol_delete_file($outputfiletmp, 0, 1); $result = -1; } - } - else { + } else { dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index f987d551766..d3f4fb3f238 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -200,28 +200,23 @@ class ActionCommReminder extends CommonObject { if ($status == 1) return $langs->trans('Done'); elseif ($status == 0) return $langs->trans('ToDo'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Done'), 'statut4').' '.$langs->trans('Done'); elseif ($status == 0) return img_picto($langs->trans('ToDo'), 'statut5').' '.$langs->trans('ToDo'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Done'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('ToDo'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Done'), 'statut4').' '.$langs->trans('Done'); elseif ($status == 0) return img_picto($langs->trans('ToDo'), 'statut5').' '.$langs->trans('ToDo'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'), 'statut4'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'), 'statut5'); - } - elseif ($mode == 6) + } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'), 'statut4'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'), 'statut5'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index a8cb6b5de8f..20b88dd73d7 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -175,8 +175,7 @@ class AgendaEvents extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve Agenda Event list : '.$db->lasterror()); } if (!count($obj_ret)) { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index d3e4f93b5f7..147a6ff7ef0 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -104,13 +104,11 @@ class CActionComm $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -206,8 +204,7 @@ class CActionComm if ($idorcode == 'id') $this->liste_array = $repid; if ($idorcode == 'code') $this->liste_array = $repcode; return $this->liste_array; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 2b74c4793d9..b806dde94f9 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -179,15 +179,13 @@ class ICal $tmpkey = ''; $tmpvalue = ''; } - } - elseif (preg_match('/^ENCODING=QUOTED-PRINTABLE:/i', $value)) + } elseif (preg_match('/^ENCODING=QUOTED-PRINTABLE:/i', $value)) { if (preg_match('/=$/', $value)) { $tmpkey = $key; $tmpvalue = $tmpvalue.preg_replace('/=$/', "", $value); // We must wait to have next line to have complete message - } - else { + } else { $value = quotedPrintDecode(preg_replace('/^ENCODING=QUOTED-PRINTABLE:/i', '', $tmpvalue.$value)); } } //$value=quotedPrintDecode($tmpvalue.$value); @@ -235,8 +233,7 @@ class ICal if (stristr($key, "DTSTART;VALUE=DATE") || stristr($key, "DTEND;VALUE=DATE")) { list($key, $value) = array($key, $value); - } - else { + } else { list($key, $value) = $this->ical_dt_date($key, $value); } } @@ -375,8 +372,7 @@ class ICal { usort($temp, array(&$this, "ical_dtstart_compare")); return $temp; - } - else { + } else { return false; } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 3bd141ca964..fa4387b0861 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -215,8 +215,7 @@ if ($object->id > 0) } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -262,8 +261,7 @@ if ($object->id > 0) $permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7b45b3f6ceb..b83a374d1a3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -95,8 +95,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST('search_actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -459,13 +458,11 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } -} -else // If javascript off +} else // If javascript off { $newparam = $param; // newparam is for birthday links $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam); @@ -515,16 +512,14 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'"; else { if (is_array($actioncode)) { $sql .= " AND ca.code IN ('".implode("','", $actioncode)."')"; - } - else { + } else { $sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; } } @@ -548,8 +543,7 @@ if ($action == 'show_day') $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; $sql .= ')'; -} -else { +} else { // To limit array $sql .= " AND ("; $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before @@ -645,8 +639,7 @@ if ($resql) $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range - } - else { + } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar = $firstdaytoshow; if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar = ($lastdaytoshow - 1); @@ -667,16 +660,14 @@ if ($resql) $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } $i++; } -} -else { +} else { dol_print_error($db); } @@ -692,8 +683,7 @@ if ($showbirthday) { $sql .= ' AND MONTH(birthday) = '.$month; $sql .= ' AND DAY(birthday) = '.$day; - } - else { + } else { $sql .= ' AND MONTH(birthday) = '.$month; } $sql .= ' ORDER BY birthday'; @@ -735,12 +725,10 @@ if ($showbirthday) $eventarray[$daykey][] = $event; $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); $i++; } - } - else { + } else { dol_print_error($db); } } @@ -757,12 +745,10 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) { // Request only leaves for the current selected day $sql .= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin"; - } - elseif ($action == 'show_week') + } elseif ($action == 'show_week') { // TODO: Add filter to reduce database request - } - elseif ($action == 'show_month') + } elseif ($action == 'show_month') { // TODO: Add filter to reduce database request } @@ -795,8 +781,7 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) { // Show no symbol for leave with state "leave approved" $event->percentage = -1; - } - elseif ($obj->status == 2) + } elseif ($obj->status == 2) { // Show TO-DO symbol for leave with state "leave wait for approval" $event->percentage = 0; @@ -805,12 +790,10 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) if ($obj->halfday == 1) { $event->label = $obj->lastname.' ('.$langs->trans("Morning").')'; - } - elseif ($obj->halfday == -1) + } elseif ($obj->halfday == -1) { $event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')'; - } - else { + } else { $event->label = $obj->lastname; } @@ -823,9 +806,7 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $eventarray[$daykey][] = $event; $daykey += 60 * 60 * 24; - } - - while ($daykey <= $event->date_end_in_calendar); + } while ($daykey <= $event->date_end_in_calendar); $i++; } @@ -867,8 +848,7 @@ if (count($listofextcals)) { $datecurstart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1); $datecurend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day - } - elseif (is_array($icalevent['DTSTART']) && !empty($icalevent['DTSTART']['unixtime'])) + } elseif (is_array($icalevent['DTSTART']) && !empty($icalevent['DTSTART']['unixtime'])) { $datecurstart = $icalevent['DTSTART']['unixtime']; $datecurend = $icalevent['DTEND']['unixtime']; @@ -888,8 +868,7 @@ if (count($listofextcals)) } // datecurstart and datecurend are now GMT date //var_dump($datecurstart); var_dump($datecurend); exit; - } - else { + } else { // Not a recongized record dol_syslog("Found a not recognized repeatable record with unknown date start", LOG_ERR); continue; @@ -913,8 +892,7 @@ if (count($listofextcals)) { $newevent['DTSTART;VALUE=DATE'] = dol_print_date($datecurstart, '%Y%m%d'); $newevent['DTEND;VALUE=DATE'] = dol_print_date($datecurend + 1, '%Y%m%d'); - } - else { + } else { $newevent['DTSTART'] = $datecurstart; $newevent['DTEND'] = $datecurend; } @@ -932,13 +910,11 @@ if (count($listofextcals)) { $datecurstart = dol_time_plus_duree($datecurstart, $interval, 'w'); $datecurend = dol_time_plus_duree($datecurend, $interval, 'w'); - } - elseif ($icalevent['RRULE']['FREQ'] == 'MONTHLY') + } elseif ($icalevent['RRULE']['FREQ'] == 'MONTHLY') { $datecurstart = dol_time_plus_duree($datecurstart, $interval, 'm'); $datecurend = dol_time_plus_duree($datecurend, $interval, 'm'); - } - elseif ($icalevent['RRULE']['FREQ'] == 'YEARLY') + } elseif ($icalevent['RRULE']['FREQ'] == 'YEARLY') { $datecurstart = dol_time_plus_duree($datecurstart, $interval, 'y'); $datecurend = dol_time_plus_duree($datecurend, $interval, 'y'); @@ -975,8 +951,7 @@ if (count($listofextcals)) //print dol_print_date($dateend,'dayhour','gmt'); $event->fulldayevent = 1; $addevent = true; - } - elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch) + } elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch) { $datestart = $icalevent['DTSTART']; $dateend = $icalevent['DTEND']; @@ -987,8 +962,7 @@ if (count($listofextcals)) $addevent = true; //var_dump($offsettz); //var_dump(dol_print_date($datestart, 'dayhour', 'gmt')); - } - elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind) + } elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind) { $datestart = $icalevent['DTSTART']['unixtime']; $dateend = $icalevent['DTEND']['unixtime']; @@ -1050,8 +1024,7 @@ if (count($listofextcals)) //print 'x'.$datestart.'-'.$dateend;exit; //print 'x'.$datestart.'-'.$dateend;exit; // This record is out of visible range - } - else { + } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar = $firstdaytoshow; if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar = ($lastdaytoshow - 1); @@ -1071,8 +1044,7 @@ if (count($listofextcals)) $eventarray[$daykey][] = $event; $daykey += 60 * 60 * 24; $daykeygmt += 60 * 60 * 24; // Add one day if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); } } } @@ -1141,8 +1113,7 @@ if (empty($action) || $action == 'show_month') // View by month { $labelshort = array(0=>'SundayMin', 1=>'MondayMin', 2=>'TuesdayMin', 3=>'WednesdayMin', 4=>'ThursdayMin', 5=>'FridayMin', 6=>'SaturdayMin'); print $langs->trans($labelshort[$numdayinweek]); - } - else print $langs->trans("Day".$numdayinweek); + } else print $langs->trans("Day".$numdayinweek); print ' '."\n"; $i++; } @@ -1200,8 +1171,7 @@ if (empty($action) || $action == 'show_month') // View by month print ''; print ''; print ''; -} -elseif ($action == 'show_week') // View by week +} elseif ($action == 'show_week') // View by week { $newparam = $param; // newparam is for birthday links $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done @@ -1255,8 +1225,7 @@ elseif ($action == 'show_week') // View by week echo ''; echo ''; echo ''; -} -else // View by day +} else // View by day { $newparam = $param; // newparam is for birthday links $newparam = preg_replace('/action=show_month&?/i', '', $newparam); @@ -1330,8 +1299,7 @@ else // View by day show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1); print ''; - } - else { + } else { print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0); @@ -1452,8 +1420,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) if (!empty($cacheusers[$event->userownerid]->color)) $color = $cacheusers[$event->userownerid]->color; - } - elseif ($event->type_code == 'ICALEVENT') // Event come from external ical file + } elseif ($event->type_code == 'ICALEVENT') // Event come from external ical file { $numical++; if (!empty($event->icalname)) { @@ -1465,12 +1432,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); - } - elseif ($event->type_code == 'BIRTHDAY') + } elseif ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex = 2; $cssclass = 'family_birthday unmovable'; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); - } - else { + } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); @@ -1494,8 +1459,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (isset($colorindexused[$idusertouse])) { $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user - } - else { + } else { $colorindex = $nextindextouse; $colorindexused[$idusertouse] = $colorindex; if (!empty($theme_datacolor[$nextindextouse + 1])) $nextindextouse++; // Prepare to use next color @@ -1510,8 +1474,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'AC_OTH_AUTO') { $cssclass .= " unmovable"; - } - elseif ($event->type_code == 'ICALEVENT') + } elseif ($event->type_code == 'ICALEVENT') { $cssclass .= " unmovable"; } elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { @@ -1522,8 +1485,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { $cssclass .= " unmovable"; } - } - else { + } else { if ($user->rights->agenda->allactions->create || (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { @@ -1557,8 +1519,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { print 'border: 2px solid #'.$colortouse.';'; - } - else { + } else { print 'background: #'.$colortouse.';'; print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($colortouse, -3).'), to(#'.dol_color_minus($colortouse, -1).'));'; } @@ -1577,12 +1538,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'BIRTHDAY') // It's a birthday { print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); - } - elseif ($event->type_code == 'HOLIDAY') + } elseif ($event->type_code == 'HOLIDAY') { print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user'); - } - elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') + } elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') { // Picto if (empty($event->fulldayevent)) @@ -1625,8 +1584,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) $daterange .= dol_print_date($event->date_end_in_calendar, '%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user } - } - else { + } else { if ($showinfo) { print $langs->trans("EventOnFullDay")."
\n"; @@ -1681,8 +1639,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $thirdparty = new Societe($db); $thirdparty->fetch($thirdparty_id); $cachethirdparties[$thirdparty_id] = $thirdparty; - } - else $thirdparty = $cachethirdparties[$thirdparty_id]; + } else $thirdparty = $cachethirdparties[$thirdparty_id]; if (!empty($thirdparty->id)) $linerelatedto .= $thirdparty->getNomUrl(1, '', 0); } if (!empty($contact_id) && $contact_id > 0) @@ -1692,8 +1649,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $contact = new Contact($db); $contact->fetch($contact_id); $cachecontacts[$contact_id] = $contact; - } - else $contact = $cachecontacts[$contact_id]; + } else $contact = $cachecontacts[$contact_id]; if ($linerelatedto) $linerelatedto .= ' '; if (!empty($contact->id)) $linerelatedto .= $contact->getNomUrl(1, '', 0); } @@ -1730,8 +1686,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ''; print '
'."\n"; $i++; - } - else { + } else { print 'global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -282,16 +281,14 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'"; else { if (is_array($actioncode)) { $sql .= " AND c.code IN ('".implode("','", $actioncode)."')"; - } - else { + } else { $sql .= " AND c.code IN ('".implode("','", explode(',', $actioncode))."')"; } } @@ -413,8 +410,7 @@ if ($resql) if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -564,8 +560,7 @@ if ($resql) { $userstatic->fetch($obj->fk_user_action); print $userstatic->getNomUrl(-1); - } - else print ' '; + } else print ' '; print ''; } @@ -580,8 +575,7 @@ if ($resql) { if ($actioncomm->type_picto) { $imgpicto = img_picto('', $actioncomm->type_picto); - } - else { + } else { if ($actioncomm->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' '; elseif ($actioncomm->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' '; elseif ($actioncomm->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' '; @@ -649,8 +643,7 @@ if ($resql) $societestatic->email = $obj->socemail; print $societestatic->getNomUrl(1, '', 28); - } - else print ' '; + } else print ' '; print ''; } @@ -672,8 +665,7 @@ if ($resql) $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0); $contactList[] = $contact->getNomUrl(1, '', 0); } - } - else { + } else { // use cache $contactList[] = $contactListCache[$socpeopleassigned['id']]; } @@ -681,8 +673,7 @@ if ($resql) if (!empty($contactList)) { print implode(', ', $contactList); } - } - elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event + } elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event { $contactstatic->id = $obj->fk_contact; $contactstatic->email = $obj->email; @@ -693,8 +684,7 @@ if ($resql) $contactstatic->phone_perso = $obj->phone_perso; $contactstatic->country_id = $obj->country_id; print $contactstatic->getNomUrl(1, '', 0); - } - else { + } else { print " "; } print ''; @@ -744,8 +734,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index bc859ba6d2d..a769d709c4d 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -93,8 +93,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -328,8 +327,7 @@ if ($conf->use_javascript_ajax) if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -375,8 +373,7 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'"; else { @@ -402,8 +399,7 @@ if ($action == 'show_day') $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; $sql .= ')'; -} -else { +} else { // To limit array $sql .= " AND ("; $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, 1, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before @@ -485,8 +481,7 @@ if ($resql) $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; - } - else { + } else { $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; @@ -503,8 +498,7 @@ if ($resql) { // This record is out of visible range unset($event); - } - else { + } else { //print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'
'."\n"; $event->fetch_userassigned(); // This load $event->userassigned @@ -528,16 +522,14 @@ if ($resql) $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } $i++; } -} -else { +} else { dol_print_error($db); } @@ -799,8 +791,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s { $nummytasks++; $cssclass = 'family_mytasks'; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color = $event->type_color; - } - elseif ($event->type_code == 'ICALEVENT') + } elseif ($event->type_code == 'ICALEVENT') { $numical++; if (!empty($event->icalname)) @@ -813,12 +804,10 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $color = $event->icalcolor; $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other unsortable'); - } - elseif ($event->type_code == 'BIRTHDAY') + } elseif ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex = 2; $cssclass = 'family_birthday unsortable'; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); - } - else { + } else { $numother++; $cssclass = 'family_other'; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color = $event->type_color; } @@ -830,8 +819,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s if (isset($colorindexused[$idusertouse])) { $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user - } - else { + } else { $colorindex = $nextindextouse; $colorindexused[$idusertouse] = $colorindex; if (!empty($theme_datacolor[$nextindextouse + 1])) $nextindextouse++; // Prepare to use next color @@ -949,8 +937,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); } } - } - else { + } else { $busy = $event->transparency; $cases1[$h][$event->id]['busy'] = $busy; $cases2[$h][$event->id]['busy'] = $busy; @@ -1013,8 +1000,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); if ($output[0]['string']) $title1 .= ($title1 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; - } - elseif (count($cases1[$h]) > 1) + } elseif (count($cases1[$h]) > 1) { $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); $color1 = '222222'; @@ -1026,8 +1012,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); if ($output[0]['string']) $title2 .= ($title2 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; - } - elseif (count($cases2[$h]) > 1) + } elseif (count($cases2[$h]) > 1) { $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); $color2 = '222222'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index da5020cef39..dfb756dd227 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -94,8 +94,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST('search_actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -375,8 +374,7 @@ if ($conf->use_javascript_ajax) if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -434,16 +432,14 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'"; else { if (is_array($actioncode)) { $sql .= " AND ca.code IN ('".implode("','", $actioncode)."')"; - } - else { + } else { $sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; } } @@ -467,8 +463,7 @@ if ($action == 'show_day') $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; $sql .= ')'; -} -else { +} else { // To limit array $sql .= " AND ("; $sql .= " (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2))."'"; // Start 2 day before $firstdaytoshow @@ -551,8 +546,7 @@ if ($resql) $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; - } - else { + } else { $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; @@ -569,8 +563,7 @@ if ($resql) { // This record is out of visible range unset($event); - } - else { + } else { //print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'
'."\n"; $event->fetch_userassigned(); // This load $event->userassigned @@ -594,8 +587,7 @@ if ($resql) $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; @@ -603,8 +595,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -732,8 +723,7 @@ while ($currentdaytoshow < $lastdaytoshow) { $i++; } } - } - else dol_print_error($db); + } else dol_print_error($db); } //var_dump($usernamesid); foreach ($usernamesid as $id) @@ -981,8 +971,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if (!empty($cacheusers[$event->userownerid]->color)) $color = $cacheusers[$event->userownerid]->color; if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) $color = $event->type_color; - } - elseif ($event->type_code == 'ICALEVENT') + } elseif ($event->type_code == 'ICALEVENT') { $numical++; if (!empty($event->icalname)) @@ -995,12 +984,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color = $event->icalcolor; $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other unsortable'); - } - elseif ($event->type_code == 'BIRTHDAY') + } elseif ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex = 2; $cssclass = 'family_birthday unsortable'; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); - } - else { + } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); @@ -1026,8 +1013,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if (isset($colorindexused[$idusertouse])) { $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user - } - else { + } else { $colorindex = $nextindextouse; $colorindexused[$idusertouse] = $colorindex; if (!empty($theme_datacolor[$nextindextouse + 1])) $nextindextouse++; // Prepare to use next color @@ -1145,8 +1131,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); } } - } - else { + } else { $busy = $event->transparency; $cases1[$h][$event->id]['busy'] = $busy; $cases2[$h][$event->id]['busy'] = $busy; @@ -1210,8 +1195,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); if ($output[0]['string']) $title1 .= ($title1 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; - } - elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) + } elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) { $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); $color1 = '222222'; @@ -1223,8 +1207,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); if ($output[0]['string']) $title2 .= ($title2 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; - } - elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) + } elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) { $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); $color2 = '222222'; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index c3192f2286e..35c0f7a890e 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -186,8 +186,7 @@ if ($resql) print ''; print ''.dol_print_date(dol_filemtime($file), 'dayhour').''; print ''.dol_print_size(dol_filesize($file)).''; - } - else { + } else { print ' '; print ' '; print ' '; @@ -202,8 +201,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 17eae67eb2e..b3b11a95a36 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -330,8 +330,7 @@ if ($object->id > 0) if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none'); } print ""; @@ -348,8 +347,7 @@ if ($object->id > 0) if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_id, 'none'); } print ""; @@ -368,8 +366,7 @@ if ($object->id > 0) if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none'); } print ""; @@ -475,8 +472,7 @@ if ($object->id > 0) if ($action == 'editshipping') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); - } - else { + } else { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none'); } print ""; @@ -513,8 +509,7 @@ if ($object->id > 0) { $adh->ref = $adh->getFullName($langs); print $adh->getNomUrl(1); - } - else { + } else { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } print ''; @@ -541,8 +536,7 @@ if ($object->id > 0) if ($action == 'editlevel') { $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1); - } - else { + } else { print $object->getLibProspLevel(); } print ""; @@ -725,8 +719,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -810,8 +803,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -952,8 +944,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1012,8 +1003,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1082,13 +1072,11 @@ if ($object->id > 0) if ($objp->frequency && $objp->date_last_gen > 0) { print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').''; - } - else { + } else { if ($objp->dc > 0) { print ''.dol_print_date($db->jdate($objp->dc), 'day').''; - } - else { + } else { print '!!!'; } } @@ -1117,8 +1105,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1181,8 +1168,7 @@ if ($object->id > 0) if ($objp->df > 0) { print ''.dol_print_date($db->jdate($objp->df), 'day').''; - } - else { + } else { print '!!!'; } print ''; @@ -1207,8 +1193,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1273,8 +1258,7 @@ if ($object->id > 0) if (empty($user->rights->facture->creer)) { print '
'.$langs->trans("AddBill").'
'; - } - else { + } else { $langs->load("bills"); $langs->load("orders"); @@ -1284,8 +1268,7 @@ if ($object->id > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) print '
'.$langs->trans("CreateInvoiceForThisCustomer").'
'; else print '
'.$langs->trans("CreateInvoiceForThisCustomer").'
'; - } - else print '
'.$langs->trans("AddBill").'
'; + } else print '
'.$langs->trans("AddBill").'
'; } if ($object->client != 0 && $object->client != 2) print '
'.$langs->trans("AddBill").'
'; @@ -1300,8 +1283,7 @@ if ($object->id > 0) if ($user->rights->agenda->myactions->create) { print '
'.$langs->trans("AddAction").'
'; - } - else { + } else { print '
'.$langs->trans("AddAction").'
'; } } @@ -1325,8 +1307,7 @@ if ($object->id > 0) // List of done actions show_actions_done($conf, $langs, $db, $object); } -} -else { +} else { $langs->load("errors"); print $langs->trans('ErrorRecordNotFound'); } diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index da7248dbecb..d3075916367 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -170,8 +170,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 99eddda9cad..b542a110832 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -209,20 +209,17 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoProposal").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -295,20 +292,17 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoProposal").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -375,8 +369,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } $i++; @@ -385,21 +378,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoOrder").''; } print ""; print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -466,8 +456,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } $i++; @@ -476,13 +465,11 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoSupplierOrder").''; } print ""; @@ -563,8 +550,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) } $db->free($resql); - } - else { + } else { print ''.$langs->trans("None").''; } print ""; @@ -621,8 +607,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print ''; @@ -708,8 +693,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } @@ -795,8 +779,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''."\n"; @@ -807,16 +790,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total")."".price($total)." "; } print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } @@ -902,8 +883,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } print ''.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).''."\n"; @@ -914,16 +894,14 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total")."".price($total)." "; } print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index d16c3e9e7da..da24f7bcb4f 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -87,8 +87,7 @@ if (empty($template_id)) { if ($result < 0) { setEventMessages($advTarget->error, $advTarget->errors, 'errors'); -} -else { +} else { if (!empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1e7f5fa6385..fff6140a2aa 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -93,15 +93,13 @@ if (empty($reshook)) if (!GETPOST("clone_content", 'alpha') && !GETPOST("clone_receivers", 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { $result = $object->createFromClone($user, $object->id, GETPOST("clone_content", 'alpha'), GETPOST("clone_receivers", 'alpha')); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -118,13 +116,11 @@ if (empty($reshook)) setEventMessages('', null, 'warnings'); setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $action = ''; - } - elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + } elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action = ''; - } - else { + } else { $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); if ($object->statut == 0) @@ -232,8 +228,7 @@ if (empty($reshook)) $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); - } - else { + } else { $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'order'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'invoice'.$obj->source_id, 2); @@ -312,8 +307,7 @@ if (empty($reshook)) if (!$resql2) { dol_print_error($db); - } - else { + } else { //if cheack read is use then update prospect contact status if (strpos($message, '__CHECK_READ__') !== false) { @@ -345,8 +339,7 @@ if (empty($reshook)) } //test if CHECK READ change statut prospect contact - } - else { + } else { // Mail failed $nbko++; @@ -363,8 +356,7 @@ if (empty($reshook)) $i++; } - } - else { + } else { setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs'); } @@ -374,14 +366,12 @@ if (empty($reshook)) $statut = 2; // Status 'sent partially' (because at least one error) if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); - } - else { + } else { if ($nbok >= $num) { $statut = 3; // Send to everybody setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); - } - else { + } else { $statut = 2; // Status 'sent partially' (because not send to everybody) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); } @@ -394,8 +384,7 @@ if (empty($reshook)) { dol_print_error($db); } - } - else { + } else { dol_syslog($db->error()); dol_print_error($db); } @@ -462,8 +451,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs'); $action = ''; - } - else { + } else { setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); $action = 'test'; } @@ -600,8 +588,7 @@ if (empty($reshook)) setEventMessages($mesg, $mesgs, 'errors'); $action = "edit"; - } - else { + } else { $action = "edit"; } } @@ -615,8 +602,7 @@ if (empty($reshook)) setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -632,12 +618,10 @@ if (empty($reshook)) //setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { dol_print_error($db); } } @@ -660,13 +644,11 @@ if (empty($reshook)) $db->commit(); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } - } - else { + } else { dol_print_error($db); } } @@ -766,8 +748,7 @@ if ($action == 'create') print '
'; print ''; -} -else { +} else { if ($object->id > 0) { $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); @@ -823,8 +804,7 @@ else { setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"] = ''; - } - elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + } elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); @@ -837,8 +817,7 @@ else { setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... } $_GET["action"] = ''; - } - else { + } else { if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); @@ -920,8 +899,7 @@ else { if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - } - else { + } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } @@ -929,8 +907,7 @@ else { if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); - } - else { + } else { print $nbemail; } } @@ -977,8 +954,7 @@ else { if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { print ''.$langs->trans("EditWithEditor").''; - } - else { + } else { print ''.$langs->trans("EditWithTextEditor").''; } @@ -990,8 +966,7 @@ else { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("TestMailing").''; - } - else { + } else { print ''.$langs->trans("TestMailing").''; } @@ -1000,12 +975,10 @@ else { if ($object->nbemail <= 0) { print ''.$langs->trans("ValidMailing").''; - } - elseif (empty($user->rights->mailing->valider)) + } elseif (empty($user->rights->mailing->valider)) { print ''.$langs->trans("ValidMailing").''; - } - else { + } else { print ''.$langs->trans("ValidMailing").''; } } @@ -1015,12 +988,10 @@ else { if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { print ''.$langs->trans("SendMailing").''; - } - elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) + } elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("SendMailing").''; - } - else { + } else { print ''.$langs->trans("SendMailing").''; } } @@ -1035,8 +1006,7 @@ else { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("ResetMailing").''; - } - else { + } else { print ''.$langs->trans("ResetMailing").''; } } @@ -1046,8 +1016,7 @@ else { if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete)) { print ''.$langs->trans("DeleteMailing").''; - } - else { + } else { print ''.$langs->trans("DeleteMailing").''; } } @@ -1126,8 +1095,7 @@ else { print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name']; print '
'; } - } - else { + } else { print ''.$langs->trans("NoAttachedFiles").'
'; } print ''; @@ -1148,13 +1116,11 @@ else { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly); $doleditor->Create(); - } - else print dol_htmlentitiesbr($object->body); + } else print dol_htmlentitiesbr($object->body); print ''; dol_fiche_end(); - } - else { + } else { /* * Mailing en mode edition (CKeditor or HTML source) */ @@ -1200,8 +1166,7 @@ else { if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - } - else { + } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } @@ -1209,8 +1174,7 @@ else { if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); - } - else { + } else { print $nbemail; } } @@ -1284,8 +1248,7 @@ else { $out .= ' '; $out .= '
'; } - } - else { + } else { $out .= $langs->trans("NoAttachedFiles").'
'; } // Add link to add file @@ -1334,8 +1297,7 @@ else { print ''; print '
'; } - } - else { + } else { dol_print_error($db, $object->error); } } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e89a645cf20..27e0c2e5b0c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -160,8 +160,7 @@ if (GETPOST('exportcsv', 'int')) } exit; - } - else { + } else { dol_print_error($db); } exit; @@ -180,13 +179,11 @@ if ($action == 'delete') $obj->update_nb($id); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - } - else { + } else { header("Location: list.php"); exit; } - } - else { + } else { dol_print_error($db); } } @@ -290,8 +287,7 @@ if ($object->fetch($id) >= 0) if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - } - else { + } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } @@ -299,8 +295,7 @@ if ($object->fetch($id) >= 0) if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); - } - else { + } else { print $nbemail; } } @@ -400,8 +395,7 @@ if ($object->fetch($id) >= 0) { print '
'; print ''; - } - else { + } else { print '
'; } @@ -414,8 +408,7 @@ if ($object->fetch($id) >= 0) try { $nbofrecipient = $obj->getNbOfRecipients(''); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -424,8 +417,7 @@ if ($object->fetch($id) >= 0) if ($nbofrecipient >= 0) { print $nbofrecipient; - } - else { + } else { print $langs->trans("Error").' '.img_error($obj->error); } print '
'; @@ -435,8 +427,7 @@ if ($object->fetch($id) >= 0) { try { $filter = $obj->formFilter(); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -449,8 +440,7 @@ if ($object->fetch($id) >= 0) if ($allowaddtarget) { print ''; - } - else { + } else { print ''; //print $langs->trans("MailNoChangePossible"); print " "; @@ -624,29 +614,24 @@ if ($object->fetch($id) >= 0) if (empty($obj->source_id) || empty($obj->source_type)) { print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility - } - else { + } else { if ($obj->source_type == 'member') { $objectstaticmember->fetch($obj->source_id); print $objectstaticmember->getNomUrl(1); - } - elseif ($obj->source_type == 'user') + } elseif ($obj->source_type == 'user') { $objectstaticuser->fetch($obj->source_id); print $objectstaticuser->getNomUrl(1); - } - elseif ($obj->source_type == 'thirdparty') + } elseif ($obj->source_type == 'thirdparty') { $objectstaticcompany->fetch($obj->source_id); print $objectstaticcompany->getNomUrl(1); - } - elseif ($obj->source_type == 'contact') + } elseif ($obj->source_type == 'contact') { $objectstaticcontact->fetch($obj->source_id); print $objectstaticcontact->getNomUrl(1); - } - else { + } else { print $obj->source_url; } } @@ -666,8 +651,7 @@ if ($object->fetch($id) >= 0) print ''; print $object::libStatutDest($obj->statut, 2, ''); print ''; - } - else { + } else { // Date sent print ''.$obj->date_envoi.''; @@ -693,8 +677,7 @@ if ($object->fetch($id) >= 0) $i++; } - } - else { + } else { if ($object->statut < 2) { print ''; @@ -708,8 +691,7 @@ if ($object->fetch($id) >= 0) print '
'; $db->free($resql); - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index dd6f59e80b9..983ad374980 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -165,8 +165,7 @@ class AdvanceTargetingMailing extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -220,8 +219,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -282,8 +280,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -348,8 +345,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -407,8 +403,7 @@ class AdvanceTargetingMailing extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -448,8 +443,7 @@ class AdvanceTargetingMailing extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -683,8 +677,7 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['contact_no_email'])) { $tmpwhere .= "(t.email IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; - } - else { + } else { $tmpwhere .= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; } $sqlwhere[] = $tmpwhere; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index fd674945beb..e6f928d539f 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -314,8 +314,7 @@ class FormAdvTargetEmailing extends Form $i++; } } - } - else { + } else { dol_print_error($this->db); } @@ -399,8 +398,7 @@ class FormAdvTargetEmailing extends Form $i++; } } - } - else { + } else { dol_print_error($this->db); } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index a6c44c96a8d..1bb4864876c 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -144,16 +144,14 @@ class Mailing extends CommonObject if ($this->update($user) > 0) { $this->db->commit(); - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -184,8 +182,7 @@ class Mailing extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -250,13 +247,11 @@ class Mailing extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); return 1; - } - else { + } else { dol_syslog(get_class($this)."::fetch Erreur -1"); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::fetch Erreur -2"); return -2; } @@ -363,8 +358,7 @@ class Mailing extends CommonObject ); } } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -380,8 +374,7 @@ class Mailing extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -405,8 +398,7 @@ class Mailing extends CommonObject if ($this->db->query($sql)) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -429,8 +421,7 @@ class Mailing extends CommonObject if ($resql) { return $this->delete_targets(); - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -453,8 +444,7 @@ class Mailing extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return 0; } @@ -480,8 +470,7 @@ class Mailing extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -511,8 +500,7 @@ class Mailing extends CommonObject { $obj = $this->db->fetch_object($resql); if ($obj) return $obj->nb; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -572,8 +560,7 @@ class Mailing extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index edcb12d1bb2..cf439e4314b 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -129,8 +129,7 @@ if (is_resource($handle)) } $db->free($result); - } - else { + } else { dol_print_error($db); } print ''; @@ -190,14 +189,12 @@ if ($result) { print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print "
"; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index dcba1333b11..d22dd130507 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -130,8 +130,7 @@ if ($filteremail) if ($search_all) $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "m.rowid"; -} -else { +} else { $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.entity = ".$conf->entity; @@ -273,8 +272,7 @@ if ($resql) if ($filteremail) { print $email::libStatutDest($obj->sendstatut, 2); - } - else { + } else { print $email->LibStatut($obj->statut, 5); } print ''; @@ -295,8 +293,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 964663a976b..cd5d5c9ace9 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -152,8 +152,7 @@ if ($_socid > 0) } $db->free($resql); print ""; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b9ed10f18a..a2d27943c89 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -161,8 +161,7 @@ if (empty($reshook)) if (!GETPOST('socid', 3)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) { //Get difference between old and new delivery date and change lines according to difference @@ -268,9 +267,7 @@ if (empty($reshook)) if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); } - } - - elseif ($action == 'setdate' && $usercancreate) + } elseif ($action == 'setdate' && $usercancreate) { $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -284,14 +281,12 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $object->error); } - } - elseif ($action == 'setecheance' && $usercancreate) + } elseif ($action == 'setecheance' && $usercancreate) { $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); if ($result < 0) dol_print_error($db, $object->error); - } - elseif ($action == 'setdate_livraison' && $usercancreate) + } elseif ($action == 'setdate_livraison' && $usercancreate) { $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); if ($result < 0) @@ -600,13 +595,11 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit(); - } - else { + } else { $db->rollback(); $action = 'create'; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $action = 'create'; @@ -630,8 +623,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -657,8 +649,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -682,8 +673,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -705,8 +695,7 @@ if (empty($reshook)) { dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'OrderLine'; - } - elseif ($fromElement == 'propal') + } elseif ($fromElement == 'propal') { dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'PropaleLigne'; @@ -758,8 +747,7 @@ if (empty($reshook)) } else { $error++; } - } - else { + } else { $error++; } } @@ -798,9 +786,7 @@ if (empty($reshook)) $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - - elseif ($action == "setabsolutediscount" && $usercancreate) { + } elseif ($action == "setabsolutediscount" && $usercancreate) { if ($_POST["remise_id"]) { if ($object->id > 0) { $result = $object->insert_discount($_POST["remise_id"]); @@ -823,8 +809,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -956,8 +941,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } else { $pu_ttc = $priceforthequantityarray['unitprice']; } // Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST. @@ -981,8 +965,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } else { $pu_ttc = $priceforthequantityarray['unitprice']; } // Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST. @@ -1309,9 +1292,7 @@ if (empty($reshook)) } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha')) { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition exit(); - } - - elseif ($action == 'classin' && $usercancreate) { + } elseif ($action == 'classin' && $usercancreate) { // Set project $object->setProject(GETPOST('projectid', 'int')); } @@ -1329,13 +1310,9 @@ if (empty($reshook)) // Terms of payment elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); - } - - elseif ($action == 'setremisepercent' && $usercancreate) { + } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, $_POST['remise_percent']); - } - - elseif ($action == 'setremiseabsolue' && $usercancreate) { + } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); } @@ -1362,9 +1339,7 @@ if (empty($reshook)) // shipping method elseif ($action == 'setshippingmethod' && $usercancreate) { $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); - } - - elseif ($action == 'update_extras') { + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); // Fill array 'array_options' with data from update form @@ -1523,8 +1498,7 @@ if ($action == 'create') if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } } - } - else { + } else { if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } @@ -2298,8 +2272,7 @@ if ($action == 'create') if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -2466,8 +2439,7 @@ if ($action == 'create') if ($usercanvalidate) { print '
'.$langs->trans('Validate').''; - } - else print ''.$langs->trans('Validate').''; + } else print ''.$langs->trans('Validate').''; } // Create event /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. @@ -2542,8 +2514,7 @@ if ($action == 'create') if ($usercanclose) { print 'socid.'">'.$langs->trans("ClassifyBilled").''; - } - else { + } else { print ''.$langs->trans("ClassifyBilled").''; } } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 563e71d79d3..8efc4aa5c19 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -220,8 +220,7 @@ class Proposals extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -456,8 +455,7 @@ class Proposals extends DolibarrApi $updateRes = $this->propal->deleteline($lineid); if ($updateRes > 0) { return $this->get($id); - } - else { + } else { throw new RestException(405, $this->propal->error); } } @@ -587,8 +585,7 @@ class Proposals extends DolibarrApi if ($this->propal->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->propal->error); } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0827ddd64c7..5a8ddc31982 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -390,8 +390,7 @@ class Propal extends CommonObject if ($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) { $price = $prod->multiprices[$this->thirdparty->price_level]; - } - else { + } else { $price = $prod->price; } @@ -472,19 +471,16 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $line->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -557,8 +553,7 @@ class Propal extends CommonObject if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -710,20 +705,17 @@ class Propal extends CommonObject { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -2; } - } - else { + } else { dol_syslog(get_class($this)."::addline status of proposal must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -909,15 +901,13 @@ class Propal extends CommonObject $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::updateline Erreur -2 Propal en mode incompatible pour cette action"); return -2; } @@ -949,13 +939,11 @@ class Propal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -2; } @@ -1129,8 +1117,7 @@ class Propal extends CommonObject $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1157,8 +1144,7 @@ class Propal extends CommonObject if (!is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API { // Convert into object this->lines[$i]. $line = (object) $this->lines[$i]; - } - else { + } else { $line = $this->lines[$i]; } // Reset fk_parent_line for line that are not child lines or special product @@ -1254,14 +1240,12 @@ class Propal extends CommonObject if ($result < 0) { $error++; } // End call triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -1271,13 +1255,11 @@ class Propal extends CommonObject $this->db->commit(); dol_syslog(get_class($this)."::create done id=".$this->id); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1357,8 +1339,7 @@ class Propal extends CommonObject $object->ref_client = ''; // TODO Change product price if multi-prices - } - else { + } else { $objsoc->fetch($object->socid); } @@ -1426,8 +1407,7 @@ class Propal extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1481,8 +1461,7 @@ class Propal extends CommonObject if ($ref) { $sql .= " WHERE p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid $sql .= " AND p.ref='".$this->db->escape($ref)."'"; - } - else $sql .= " WHERE p.rowid=".$rowid; + } else $sql .= " WHERE p.rowid=".$rowid; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1592,8 +1571,7 @@ class Propal extends CommonObject $this->error = "Record Not Found"; return 0; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1687,8 +1665,7 @@ class Propal extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1816,8 +1793,7 @@ class Propal extends CommonObject $this->db->free($result); return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } @@ -1865,8 +1841,7 @@ class Propal extends CommonObject if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $num = $this->getNextNumRef($soc); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -1939,8 +1914,7 @@ class Propal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2002,8 +1976,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2063,8 +2036,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2124,8 +2096,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2186,8 +2157,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2196,8 +2166,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2257,8 +2226,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2267,8 +2235,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2324,8 +2291,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2334,8 +2300,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -1; } } @@ -2392,8 +2357,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2459,8 +2423,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2526,8 +2489,7 @@ class Propal extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -2620,8 +2582,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->statut = $this->oldcopy->statut; $this->date_cloture = $this->oldcopy->date_cloture; $this->note_private = $this->oldcopy->note_private; @@ -2629,8 +2590,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -2679,8 +2639,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2745,8 +2704,7 @@ class Propal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2812,12 +2770,10 @@ class Propal extends CommonObject if ($shortlist == 1) { $ga[$obj->propalid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->propalid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->propalid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -2827,8 +2783,7 @@ class Propal extends CommonObject } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2921,12 +2876,10 @@ class Propal extends CommonObject } } return $ga; - } - else { + } else { return -1; } - } - else return $ga; + } else return $ga; } /** @@ -3023,26 +2976,22 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG); $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -1; } @@ -3096,8 +3045,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3106,8 +3054,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -3166,8 +3113,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3176,8 +3122,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -3234,8 +3179,7 @@ class Propal extends CommonObject } } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3370,8 +3314,7 @@ class Propal extends CommonObject } return $response; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3449,8 +3392,7 @@ class Propal extends CommonObject $line->total_ttc = 60; $line->total_tva = 10; $line->remise_percent = 50; - } - else { + } else { $line->total_ht = 100; $line->total_ttc = 120; $line->total_tva = 20; @@ -3509,8 +3451,7 @@ class Propal extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -3560,14 +3501,12 @@ class Propal extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; //dol_print_error($db,"Propale::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Proposal")); return ""; @@ -3615,14 +3554,11 @@ class Propal extends CommonObject if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; - } - elseif ($option == 'compta') { // deprecated + } elseif ($option == 'compta') { // deprecated $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; - } - elseif ($option == 'expedition') { + } elseif ($option == 'expedition') { $url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id.$get_params; - } - elseif ($option == 'document') { + } elseif ($option == 'document') { $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id.$get_params; } @@ -3970,12 +3906,10 @@ class PropaleLigne extends CommonObjectLine $this->db->free($result); return 1; - } - else { + } else { return 0; } - } - else { + } else { return -1; } } @@ -4024,8 +3958,7 @@ class PropaleLigne extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4112,8 +4045,7 @@ class PropaleLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -4165,8 +4097,7 @@ class PropaleLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -4213,8 +4144,7 @@ class PropaleLigne extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4291,8 +4221,7 @@ class PropaleLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -4325,8 +4254,7 @@ class PropaleLigne extends CommonObjectLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index ac6f500cce2..da23b4fc2bc 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -55,8 +55,7 @@ if ($id > 0 || !empty($ref)) $langs->load("errors"); setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); $error++; - } - elseif ($ret < 0) + } elseif ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -65,8 +64,7 @@ if ($id > 0 || !empty($ref)) if (!$error) { $object->fetch_thirdparty(); -} -else { +} else { header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); exit; } @@ -88,14 +86,12 @@ if ($action == 'addcontact' && $user->rights->propale->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -119,8 +115,7 @@ elseif ($action == 'deletecontact' && $user->rights->propale->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index f9d89ca981d..70c67566091 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -179,8 +179,7 @@ if ($object->id > 0) $permtoedit = $user->rights->propal->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index d456a507f19..9e138c52cbe 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -163,8 +163,7 @@ if ($resql) //print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.''; print ''.$langs->trans("Total").''.$total.''; print "
"; -} -else { +} else { dol_print_error($db); } @@ -219,8 +218,7 @@ if (!empty($conf->propal->enabled)) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } @@ -309,8 +307,7 @@ if ($resql) } print ""; print "
"; -} -else dol_print_error($db); +} else dol_print_error($db); /* @@ -393,16 +390,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total")."".price($total)." "; } print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 9c31bd72bf7..6710ac56b58 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -414,8 +414,7 @@ if ($resql) $soc->fetch($socid); $title = $langs->trans('ListOfProposals').' - '.$soc->name; if (empty($search_societe)) $search_societe = $soc->name; - } - else { + } else { $title = $langs->trans('ListOfProposals'); } @@ -1027,8 +1026,7 @@ if ($resql) { print ''.dol_print_date($db->jdate($obj->dfv), 'day'); print ''; - } - else { + } else { print ' '; } if (!$i) $totalarray['nbfield']++; @@ -1040,8 +1038,7 @@ if ($resql) { print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); print ''; - } - else { + } else { print ' '; } if (!$i) $totalarray['nbfield']++; @@ -1166,8 +1163,7 @@ if ($resql) if ($nbofsalesrepresentative > 3) // We print only number { print $nbofsalesrepresentative; - } - elseif ($nbofsalesrepresentative > 0) + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; @@ -1189,8 +1185,7 @@ if ($resql) } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } - else { + } else { print ' '; } print ''; @@ -1275,8 +1270,7 @@ if ($resql) $delallowed = $user->rights->propal->creer; print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index c4f92d36b6a..00a79f3c1be 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -112,8 +112,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenamenb = $dir.'/proposalsnbinyear-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$year.'.png'; } @@ -151,8 +150,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenameamount = $dir.'/proposalsamountinyear-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$year.'.png'; } @@ -190,8 +188,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -344,8 +341,7 @@ print '
'; // Show graphs print '
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 386e27f0ec3..b49f334dadd 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -223,8 +223,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) } print "

"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php index 2edc331d71e..e393f5fce56 100644 --- a/htdocs/comm/prospect/recap-prospect.php +++ b/htdocs/comm/prospect/recap-prospect.php @@ -83,8 +83,7 @@ if ($socid > 0) print $langs->trans("FeatureNotYetAvailable"); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index 170eb5b247a..284c248f1f0 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -83,8 +83,7 @@ if ($socid > 0) print $langs->trans("FeatureNotYetAvailable"); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index a735cd07028..a7517c9cb60 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -70,13 +70,11 @@ if (GETPOST('action', 'aZ09') == 'setremise') { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: remise.php?id=".$_GET["id"]); exit; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -250,14 +248,12 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } $db->free($resql); print ""; - } - else { + } else { dol_print_error($db); } } @@ -307,14 +303,12 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } $db->free($resql); print ""; - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 62b38f9e390..ffd4c1738c0 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -105,8 +105,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') { $newdiscount1->description = $discount->description; $newdiscount2->description = $discount->description; - } - else { + } else { $newdiscount1->description = $discount->description.' (1)'; $newdiscount2->description = $discount->description.' (2)'; } @@ -149,8 +148,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') $db->commit(); header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id.($backtopage ? '&backtopage='.urlencode($backtopage) : '')); // To avoid pb whith back exit; - } - else { + } else { $db->rollback(); } } @@ -187,19 +185,16 @@ if ($action == 'setremise' && $user->rights->societe->creer) { header("Location: ".$backtopage.'&discountid='.$discountid); exit; - } - else { + } else { header("Location: remx.php?id=".$id); exit; } - } - else { + } else { $error++; setEventMessages($soc->error, $soc->errors, 'errors'); } } - } - else { + } else { setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("AmountHT")), null, 'errors'); } } @@ -219,8 +214,7 @@ if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' $db->commit(); header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back exit; - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } @@ -294,8 +288,7 @@ if ($socid > 0) $obj = $db->fetch_object($resql); $remise_all += $obj->amount; if ($obj->fk_user == $user->id) $remise_user += $obj->amount; - } - else { + } else { dol_print_error($db); } @@ -325,8 +318,7 @@ if ($socid > 0) $obj = $db->fetch_object($resql); $remise_all += $obj->amount; if ($obj->fk_user == $user->id) $remise_user += $obj->amount; - } - else { + } else { dol_print_error($db); } @@ -481,8 +473,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -490,8 +481,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -499,8 +489,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -526,8 +515,7 @@ if ($socid > 0) print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; - } - else print ' '; + } else print ' '; print ''; if ($_GET["action"] == 'split' && GETPOST('remid') == $obj->rowid) @@ -537,8 +525,7 @@ if ($socid > 0) } $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -559,8 +546,7 @@ if ($socid > 0) $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0); } - } - else { + } else { dol_print_error($db); } } @@ -635,8 +621,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -644,8 +629,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -653,8 +637,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(EXCESS PAID\)/', $langs->trans("ExcessPaid"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -680,8 +663,7 @@ if ($socid > 0) print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; - } - else print ' '; + } else print ' '; print ''; if ($_GET["action"] == 'split' && GETPOST('remid') == $obj->rowid) @@ -691,8 +673,7 @@ if ($socid > 0) } $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -713,8 +694,7 @@ if ($socid > 0) $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); } - } - else { + } else { dol_print_error($db); } @@ -843,8 +823,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -852,8 +831,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -861,8 +839,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("Invoice"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -891,8 +868,7 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -900,8 +876,7 @@ if ($socid > 0) print ""; print '
'; - } - else { + } else { dol_print_error($db); } } @@ -1018,8 +993,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -1027,8 +1001,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -1036,8 +1009,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(EXCESS PAID\)/', $langs->trans("Invoice"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -1065,8 +1037,7 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -1074,8 +1045,7 @@ if ($socid > 0) print ""; print '
'; - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 2dfb0b67c6e..a8544c94b70 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -154,8 +154,7 @@ if (empty($reshook)) if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { // Because createFromClone modifies the object, we must clone it so that we can restore it later @@ -166,8 +165,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $object = $orig; $action = ''; @@ -185,8 +183,7 @@ if (empty($reshook)) if ($result > 0) { setEventMessages($langs->trans('OrderReopened', $object->ref), null); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -200,8 +197,7 @@ if (empty($reshook)) { header('Location: list.php?restore_lastsearch_values=1'); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -230,8 +226,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -497,17 +492,14 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'classifybilled' && $usercancreate) + } elseif ($action == 'classifybilled' && $usercancreate) { $ret = $object->classifyBilled($user); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - elseif ($action == 'classifyunbilled' && $usercancreate) + } elseif ($action == 'classifyunbilled' && $usercancreate) { $ret = $object->classifyUnBilled(); if ($ret < 0) { @@ -522,17 +514,13 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setremise' && $usercancreate) { + } elseif ($action == 'setremise' && $usercancreate) { $result = $object->set_remise($user, GETPOST('remise')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setabsolutediscount' && $usercancreate) { + } elseif ($action == 'setabsolutediscount' && $usercancreate) { if (GETPOST('remise_id')) { if ($object->id > 0) { $object->insert_discount(GETPOST('remise_id')); @@ -540,9 +528,7 @@ if (empty($reshook)) dol_print_error($db, $object->error); } } - } - - elseif ($action == 'setdate' && $usercancreate) { + } elseif ($action == 'setdate' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year')); @@ -550,9 +536,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setdate_livraison' && $usercancreate) { + } elseif ($action == 'setdate_livraison' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); @@ -560,9 +544,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setmode' && $usercancreate) { + } elseif ($action == 'setmode' && $usercancreate) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); @@ -576,21 +558,15 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); - } - - elseif ($action == 'setavailability' && $usercancreate) { + } elseif ($action == 'setavailability' && $usercancreate) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - } - - elseif ($action == 'setdemandreason' && $usercancreate) { + } elseif ($action == 'setdemandreason' && $usercancreate) { $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - } - - elseif ($action == 'setconditions' && $usercancreate) { + } elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); if ($result < 0) { dol_print_error($db, $object->error); @@ -643,13 +619,9 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setremisepercent' && $usercancreate) { + } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise($user, GETPOST('remise_percent')); - } - - elseif ($action == 'setremiseabsolue' && $usercancreate) { + } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); } @@ -669,8 +641,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -718,8 +689,7 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } - else { + } else { setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error++; } @@ -787,8 +757,7 @@ if (empty($reshook)) $tva_npr = $prodcustprice->lines[0]->recuperableonly; if (empty($tva_tx)) $tva_npr = 0; } - } - else { + } else { setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } } @@ -808,8 +777,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } else { $pu_ttc = $priceforthequantityarray['unitprice']; } // Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST. @@ -832,8 +800,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } else { $pu_ttc = $priceforthequantityarray['unitprice']; } // Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST. @@ -1146,9 +1113,7 @@ if (empty($reshook)) } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition exit(); - } - - elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) + } elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse'); @@ -1156,8 +1121,7 @@ if (empty($reshook)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1192,8 +1156,7 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1207,8 +1170,7 @@ if (empty($reshook)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1245,16 +1207,12 @@ if (empty($reshook)) } } } - } - - elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) { + } elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) { $result = $object->cloture($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) + } elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse'); @@ -1262,8 +1220,7 @@ if (empty($reshook)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1334,8 +1291,7 @@ if (empty($reshook)) { dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'OrderLine'; - } - elseif ($fromElement == 'propal') + } elseif ($fromElement == 'propal') { dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'PropaleLigne'; @@ -1387,8 +1343,7 @@ if (empty($reshook)) } else { $error++; } - } - else { + } else { $error++; } } @@ -1518,12 +1473,10 @@ if ($action == 'create' && $usercancreate) // For compatibility if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; - } - elseif ($element == 'propal') { + } elseif ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; - } - elseif ($element == 'contract') { + } elseif ($element == 'contract') { $element = $subelement = 'contrat'; } @@ -1569,8 +1522,7 @@ if ($action == 'create' && $usercancreate) // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } - } - else { + } else { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; $fk_account = $soc->fk_account; @@ -1941,8 +1893,7 @@ if ($action == 'create' && $usercancreate) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1972,8 +1923,7 @@ if ($action == 'create' && $usercancreate) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -2013,8 +1963,7 @@ if ($action == 'create' && $usercancreate) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -2368,8 +2317,7 @@ if ($action == 'create' && $usercancreate) if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 2ba223b3866..cc7db3db852 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -223,8 +223,7 @@ class Orders extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -569,8 +568,7 @@ class Orders extends DolibarrApi if ($this->commande->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->commande->error); } } @@ -698,7 +696,7 @@ class Orders extends DolibarrApi $result = $this->commande->set_reopen(DolibarrApiAccess::$user); if ($result < 0) { throw new RestException(405, $this->commande->error); - }elseif ($result == 0) { + } elseif ($result == 0) { throw new RestException(304); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3f86ce9de5b..b4abfee0c03 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -406,14 +406,12 @@ class Commande extends CommonOrder if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_NotDefined"); return ""; } @@ -466,8 +464,7 @@ class Commande extends CommonOrder if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $num = $this->getNextNumRef($soc); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -578,8 +575,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -664,8 +660,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -706,8 +701,7 @@ class Commande extends CommonOrder $result = $this->call_trigger('ORDER_REOPEN', $user); if ($result < 0) $error++; // End call triggers - } - else { + } else { $error++; $this->error = $this->db->lasterror(); dol_print_error($this->db); @@ -720,8 +714,7 @@ class Commande extends CommonOrder $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::set_reopen ".$errmsg, LOG_ERR); @@ -776,13 +769,11 @@ class Commande extends CommonOrder $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -852,8 +843,7 @@ class Commande extends CommonOrder $this->statut = self::STATUS_CANCELED; $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR); @@ -862,8 +852,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -1089,8 +1078,7 @@ class Commande extends CommonOrder $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1136,8 +1124,7 @@ class Commande extends CommonOrder //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } - } - else dol_print_error($resqlcontact); + } else dol_print_error($resqlcontact); } if (!$error) @@ -1158,20 +1145,17 @@ class Commande extends CommonOrder { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } } - } - else { + } else { dol_print_error($this->db); $this->db->rollback(); return -1; @@ -1274,8 +1258,7 @@ class Commande extends CommonOrder { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1406,10 +1389,8 @@ class Commande extends CommonOrder $this->valid($user); } return $ret; - } - else return -1; - } - else return -1; + } else return -1; + } else return -1; } @@ -1489,8 +1470,7 @@ class Commande extends CommonOrder if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } $label = trim($label); @@ -1649,20 +1629,17 @@ class Commande extends CommonOrder { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -1901,13 +1878,11 @@ class Commande extends CommonOrder return -3; } return 1; - } - else { + } else { $this->error = 'Order with id '.$id.' not found sql='.$sql; return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1971,19 +1946,16 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $line->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -2108,8 +2080,7 @@ class Commande extends CommonOrder $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -2172,8 +2143,7 @@ class Commande extends CommonOrder $this->db->free($resql); return $nb; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -2218,8 +2188,7 @@ class Commande extends CommonOrder } $this->db->free($resql); return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -2248,8 +2217,7 @@ class Commande extends CommonOrder { $row = $this->db->fetch_row($resql); return $row[0]; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2335,31 +2303,26 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $line->error; return -1; } - } - else { + } else { $this->db->rollback(); return 0; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -1; } @@ -2418,8 +2381,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2485,8 +2447,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2547,8 +2508,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2557,8 +2517,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -2; } } @@ -2611,8 +2570,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2621,8 +2579,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -2; } } @@ -2679,12 +2636,10 @@ class Commande extends CommonOrder if ($shortlist == 1) { $ga[$obj->cid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->cid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -2693,8 +2648,7 @@ class Commande extends CommonOrder } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2748,8 +2702,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2758,8 +2711,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Command status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2818,8 +2770,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2828,8 +2779,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'order status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2885,8 +2835,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2895,8 +2844,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -1; } } @@ -2938,8 +2886,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR); @@ -2948,8 +2895,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -2991,8 +2937,7 @@ class Commande extends CommonOrder $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR); @@ -3001,8 +2946,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -3110,8 +3054,7 @@ class Commande extends CommonOrder if ($price_base_type == 'TTC') { $subprice = $pu_ttc; - } - else { + } else { $subprice = $pu_ht; } $remise = 0; @@ -3214,15 +3157,13 @@ class Commande extends CommonOrder $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = get_class($this)."::updateline Order status makes operation forbidden"; $this->errors = array('OrderStatusMakeOperationForbidden'); return -2; @@ -3316,8 +3257,7 @@ class Commande extends CommonOrder } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -3449,8 +3389,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { $this->error .= ($this->error ? ', '.$errmsg : $errmsg); @@ -3515,8 +3454,7 @@ class Commande extends CommonOrder } return $response; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3570,38 +3508,31 @@ class Commande extends CommonOrder $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); $statusType = 'status9'; - } - elseif ($status == self::STATUS_DRAFT) { + } elseif ($status == self::STATUS_DRAFT) { $labelStatus = $langs->trans('StatusOrderDraft'); $labelStatusShort = $langs->trans('StatusOrderDraftShort'); $statusType = 'status0'; - } - elseif ($status == self::STATUS_VALIDATED) { + } elseif ($status == self::STATUS_VALIDATED) { $labelStatus = $langs->trans('StatusOrderValidated').$billedtext; $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext; $statusType = 'status1'; - } - elseif ($status == self::STATUS_SHIPMENTONPROCESS) { + } elseif ($status == self::STATUS_SHIPMENTONPROCESS) { $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; $statusType = 'status4'; - } - elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderToBill'); $labelStatusShort = $langs->trans('StatusOrderToBillShort'); $statusType = 'status4'; - } - elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext; $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext; $statusType = 'status6'; - } - elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderDelivered'); $labelStatusShort = $langs->trans('StatusOrderDelivered'); $statusType = 'status6'; - } - else { + } else { $labelStatus = $langs->trans('Unknown'); $labelStatusShort = ''; $statusType = ''; @@ -3763,8 +3694,7 @@ class Commande extends CommonOrder } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3838,8 +3768,7 @@ class Commande extends CommonOrder $line->total_ttc = 60; $line->total_tva = 10; $line->remise_percent = 50; - } - else { + } else { $line->total_ht = 100; $line->total_ttc = 120; $line->total_tva = 20; @@ -3897,8 +3826,7 @@ class Commande extends CommonOrder } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4149,8 +4077,7 @@ class OrderLine extends CommonOrderLine $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -4236,8 +4163,7 @@ class OrderLine extends CommonOrderLine } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -4282,8 +4208,7 @@ class OrderLine extends CommonOrderLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4378,8 +4303,7 @@ class OrderLine extends CommonOrderLine } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -4426,8 +4350,7 @@ class OrderLine extends CommonOrderLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4510,8 +4433,7 @@ class OrderLine extends CommonOrderLine } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -4550,8 +4472,7 @@ class OrderLine extends CommonOrderLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index cbb93b940de..5af5fb23060 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -78,8 +78,7 @@ class CommandeStats extends Stats $this->field = 'total_ht'; $this->field_line = 'total_ht'; $this->where .= " c.fk_statut > 0"; // Not draft and not cancelled - } - elseif ($mode == 'supplier') + } elseif ($mode == 'supplier') { $object = new CommandeFournisseur($this->db); $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 4fd050799dc..2d11feeeee2 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -63,14 +63,12 @@ if ($action == 'addcontact' && $user->rights->commande->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -82,8 +80,7 @@ elseif ($action == 'swapstatut' && $user->rights->commande->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -98,8 +95,7 @@ elseif ($action == 'deletecontact' && $user->rights->commande->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -203,8 +199,7 @@ if ($id > 0 || !empty($ref)) $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } - } - else { + } else { // Contact not found print "ErrorRecordNotFound"; } diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 020b1654ac9..f78d6ce2e84 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -184,8 +184,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 516dcd56fc0..27d38378bcb 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -182,12 +182,10 @@ if ($id > 0 || !empty($ref)) $permtoedit = $user->rights->commande->creer; $param = '&id='.$object->id.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity); include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { header('Location: index.php'); exit; } diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 53f6b20b4f6..96476caeeed 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -173,8 +173,7 @@ if ($resql) //if ($totalinprocess != $total) print ''.$langs->trans("Total").''.$total.''; print "
"; -} -else { +} else { dol_print_error($db); } @@ -231,8 +230,7 @@ if (!empty($conf->commande->enabled)) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("NoOrder").''; } print "
"; @@ -321,8 +319,7 @@ if ($resql) } } print "
"; -} -else dol_print_error($db); +} else dol_print_error($db); $max = 10; @@ -408,8 +405,7 @@ if (!empty($conf->commande->enabled)) } print "
"; - } - else dol_print_error($db); + } else dol_print_error($db); } /* @@ -493,8 +489,7 @@ if (!empty($conf->commande->enabled)) } } print "
"; - } - else dol_print_error($db); + } else dol_print_error($db); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 088512d6fa2..63c82775ff1 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -395,8 +395,7 @@ if ($resql) $soc->fetch($socid); $title = $langs->trans('ListOfOrders').' - '.$soc->name; if (empty($search_company)) $search_company = $soc->name; - } - else { + } else { $title = $langs->trans('ListOfOrders'); } if (strval($search_status) == '0') @@ -540,8 +539,7 @@ if ($resql) { print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; - } - else { + } else { print $form->selectyesno('validate_invoices', 0, 1); } if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; @@ -960,8 +958,7 @@ if ($resql) { $notshippable++; } - } - else { // Detailed code, looks bugged + } else { // Detailed code, looks bugged // stock order and stock order_supplier $stock_order = 0; $stock_order_supplier = 0; @@ -1308,8 +1305,7 @@ if ($resql) $delallowed = $user->rights->commande->creer; print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index cae54d69bbd..c3d82821249 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -83,8 +83,7 @@ if ($action == 'create') { $error++; setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); - } - else { + } else { $origin = GETPOST('origin'); $originid = GETPOST('originid'); } @@ -208,8 +207,7 @@ if (($action == 'create' || $action == 'add') && !$error) if ($db->query($sql)) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -254,14 +252,12 @@ if (($action == 'create' || $action == 'add') && !$error) { $result = $object->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $error++; break; } - } - else { + } else { // Positive line $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Date start @@ -316,8 +312,7 @@ if (($action == 'create' || $action == 'add') && !$error) if ($result > 0) { $lineid = $result; - } - else { + } else { $lineid = 0; $error++; break; @@ -329,15 +324,13 @@ if (($action == 'create' || $action == 'add') && !$error) } } } - } - else { + } else { setEventMessages($objectsrc->error, $objectsrc->errors, 'errors'); $error++; } $ii++; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } @@ -351,8 +344,7 @@ if (($action == 'create' || $action == 'add') && !$error) $db->commit(); header('Location: '.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$id); exit; - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -721,8 +713,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; $db->free($resql); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 35f9f60020c..0910e4ee7ad 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -114,8 +114,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenamenb = $dir.'/ordersnbinyear-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png'; @@ -156,8 +155,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenameamount = $dir.'/ordersamountinyear-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png'; @@ -196,8 +194,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -378,8 +375,7 @@ print '
'; // Show graphs print ''; - } - else { + } else { // Sort array by date ASC to calculate balance $totalET_debit = 0; diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 05f89e1bc6f..767c8f8709b 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -138,12 +138,10 @@ if ($id > 0 || !empty($ref)) { $moreparam = '&num='.urlencode($num); ; $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($num)."/"; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { Header('Location: index.php'); exit; } diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 51d838878b8..72a7e33d3f2 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -50,8 +50,7 @@ if (!$year_start) { $year_start = $year_current - 2; $year_end = $year_current; -} -else { +} else { $year_end = $year_start + 2; } @@ -106,8 +105,7 @@ if ($resql) $encaiss[$row[1]] = $row[0]; $i++; } -} -else { +} else { dol_print_error($db); } @@ -133,8 +131,7 @@ if ($resql) $decaiss[$row[1]] = -$row[0]; $i++; } -} -else { +} else { dol_print_error($db); } @@ -154,8 +151,7 @@ if (!empty($id)) if (!preg_match('/,/', $id)) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - } - else { + } else { $bankaccount = new Account($db); $listid = explode(',', $id); foreach ($listid as $key => $aId) @@ -166,8 +162,7 @@ if (!empty($id)) if ($key < (count($listid) - 1)) print ', '; } } -} -else { +} else { print $langs->trans("AllAccounts"); } @@ -252,8 +247,7 @@ if ($resql) { $obj = $db->fetch_object($resql); if ($obj) $balance = $obj->total; -} -else { +} else { dol_print_error($db); } @@ -275,8 +269,7 @@ if ($result < 0) $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors'); -} -else { +} else { // Calcul de $min et $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -292,8 +285,7 @@ else { $obj = $db->fetch_object($resql); $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); - } - else { + } else { dol_print_error($db); } $log = "graph.php: min=".$min." max=".$max; @@ -331,8 +323,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -417,8 +408,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index d5fb533016e..c5ded35cb51 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -68,8 +68,7 @@ if ($fielvalue) { if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype); -} -else { +} else { if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque'); } @@ -240,14 +239,12 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' } } } - } - else { + } else { $error++; $langs->load("errors"); setEventMessages($langs->trans("NoRecordSelected"), null, 'errors'); } - } - else { + } else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors'); @@ -283,8 +280,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) if (price2num($_POST["addcredit"]) > 0) { $amount = price2num($_POST["addcredit"]); - } - else { + } else { $amount = - price2num($_POST["adddebit"]); } @@ -333,12 +329,10 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : '')); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $action = 'addline'; } } @@ -462,8 +456,7 @@ if ($id > 0 || !empty($ref)) } } } -} -else { +} else { llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } @@ -667,8 +660,7 @@ if ($resql) if ($numr >= $nbmax) $liste = "...   ".$liste; print $liste; if ($numr <= 0) print ''.$langs->trans("None").''; - } - else { + } else { dol_print_error($db); } @@ -784,13 +776,11 @@ if ($resql) if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); - } - else // If direct entries is not done using miscellaneous payments + } else // If direct entries is not done using miscellaneous payments { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); } - } - else { + } else { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1); } } @@ -1036,8 +1026,7 @@ if ($resql) $balance = $objforbalance->previoustotal; } } - } - else dol_print_error($db); + } else dol_print_error($db); $balancecalculated = true; @@ -1118,8 +1107,7 @@ if ($resql) { $balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc) $balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT'); - } - else { + } else { $balancebefore = price2num($balance, 'MT'); // balancebefore = balance of previous line (sort is asc) $balance = price2num($balance + ($sign * $objp->amount), 'MT'); } @@ -1130,8 +1118,7 @@ if ($resql) $bankaccounttmp->fetch($objp->bankid); $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; - } - else { + } else { $bankaccount = $cachebankaccount[$objp->bankid]; } @@ -1195,63 +1182,53 @@ if ($resql) $banktransferstatic->id = $links[$key]['url_id']; $banktransferstatic->ref = $links[$key]['label']; print ' '.$banktransferstatic->getNomUrl(0); - } - elseif ($links[$key]['type'] == 'payment') + } elseif ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment print ' '.$paymentstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_supplier') + } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment print ' '.$paymentsupplierstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_sc') + } elseif ($links[$key]['type'] == 'payment_sc') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; //print $langs->trans("SocialContributionPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_vat') + } elseif ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; print ' '.$paymentvatstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_salary') + } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; print ' '.$paymentsalstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_loan') + } elseif ($links[$key]['type'] == 'payment_loan') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print ''; - } - elseif ($links[$key]['type'] == 'payment_donation') + } elseif ($links[$key]['type'] == 'payment_donation') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print ''; - } - elseif ($links[$key]['type'] == 'payment_expensereport') + } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; $paymentexpensereportstatic->ref = $links[$key]['url_id']; print ' '.$paymentexpensereportstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_various') + } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; $paymentvariousstatic->ref = $links[$key]['url_id']; print ' '.$paymentvariousstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'banktransfert') + } elseif ($links[$key]['type'] == 'banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. if ($objp->amount > 0) @@ -1266,8 +1243,7 @@ if ($resql) $bankstatic->label = $objp->bankref; print $bankstatic->getNomUrl(1, ''); print ')'; - } - else { + } else { $bankstatic->id = $objp->bankid; $bankstatic->label = $objp->bankref; print ' ('.$langs->trans("TransferFrom").' '; @@ -1280,20 +1256,15 @@ if ($resql) print ')'; } //var_dump($links); - } - elseif ($links[$key]['type'] == 'company') + } elseif ($links[$key]['type'] == 'company') { - } - elseif ($links[$key]['type'] == 'user') + } elseif ($links[$key]['type'] == 'user') { - } - elseif ($links[$key]['type'] == 'member') + } elseif ($links[$key]['type'] == 'member') { - } - elseif ($links[$key]['type'] == 'sc') + } elseif ($links[$key]['type'] == 'sc') { - } - else { + } else { // Show link with label $links[$key]['label'] if (!empty($objp->label) && !empty($links[$key]['label'])) print ' - '; print ''; @@ -1302,8 +1273,7 @@ if ($resql) // Label generique car entre parentheses. On l'affiche en le traduisant if ($reg[1] == 'paiement') $reg[1] = 'Payment'; print ' '.$langs->trans($reg[1]); - } - else { + } else { print ' '.$links[$key]['label']; } print ''; @@ -1380,8 +1350,7 @@ if ($resql) $companystatic->code_compta = $objp->code_compta; $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; print $companystatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -1433,12 +1402,10 @@ if ($resql) if ($balancebefore >= 0) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } if (!$i) $totalarray['nbfield']++; @@ -1451,12 +1418,10 @@ if ($resql) if ($balance >= 0) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } if (!$i) $totalarray['nbfield']++; @@ -1502,15 +1467,13 @@ if ($resql) print ''; print img_edit(); print ''; - } - else { + } else { if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; print img_edit(); print ''; - } - else { + } else { print ''; print img_view(); print ''; @@ -1560,16 +1523,14 @@ if ($resql) { if ($num < $limit && empty($offset)) print ''; else print ''; - } - elseif ($totalarray['totaldebfield'] == $i) print ''; + } elseif ($totalarray['totaldebfield'] == $i) print ''; elseif ($totalarray['totalcredfield'] == $i) print ''; elseif ($i == $posconciliatecol) { print ''; - } - else print ''; + } else print ''; } print ''; } @@ -1587,8 +1548,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 3a15ddf72e1..8559096477d 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -89,8 +89,7 @@ if ($result) print ''; print ''; print ''; -} -else { +} else { dol_print_error($db); } print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index b14e3adafad..0c20e46e316 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -334,8 +334,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $nofile['sens'] = $objd->sens; $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; - } - else { + } else { foreach ($files as $key => $file) { $file['id'] = $objd->id; @@ -382,14 +381,12 @@ if (($action == 'searchfiles' || $action == 'dl')) { $i++; } - } - else { + } else { dol_print_error($db); } $db->free($resd); - } - else { + } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'errors'); $error++; } @@ -489,8 +486,7 @@ if ($result && $action == "dl" && !$error) dol_delete_file($zipname); exit(); - } - else { + } else { setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors'); } } @@ -622,8 +618,7 @@ if (!empty($date_start) && !empty($date_stop)) if (empty($TData)) { print '
'.$langs->trans("NoItem").'
 '.price($balancebefore).' '.price($balancebefore).'- '.price($balance).' '.price($balance).'-'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price(-1 * $totalarray['totaldeb']).''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).''; if ($user->rights->banque->consolidate && $action == 'reconcile') print ''; print '
'.$langs->trans("Total").''.price($total).''.price($totalnb ?price2num($total / $totalnb, 'MT') : 0).'
"; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 3af40ffb2a0..3771d010f4f 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -99,8 +99,7 @@ if ($action == 'add') if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; - } - else { + } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); @@ -154,8 +153,7 @@ if ($action == 'add') $_GET["id"] = $id; // Force chargement page en mode visu $action = ''; - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -166,8 +164,7 @@ if ($action == 'add') if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -203,8 +200,7 @@ if ($action == 'update') if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; - } - else { + } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); @@ -256,8 +252,7 @@ if ($action == 'update') $object->setCategories($categories); $_GET["id"] = $_POST["id"]; // Force chargement page en mode visu - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; // Force chargement page edition @@ -267,8 +262,7 @@ if ($action == 'update') if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -285,8 +279,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights-> setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); header("Location: ".DOL_URL_ROOT."/compta/bank/list.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -377,8 +370,7 @@ if ($action == 'create') if (isset($_POST["account_country_id"])) { $selectedcode = $_POST["account_country_id"] ? $_POST["account_country_id"] : $object->country_code; - } - elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code; + } elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''.$langs->trans("BankAccountCountry").''; @@ -392,8 +384,7 @@ if ($action == 'create') if ($selectedcode) { $formcompany->select_departement(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : '', $selectedcode, 'account_state_id'); - } - else { + } else { print $countrynotdefined; } print ''; @@ -537,8 +528,7 @@ if ($action == 'create') print ''; print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print ''; - } - else { + } else { print ''.$langs->trans("AccountancyCode").''; print 'account_number).'">'; } @@ -877,8 +867,7 @@ else { if ($selectedcode) { print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $object->state_id, $selectedcode, 'account_state_id'); - } - else { + } else { print $countrynotdefined; } print ''; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index b7bbb4d157e..0f71134d08a 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -132,8 +132,7 @@ if ($result) print ''; print ''; print ""; - } - else { + } else { print "".$objp->label.""; print ''; print ''.img_edit().''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cae83563b42..adb170ee81d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -343,9 +343,9 @@ class Account extends CommonObject $string .= $this->code_guichet.' '; } elseif ($val == 'BankAccountNumberKey') { $string .= $this->cle_rib.' '; - }elseif ($val == 'BIC') { + } elseif ($val == 'BIC') { $string .= $this->bic.' '; - }elseif ($val == 'IBAN') { + } elseif ($val == 'IBAN') { $string .= $this->iban.' '; } } @@ -403,8 +403,7 @@ class Account extends CommonObject { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url"); return $rowid; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -436,8 +435,7 @@ class Account extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."bank_url"; if ($fk_bank > 0) { $sql .= " WHERE fk_bank = ".$fk_bank; - } - else { $sql .= " WHERE url_id = ".$url_id." AND type = '".$type."'"; + } else { $sql .= " WHERE url_id = ".$url_id." AND type = '".$type."'"; } $sql .= " ORDER BY type, label"; @@ -463,8 +461,7 @@ class Account extends CommonObject $lines[$i]['fk_bank'] = $obj->fk_bank; $i++; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return $lines; } @@ -508,8 +505,7 @@ class Account extends CommonObject { $obj = $this->db->fetch_object($resql); $oper = $obj->code; - } - else { + } else { dol_print_error($this->db, 'Failed to get payment type code'); return -1; } @@ -718,18 +714,15 @@ class Account extends CommonObject if ($result < 0) $error++; // End call triggers } - } - else { + } else { $error++; } - } - else { + } else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans("ErrorBankLabelAlreadyExists"); $error++; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $error++; } @@ -739,8 +732,7 @@ class Account extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } @@ -831,8 +823,7 @@ class Account extends CommonObject if ($result < 0) $error++; // End call triggers } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); dol_print_error($this->db); @@ -842,8 +833,7 @@ class Account extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } @@ -900,8 +890,7 @@ class Account extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_print_error($this->db); return -1; @@ -998,12 +987,10 @@ class Account extends CommonObject $this->fetch_optionals(); return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = $this->db->lasterror; $this->errors[] = $this->error; return -1; @@ -1103,8 +1090,7 @@ class Account extends CommonObject dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); } } - } - else { + } else { $error++; $this->error = "Error ".$this->db->lasterror(); } @@ -1114,8 +1100,7 @@ class Account extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1180,8 +1165,7 @@ class Account extends CommonObject if ($resql) { $obj = $this->db->fetch_object($resql); if ($obj->nb <= 1) $can_be_deleted = true; // Juste le solde - } - else { + } else { dol_print_error($this->db); } return $can_be_deleted; @@ -1279,8 +1263,7 @@ class Account extends CommonObject } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1317,8 +1300,7 @@ class Account extends CommonObject $this->nb["banklines"] = $obj->nb; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1352,8 +1334,7 @@ class Account extends CommonObject { $obj = $db->fetch_object($resql); $nb = $obj->nb; - } - else dol_print_error($db); + } else dol_print_error($db); return $nb; } @@ -1400,8 +1381,7 @@ class Account extends CommonObject if ($mode == 'transactions') { $url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id; - } - elseif ($mode == 'receipts') + } elseif ($mode == 'receipts') { $url = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id; } @@ -1461,8 +1441,7 @@ class Account extends CommonObject if ($this->error_number == 0) { return 1; - } - else { + } else { return 0; } } @@ -1881,8 +1860,7 @@ class AccountLine extends CommonObject } $this->db->free($result); return $ret; - } - else { + } else { return -1; } } @@ -1969,8 +1947,7 @@ class AccountLine extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1998,8 +1975,7 @@ class AccountLine extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -$nbko; } @@ -2036,8 +2012,7 @@ class AccountLine extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -$nbko; } @@ -2067,8 +2042,7 @@ class AccountLine extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error(); return -1; @@ -2132,8 +2106,7 @@ class AccountLine extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2169,13 +2142,11 @@ class AccountLine extends CommonObject { return 1; } - } - else { + } else { dol_print_error($this->db); return 0; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return 0; } @@ -2235,13 +2206,11 @@ class AccountLine extends CommonObject { return 1; } - } - else { + } else { dol_print_error($this->db); return 0; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return 0; } @@ -2311,8 +2280,7 @@ class AccountLine extends CommonObject //$this->date_rappro = $obj->daterappro; // Not yet managed } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -2453,8 +2421,7 @@ class AccountLine extends CommonObject { $alreadydispatched = $obj->nb; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 6943d2bc5e1..3293f746033 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -225,8 +225,7 @@ class BankAccounts extends DolibarrApi if ($accountto->currency_code == $accountfrom->currency_code) { $amount_to = $amount; - } - else { + } else { if (!$amount_to || empty($amount_to)) { throw new RestException(422, 'You must provide amount_to value since bankaccount_from and bankaccount_to does not share the same currency.'); @@ -302,8 +301,7 @@ class BankAccounts extends DolibarrApi 'message' => 'Internal wire transfer created successfully.' ) ); - } - else { + } else { $this->db->rollback(); throw new RestException(500, $accountfrom->error.' '.$accountto->error); } @@ -336,8 +334,7 @@ class BankAccounts extends DolibarrApi if ($account->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $account->error); } } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index ec88fea3f84..65c7e7ce2ea 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -169,8 +169,7 @@ class PaymentVarious extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -243,8 +242,7 @@ class PaymentVarious extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -428,8 +426,7 @@ class PaymentVarious extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $error++; } @@ -458,20 +455,17 @@ class PaymentVarious extends CommonObject $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user); if ($result < 0) $error++; // End call triggers - } - else $error++; + } else $error++; if (!$error) { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -494,8 +488,7 @@ class PaymentVarious extends CommonObject if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -529,30 +522,25 @@ class PaymentVarious extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); @@ -610,8 +598,7 @@ class PaymentVarious extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -670,8 +657,7 @@ class PaymentVarious extends CommonObject $this->date_modif = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -698,8 +684,7 @@ class PaymentVarious extends CommonObject { $alreadydispatched = $obj->nb; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index d003463e5af..09cd81d4198 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -137,12 +137,10 @@ if ($id > 0 || !empty($ref)) { $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { Header('Location: index.php'); exit; } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 796529a24d9..296211bf35c 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -84,8 +84,7 @@ if ($result < 0) $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors'); -} -else { +} else { // Calcul $min and $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -101,8 +100,7 @@ else { $obj = $db->fetch_object($resql); $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); - } - else { + } else { dol_print_error($db); } if (empty($min)) $min = dol_now() - 3600 * 24; @@ -149,8 +147,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -171,8 +168,7 @@ else { $row = $db->fetch_row($resql); $solde = $row[0]; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -195,8 +191,7 @@ else { if ($day > time()) { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph - } - else { + } else { $datas[$i] = $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -289,8 +284,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -311,8 +305,7 @@ else { $row = $db->fetch_row($resql); $solde = $row[0]; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -336,8 +329,7 @@ else { if ($day > $now) { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph - } - else { + } else { $datas[$i] = $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -423,8 +415,7 @@ else { $amounts[$row[0]] = $row[1]; $i++; } - } - else { + } else { dol_print_error($db); } @@ -450,8 +441,7 @@ else { if ($day > ($max + 86400)) { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph - } - else { + } else { $datas[$i] = 0 + $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -547,8 +537,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -580,8 +569,7 @@ else { $debits[$row[0]] = abs($row[1]); } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -662,8 +650,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } $sql = "SELECT date_format(b.datev,'%m')"; @@ -686,8 +673,7 @@ else { $debits[$row[0]] = abs($row[1]); } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -756,14 +742,12 @@ if ($account) { $morehtml = ''.$langs->trans("ShowAllAccounts").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1); - } - else { + } else { $morehtml = ''.$langs->trans("BackToAccount").''; print $langs->trans("AllAccounts"); //print $morehtml; } - } - else { + } else { $bankaccount = new Account($db); $listid = explode(',', $account); foreach ($listid as $key => $id) @@ -774,8 +758,7 @@ if ($account) if ($key < (count($listid) - 1)) print ', '; } } -} -else { +} else { print $langs->trans("AllAccounts"); } @@ -791,8 +774,7 @@ if ($mode == 'showalltime') print ''; print $langs->trans("GoBack"); print ''; -} -else { +} else { print ''; print $langs->trans("ShowAllTimeBalance"); print ''; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index a1c37d59050..d2b3e6099dd 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -76,15 +76,15 @@ if ($user->rights->banque->consolidate && $action == 'donext') { $al = new AccountLine($db); $al->dateo_next($_GET["rowid"]); -}elseif ($user->rights->banque->consolidate && $action == 'doprev') +} elseif ($user->rights->banque->consolidate && $action == 'doprev') { $al = new AccountLine($db); $al->dateo_previous($_GET["rowid"]); -}elseif ($user->rights->banque->consolidate && $action == 'dvnext') +} elseif ($user->rights->banque->consolidate && $action == 'dvnext') { $al = new AccountLine($db); $al->datev_next($_GET["rowid"]); -}elseif ($user->rights->banque->consolidate && $action == 'dvprev') +} elseif ($user->rights->banque->consolidate && $action == 'dvprev') { $al = new AccountLine($db); $al->datev_previous($_GET["rowid"]); @@ -99,8 +99,7 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban { dol_print_error($db); } - } - else { + } else { setEventMessages($langs->trans("MissingIds"), null, 'errors'); } } @@ -119,8 +118,7 @@ if ($user->rights->banque->modifier && $action == "update") if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) // We ask to change bank account { $actarget->fetch(GETPOST('accountid', 'int')); - } - else { + } else { $actarget->fetch($id); } @@ -189,8 +187,7 @@ if ($user->rights->banque->modifier && $action == "update") { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -226,8 +223,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -320,8 +316,7 @@ if ($result) if (!$objp->rappro && !$bankline->getVentilExportCompta()) { $form->select_comptes($acct->id, 'accountid', 0, '', 0); - } - else { + } else { print $acct->getNomUrl(1, 'transactions', 'reflabel'); } print ''; @@ -345,8 +340,7 @@ if ($result) print $langs->trans("Payment"); print '';*/ print $paymenttmp->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'payment_supplier') { + } elseif ($links[$key]['type'] == 'payment_supplier') { require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; $paymenttmp = new PaiementFourn($db); $paymenttmp->fetch($links[$key]['url_id']); @@ -356,79 +350,66 @@ if ($result) print $langs->trans("Payment"); print '';*/ print $paymenttmp->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'company') { + } elseif ($links[$key]['type'] == 'company') { $societe = new Societe($db); $societe->fetch($links[$key]['url_id']); print $societe->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'sc') { + } elseif ($links[$key]['type'] == 'sc') { print ''; print img_object($langs->trans('SocialContribution'), 'bill').' '; print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : ''); print ''; - } - elseif ($links[$key]['type'] == 'payment_sc') { + } elseif ($links[$key]['type'] == 'payment_sc') { print ''; print img_object($langs->trans('Payment'), 'payment').' '; print $langs->trans("SocialContributionPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_vat') { + } elseif ($links[$key]['type'] == 'payment_vat') { print ''; print img_object($langs->trans('VAT'), 'payment').' '; print $langs->trans("VATPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_salary') { + } elseif ($links[$key]['type'] == 'payment_salary') { print ''; print img_object($langs->trans('PaymentSalary'), 'payment').' '; print $langs->trans("SalaryPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_loan') { + } elseif ($links[$key]['type'] == 'payment_loan') { print ''; print img_object($langs->trans('LoanPayment'), 'payment').' '; print $langs->trans("PaymentLoan"); print ''; - } - elseif ($links[$key]['type'] == 'loan') { + } elseif ($links[$key]['type'] == 'loan') { print ''; print img_object($langs->trans('Loan'), 'bill').' '; print $langs->trans("Loan"); print ''; - } - elseif ($links[$key]['type'] == 'member') { + } elseif ($links[$key]['type'] == 'member') { print ''; print img_object($langs->trans('Member'), 'user').' '; print $links[$key]['label']; print ''; - } - elseif ($links[$key]['type'] == 'payment_donation') { + } elseif ($links[$key]['type'] == 'payment_donation') { print ''; print img_object($langs->trans('Donation'), 'payment').' '; print $langs->trans("DonationPayment"); print ''; - } - elseif ($links[$key]['type'] == 'banktransfert') { + } elseif ($links[$key]['type'] == 'banktransfert') { print ''; print img_object($langs->trans('Transaction'), 'payment').' '; print $langs->trans("TransactionOnTheOtherAccount"); print ''; - } - elseif ($links[$key]['type'] == 'user') { + } elseif ($links[$key]['type'] == 'user') { print ''; print img_object($langs->trans('User'), 'user').' '; print $langs->trans("User"); print ''; - } - elseif ($links[$key]['type'] == 'payment_various') { + } elseif ($links[$key]['type'] == 'payment_various') { print ''; print img_object($langs->trans('VariousPayment'), 'payment').' '; print $langs->trans("VariousPayment"); print ''; - } - else { + } else { print ''; print img_object('', 'generic').' '; print $links[$key]['label']; @@ -458,8 +439,7 @@ if ($result) print '     '.$langs->trans("CheckReceipt").': '.$receipt->getNomUrl(2); } print ''; - } - else { + } else { print ''.$objp->fk_type.' '.$objp->num_chq.''; } print ""; @@ -473,8 +453,7 @@ if ($result) print ''; print ''; print ''; - } - else { + } else { print ''.$objp->emetteur.''; } print ""; @@ -488,8 +467,7 @@ if ($result) print ''; print ''; print ''; - } - else { + } else { print ''.$objp->banque.''; } print ""; @@ -509,8 +487,7 @@ if ($result) print img_edit_add().""; } print ''; - } - else { + } else { print ''; print dol_print_date($db->jdate($objp->do), "day"); print ''; @@ -532,8 +509,7 @@ if ($result) print img_edit_add().""; } print ''; - } - else { + } else { print ''; print dol_print_date($db->jdate($objp->dv), "day"); print ''; @@ -550,21 +526,18 @@ if ($result) { // Label generique car entre parentheses. On l'affiche en le traduisant print $langs->trans($reg[1]); - } - else { + } else { print $objp->label; } print '">'; print ''; - } - else { + } else { print ''; if (preg_match('/^\((.*)\)$/i', $objp->label, $reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant print $langs->trans($reg[1]); - } - else { + } else { print $objp->label; } print ''; @@ -578,8 +551,7 @@ if ($result) print ''; print 'rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code); print ''; - } - else { + } else { print ''; print price($objp->amount); print ''; @@ -635,14 +607,12 @@ if ($result) { print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; print ''; - } - else { + } else { print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; print ''; - } - else { + } else { print ''.$objp->num_releve.' '; } print ''; @@ -653,8 +623,7 @@ if ($result) print ''; print 'rappro ? ' checked="checked"' : '')).'">'; print ''; - } - else { + } else { print ''.yn($objp->rappro).''; } print ''; @@ -677,8 +646,7 @@ if ($result) } $db->free($result); -} -else dol_print_error($db); +} else dol_print_error($db); // End of page llxFooter(); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index bc45c708f33..882244518f7 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -212,8 +212,7 @@ if ($resql) $i++; } $db->free($resql); -} -else dol_print_error($db); +} else dol_print_error($db); @@ -487,8 +486,7 @@ foreach ($accounts as $key=>$type) $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $objecttmp->account_number, 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); - } - else { + } else { print $objecttmp->account_number; } print ''; @@ -504,8 +502,7 @@ foreach ($accounts as $key=>$type) $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objecttmp->fk_accountancy_journal); print $accountingjournal->getNomUrl(0, 1, 1, '', 1); - } - else { + } else { print ''; } print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 65476665963..4244856c9ab 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -125,8 +125,7 @@ if ($_GET["rel"] == 'prev') $found = true; } } -} -elseif ($_GET["rel"] == 'next') +} elseif ($_GET["rel"] == 'next') { // Recherche valeur pour num = numero releve precedent $sql = "SELECT DISTINCT(b.num_releve) as num"; @@ -147,8 +146,7 @@ elseif ($_GET["rel"] == 'next') $found = true; } } -} -else { +} else { // On veut le releve num $found = true; } @@ -295,15 +293,13 @@ if (empty($numref)) if (!isset($objp->numr)) { // - } - else { + } else { print ''; print ''; if ($action != 'editbankreceipt' || $objp->numr != $brref) { print ''.$objp->numr.''; - } - else { + } else { print ''; print ''; print ''; @@ -353,12 +349,10 @@ if (empty($numref)) print ''; print "\n
\n"; - } - else { + } else { dol_print_error($db); } -} -else { +} else { /** * Show list of record into a bank statement */ @@ -484,58 +478,50 @@ else { $paymentstatic->ref = $langs->trans("Payment"); print ' '.$paymentstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_supplier') + } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $langs->trans("Payment"); print ' '.$paymentsupplierstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_sc') + } elseif ($links[$key]['type'] == 'payment_sc') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print $langs->trans("SocialContributionPayment"); print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_vat') + } elseif ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $langs->trans("Payment"); print ' '.$paymentvatstatic->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'payment_salary') + } elseif ($links[$key]['type'] == 'payment_salary') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print $langs->trans("Payment"); print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_donation') + } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonationstatic->id = $links[$key]['url_id']; $paymentdonationstatic->ref = $langs->trans("Payment"); print ' '.$paymentdonationstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_loan') + } elseif ($links[$key]['type'] == 'payment_loan') { $paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->ref = $langs->trans("Payment"); print ' '.$paymentloanstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_various') + } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; $paymentvariousstatic->ref = $langs->trans("Payment"); print ' '.$paymentvariousstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'banktransfert') { + } elseif ($links[$key]['type'] == 'banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. if ($objp->amount > 0) { @@ -549,8 +535,7 @@ else { $bankstatic->label = $objp->bankref; print $bankstatic->getNomUrl(1, ''); print ')'; - } - else { + } else { $bankstatic->id = $objp->bankid; $bankstatic->label = $objp->bankref; print ' ('.$langs->trans("from").' '; @@ -562,35 +547,30 @@ else { print $bankstatic->getNomUrl(1, 'transactions'); print ')'; } - } - elseif ($links[$key]['type'] == 'company') { + } elseif ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; $societestatic->name = $links[$key]['label']; print $societestatic->getNomUrl(1, 'company', 24); $newline = 0; - } - elseif ($links[$key]['type'] == 'member') { + } elseif ($links[$key]['type'] == 'member') { print ''; print img_object($langs->trans('ShowMember'), 'user').' '; print $links[$key]['label']; print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'user') { + } elseif ($links[$key]['type'] == 'user') { print ''; print img_object($langs->trans('ShowUser'), 'user').' '; print $links[$key]['label']; print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'sc') { + } elseif ($links[$key]['type'] == 'sc') { print ''; print img_object($langs->trans('ShowBill'), 'bill').' '; print $langs->trans("SocialContribution"); print ''; $newline = 0; - } - else { + } else { print ''; print $links[$key]['label']; print ''; @@ -620,8 +600,7 @@ else { print "
".$objc->label.""; $ii++; } - } - else { + } else { dol_print_error($db); } } @@ -632,8 +611,7 @@ else { { $totald = $totald + abs($objp->amount); print ''.price($objp->amount * -1)." \n"; - } - else { + } else { $totalc = $totalc + abs($objp->amount); print ' '.price($objp->amount)."\n"; } @@ -645,8 +623,7 @@ else { print ''; print img_edit(); print ""; - } - else { + } else { print " "; } print ""; diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 99a66321648..7228c38fe50 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -87,8 +87,7 @@ if ($action == 'add') if ($accountto->currency_code == $accountfrom->currency_code) { $amountto = $amount; - } - else { + } else { if (!$amountto) { $error++; @@ -129,13 +128,11 @@ if ($action == 'add') $mesgs = $langs->trans("TransferFromToDone", ''.$accountfrom->label."", ''.$accountto->label."", $amount, $langs->transnoentities("Currency".$conf->currency)); setEventMessages($mesgs, null, 'mesgs'); $db->commit(); - } - else { + } else { setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors'); $db->rollback(); } - } - else { + } else { $error++; setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors'); } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 929a1611775..cf494b77a90 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -72,8 +72,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($vline) { $viewline = $vline; - } - else { + } else { $viewline = 20; } @@ -289,8 +288,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($obj->family == 'invoice') { $mc->getInfo($obj->entity); print "".$mc->label.""; - } - else { + } else { print ""; } } @@ -303,8 +301,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $i++; } - } - else { + } else { dol_print_error($db); } @@ -324,8 +321,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print ""; print "
"; -} -else { +} else { print $langs->trans("ErrorBankAccountNotFound"); } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index ffabd082bfa..071a5abf0a9 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -163,8 +163,7 @@ if (empty($reshook)) $urltogo = ($backtopage ? $backtopage : DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); header("Location: ".$urltogo); exit; - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -197,19 +196,16 @@ if (empty($reshook)) $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } @@ -371,8 +367,7 @@ if ($action == 'create') print ''; print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1); print ''; - } - else // For external software + } else // For external software { print ''.$langs->trans("AccountAccounting").''; print ''; @@ -387,13 +382,11 @@ if ($action == 'create') if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); - } - else { + } else { print ''; } print ''; - } - else // For external software + } else // For external software { print ''.$langs->trans("SubledgerAccount").''; print ''; @@ -559,12 +552,10 @@ if ($id) } else { print '
'.$langs->trans("Delete").'
'; } - } - else { + } else { print '
'.$langs->trans("Delete").'
'; } - } - else { + } else { print '
'.$langs->trans("Delete").'
'; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 624ead86073..7a89fd77986 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -149,8 +149,7 @@ if ($object->id) $permission = $user->rights->banque->modifier; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 5fa44ba8555..d02f75819e4 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -75,8 +75,7 @@ if (!GETPOST('typeid')) $part = explode(':', $val); if ($part[0] == 'v.fk_typepayment') $typeid = $part[1]; } -} -else { +} else { $typeid = GETPOST('typeid'); } @@ -312,8 +311,7 @@ if ($result) $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; if (!$i) $totalarray['nbfield']++; } @@ -372,8 +370,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index fce50a977e4..b14b77d5264 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -107,8 +107,7 @@ if (GETPOST('cancel', 'alpha')) { if ($action == 'valid') { $action = 'view'; - } - else { + } else { $action = 'create'; } } @@ -144,8 +143,7 @@ if ($action == "start") $action = 'create'; $error++; } -} -elseif ($action == "add") +} elseif ($action == "add") { if (GETPOST('opening', 'alpha') == '') { @@ -177,8 +175,7 @@ elseif ($action == "add") { $db->commit(); $action = "view"; - } - else { + } else { $db->rollback; $action = "view"; } @@ -216,8 +213,7 @@ if ($action == "valid") // validate = close { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); - } - else { + } else { setEventMessages($langs->trans("CashFenceDone"), null); $db->commit(); } @@ -251,8 +247,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) setEventMessages("RecordDeleted", null, 'mesgs'); header("Location: ".$backurlforlist); exit; - } - else { + } else { if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } @@ -279,8 +274,7 @@ if ($action == "create" || $action == "start" || $action == 'close') $syear = $object->year_close; $smonth = $object->month_close; $sday = $object->day_close; - } - elseif (GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '-1') + } elseif (GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '-1') { $posmodule = GETPOST('posmodule', 'alpha'); $terminalid = GETPOST('posnumber', 'alpha'); @@ -324,10 +318,8 @@ if ($action == "create" || $action == "start" || $action == 'close') { $obj = $db->fetch_object($resql); if ($obj) $initialbalanceforterminal[$terminalid][$key] = $obj->total; - } - else dol_print_error($db); - } - else { + } else dol_print_error($db); + } else { setEventMessages($langs->trans("SetupOfTerminalNotComplete", $terminaltouse), null, 'errors'); $error++; } @@ -366,8 +358,7 @@ if ($action == "create" || $action == "start" || $action == 'close') $theoricalamountforterminal[$terminalid][$key] = price2num($theoricalamountforterminal[$terminalid][$key] + $obj->total); $theoricalnbofinvoiceforterminal[$terminalid][$key] = $obj->nb; } - } - else dol_print_error($db); + } else dol_print_error($db); } } @@ -383,13 +374,11 @@ if ($action == "create" || $action == "start" || $action == 'close') if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; - } - elseif ($action == 'close') + } elseif ($action == 'close') { print ''; print ''; - } - else { + } else { print ''; } @@ -463,8 +452,7 @@ if ($action == "create" || $action == "start" || $action == 'close') if ($action == 'start' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '-1') { print ''; - } - else { + } else { print ''; } print ''; @@ -562,8 +550,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { $object->fetch($id); print $object->opening; - } - else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); + } else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); print '">'; print ''; // Amount per payment type @@ -601,8 +588,7 @@ if (empty($action) || $action == "view" || $action == "close") if ($result <= 0) { print $langs->trans("ErrorRecordNotFound"); - } - else { + } else { $head = array(); $head[0][0] = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$object->id; $head[0][1] = $langs->trans("CashControl"); @@ -699,13 +685,11 @@ if (empty($action) || $action == "view" || $action == "close") if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; - } - elseif ($action == 'close') + } elseif ($action == 'close') { print ''; print ''; - } - else { + } else { print ''; } @@ -852,8 +836,7 @@ if (empty($action) || $action == "view" || $action == "close") { $object->fetch($id); print $object->opening; - } - else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); + } else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); print '">'; print ''; // Amount per payment type diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 5269c07bab2..0279ad5143c 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -259,8 +259,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 81a19389244..0f60be3c3a8 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -404,8 +404,7 @@ class CashControl extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 5b9079f9d72..f2d8e38fb15 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -172,8 +172,7 @@ if ($resql) $bankaccounttmp->fetch($objp->bankid); $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; - } - else { + } else { $bankaccount = $cachebankaccount[$objp->bankid]; } @@ -207,8 +206,7 @@ if ($resql) print $bankaccount->getNomUrl(1); if ($cashcontrol->posmodule == "takepos") { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber; - } - else { + } else { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'; } if ($objp->code == 'CHQ') { @@ -310,8 +308,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 991d039d1fb..def4fda9b10 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -103,8 +103,7 @@ if ($mode != 'sconly') { $center = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."" : ""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 1); -} -else { +} else { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 0); } @@ -216,8 +215,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $accountstatic->accountancy_journal = $obj->accountancy_journal; $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } // Paid @@ -239,8 +237,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if (!empty($conf->banque->enabled)) print ''; print ''.price($totalpaye).""; print ""; - } - else { + } else { dol_print_error($db); } print ''; @@ -332,8 +329,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $accountstatic->accountancy_journal = $obj->accountancy_journal; $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } @@ -354,8 +350,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -366,18 +361,15 @@ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $j = 1; $numlt = 3; -} -elseif ($mysoc->localtax1_assuj == "1") +} elseif ($mysoc->localtax1_assuj == "1") { $j = 1; $numlt = 2; -} -elseif ($mysoc->localtax2_assuj == "1") +} elseif ($mysoc->localtax2_assuj == "1") { $j = 2; $numlt = 3; -} -else { +} else { $j = 0; $numlt = 0; } @@ -447,8 +439,7 @@ while ($j < $numlt) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -541,8 +532,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) $accountstatic->accountancy_journal = $obj->accountancy_journal; $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } @@ -560,8 +550,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) $db->free($result); print "
"; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 74cc0d594e5..5632e8ebc1a 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -196,8 +196,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index b688bd17907..d2fd1c54cce 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -70,14 +70,11 @@ if ($action == 'validate' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } -} - -elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) +} elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { $object->fetch($id); if ($object->statut == Deplacement::STATUS_VALIDATED) @@ -87,27 +84,21 @@ elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } -} - -elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) +} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { $result = $object->delete($id); if ($result >= 0) { header("Location: index.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } -} - -elseif ($action == 'add' && $user->rights->deplacement->creer) +} elseif ($action == 'add' && $user->rights->deplacement->creer) { if (!GETPOST('cancel', 'alpha')) { @@ -146,17 +137,14 @@ elseif ($action == 'add' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } - } - else { + } else { $action = 'create'; } - } - else { + } else { header("Location: index.php"); exit; } @@ -183,12 +171,10 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } @@ -209,8 +195,7 @@ elseif ($action == 'setdated' && $user->rights->deplacement->creer) $object->fetch($id); $result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY'); if ($result < 0) dol_print_error($db, $object->error); -} -elseif ($action == 'setkm' && $user->rights->deplacement->creer) +} elseif ($action == 'setkm' && $user->rights->deplacement->creer) { $object->fetch($id); $result = $object->setValueFrom('km', GETPOST('km', 'int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY'); @@ -305,8 +290,7 @@ if ($action == 'create') print ''; print ''; -} -elseif ($id) +} elseif ($id) { $result = $object->fetch($id); if ($result > 0) @@ -404,8 +388,7 @@ elseif ($id) print ''; print ''; - } - else { + } else { /* * Confirm delete trip */ @@ -483,8 +466,7 @@ elseif ($id) if ($action == 'classify') { $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } - else { + } else { $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0); } print ''; @@ -518,8 +500,7 @@ elseif ($id) if ($user->rights->deplacement->creer) { print ''.$langs->trans('Modify').''; - } - else { + } else { print ''.$langs->trans('Modify').''; } } @@ -529,8 +510,7 @@ elseif ($id) if ($user->rights->deplacement->creer) { print ''.$langs->trans('Validate').''; - } - else { + } else { print ''.$langs->trans('Validate').''; } } @@ -540,8 +520,7 @@ elseif ($id) if ($user->rights->deplacement->creer) { print ''.$langs->trans('ClassifyRefunded').''; - } - else { + } else { print ''.$langs->trans('ClassifyRefunded').''; } } @@ -549,15 +528,13 @@ elseif ($id) if ($user->rights->deplacement->supprimer) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } print ''; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 8051d074db5..69baf710b95 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -199,14 +199,12 @@ class Deplacement extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return $result; } - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -265,8 +263,7 @@ class Deplacement extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -309,8 +306,7 @@ class Deplacement extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -334,8 +330,7 @@ class Deplacement extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -370,30 +365,25 @@ class Deplacement extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); @@ -455,8 +445,7 @@ class Deplacement extends CommonObject $ret[$obj->code] = (($langs->trans($obj->code) != $obj->code) ? $langs->trans($obj->code) : $obj->label); $i++; } - } - else { + } else { dol_print_error($this->db); } @@ -501,8 +490,7 @@ class Deplacement extends CommonObject $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 4ad2044c0f1..889eb390ca2 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -123,8 +123,7 @@ if ($object->id) $permission = $user->rights->deplacement->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 9ed6e430c4c..0cea847f9ce 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -192,13 +192,11 @@ if ($result) $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print '
'; -} -else dol_print_error($db); +} else dol_print_error($db); print ''; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 1ebaeb5c6fa..78c1f32556d 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -196,8 +196,7 @@ if ($resql) print ""; print "\n"; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 91c6546a83c..7707cb40786 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -167,8 +167,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -293,8 +292,7 @@ print '
'; // Show graphs print '"; - } - else { + } else { print ''; } @@ -1184,12 +1166,10 @@ if ($action == 'create') print ''; print ''; print "\n"; - } - else { + } else { dol_print_error('', "Error, no invoice ".$object->id); } -} -else { +} else { /* * View mode */ @@ -1312,8 +1292,7 @@ else { if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); } } else { @@ -1333,8 +1312,7 @@ else { if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none'); } print ''; @@ -1441,8 +1419,7 @@ else { if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -1467,8 +1444,7 @@ else { } $select = 'select;'.implode(',', $list); print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); - } - else { + } else { print $object->modelpdf; } print ""; @@ -1516,13 +1492,11 @@ else { print ''; print ''; print '
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 8256aeacc5a..a0d09a11980 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -238,8 +238,7 @@ if (empty($reshook)) setEventMessages($oldinvoice->error, $oldinvoice->errors, 'errors'); $action = "create"; } - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -251,8 +250,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); exit; - } - else { + } else { $db->rollback(); $error++; @@ -298,8 +296,7 @@ if (empty($reshook)) $object->titre = GETPOST('ref', 'alpha'); // deprecated $object->title = GETPOST('ref', 'alpha'); $object->ref = $object->title; - } - else dol_print_error($db, $object->error, $object->errors); + } else dol_print_error($db, $object->error, $object->errors); } // Set bank account elseif ($action == 'setbankaccount' && $user->rights->facture->creer) @@ -354,8 +351,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -377,8 +373,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -414,18 +409,15 @@ if (empty($reshook)) { $db->commit(); $object->fetch($object->id); // Reload lines - } - else { + } else { $db->rollback(); setEventMessages($db->lasterror(), null, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($line->error, $line->errors, 'errors'); } - } - elseif ($action == 'update_extras') + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -460,8 +452,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -571,8 +562,7 @@ if (empty($reshook)) if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } - else { + } else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -595,8 +585,7 @@ if (empty($reshook)) } $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; - } - else { + } else { $desc = $prod->description; } @@ -631,8 +620,7 @@ if (empty($reshook)) $type = $prod->type; $fk_unit = $prod->fk_unit; - } - else { + } else { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); @@ -662,8 +650,7 @@ if (empty($reshook)) if ($usercanproductignorepricemin && (!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)); setEventMessages($mesg, null, 'errors'); - } - else { + } else { // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); @@ -727,17 +714,14 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } $action = ''; } } - } - - elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) + } elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) { if (!$object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -935,8 +919,7 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1131,8 +1114,7 @@ if ($action == 'create') $select = array('0'=>$langs->trans('DoNotGenerateDoc'), '1'=>$langs->trans('AutoGenerateDoc')); print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); print "
'; - } - else { + } else { if ($object->frequency > 0) { print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); - } - else { + } else { print $langs->trans("NotARecurringInvoiceTemplate"); } } @@ -1533,8 +1507,7 @@ else { if ($action == 'date_when' || $object->frequency > 0) { print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); - } - else { + } else { print $langs->trans("NextDateToExecution"); } print ''; @@ -1546,8 +1519,7 @@ else { if (!$object->isMaxNbGenReached()) { if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); - } - else { + } else { print img_info($langs->trans("MaxNumberOfGenerationReached")); } print ''; @@ -1558,16 +1530,14 @@ else { if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); - } - else { + } else { print $langs->trans("MaxPeriodNumber"); } print ''; if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max : '', $object, $user->rights->facture->creer); - } - else { + } else { print ''; } print ''; @@ -1602,8 +1572,7 @@ else { } print ''; print ''; - } - else { + } else { print ''; } @@ -1704,18 +1673,15 @@ else { if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { print ''; - } - else { + } else { if (empty($object->frequency) || $object->date_when <= $today) { print ''; - } - else { + } else { print ''; } } - } - else { + } else { print ''; } } @@ -1725,8 +1691,7 @@ else { if (empty($object->suspended)) { print ''; - } - else { + } else { print ''; } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 68b1a6e91df..677701b9970 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -335,32 +335,24 @@ if (empty($reshook)) } } } - } - - elseif ($action == 'set_thirdparty' && $usercancreate) + } elseif ($action == 'set_thirdparty' && $usercancreate) { $object->fetch($id); $object->setValueFrom('fk_soc', $socid, '', null, 'int', '', $user, 'BILL_MODIFY'); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit(); - } - - elseif ($action == 'classin' && $usercancreate) + } elseif ($action == 'classin' && $usercancreate) { $object->fetch($id); $object->setProject($_POST['projectid']); - } - - elseif ($action == 'setmode' && $usercancreate) + } elseif ($action == 'setmode' && $usercancreate) { $object->fetch($id); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) dol_print_error($db, $object->error); - } - - elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer) + } elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer) { $object->fetch($id); $object->retained_warranty_fk_cond_reglement = 0; // To clean property @@ -373,17 +365,13 @@ if (empty($reshook)) if ($object->retained_warranty_date_limit < $object->date) $object->retained_warranty_date_limit = $object->date; $result = $object->update($user); if ($result < 0) dol_print_error($db, $object->error); - } - - elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer) + } elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer) { $object->fetch($id); $result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float')); if ($result < 0) dol_print_error($db, $object->error); - } - - elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer) + } elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer) { $object->fetch($id); $result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float')); @@ -400,9 +388,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); - } - - elseif ($action == 'setinvoicedate' && $usercancreate) + } elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; @@ -421,9 +407,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($action == 'setdate_pointoftax' && $usercancreate) + } elseif ($action == 'setdate_pointoftax' && $usercancreate) { $object->fetch($id); $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -432,9 +416,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($action == 'setconditions' && $usercancreate) + } elseif ($action == 'setconditions' && $usercancreate) { $object->fetch($id); $object->cond_reglement_code = 0; // To clean property @@ -450,9 +432,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($action == 'setpaymentterm' && $usercancreate) + } elseif ($action == 'setpaymentterm' && $usercancreate) { $object->fetch($id); $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']); @@ -464,9 +444,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($action == 'setrevenuestamp' && $usercancreate) + } elseif ($action == 'setrevenuestamp' && $usercancreate) { $object->fetch($id); $object->revenuestamp = GETPOST('revenuestamp'); @@ -506,15 +484,11 @@ if (empty($reshook)) elseif ($action == 'setbankaccount' && $usercancreate) { $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } - - elseif ($action == 'setremisepercent' && $usercancreate) + } elseif ($action == 'setremisepercent' && $usercancreate) { $object->fetch($id); $result = $object->set_remise($user, $_POST['remise_percent']); - } - - elseif ($action == "setabsolutediscount" && $usercancreate) + } elseif ($action == "setabsolutediscount" && $usercancreate) { // POST[remise_id] or POST[remise_id_for_payment] @@ -570,15 +544,11 @@ if (empty($reshook)) $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setref' && $usercancreate) + } elseif ($action == 'setref' && $usercancreate) { $object->fetch($id); $object->setValueFrom('ref', GETPOST('ref'), '', null, '', '', $user, 'BILL_MODIFY'); - } - - elseif ($action == 'setref_client' && $usercancreate) + } elseif ($action == 'setref_client' && $usercancreate) { $object->fetch($id); $object->set_ref_client(GETPOST('ref_client')); @@ -618,8 +588,7 @@ if (empty($reshook)) } } } - } - else { + } else { //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); if ($key == 'EMAIL') { @@ -694,8 +663,7 @@ if (empty($reshook)) $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { if (count($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, $object->errors, 'errors'); } @@ -969,16 +937,14 @@ if (empty($reshook)) if ($result >= 0) { $db->commit(); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } else { $db->commit(); } - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } @@ -1171,8 +1137,7 @@ if (empty($reshook)) { $searchPreviousInvoice = false; // find, exit; break; - } - else { + } else { $lineIndex--; // go to previous invoice in cycle } } @@ -1360,8 +1325,7 @@ if (empty($reshook)) if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) { $object->retained_warranty = GETPOST('retained_warranty', 'int'); $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - } - else { + } else { $object->retained_warranty = 0; $object->retained_warranty_fk_cond_reglement = 0; } @@ -1464,13 +1428,11 @@ if (empty($reshook)) $amount_ttc_diff += $am; $amountdeposit[$tva] += $am / (1 + $tva / 100); // Convert into HT for the addline } - } - else { + } else { if ($typeamount == 'amount') { $amountdeposit[0] = $valuedeposit; - } - elseif ($typeamount == 'variable') + } elseif ($typeamount == 'variable') { if ($result > 0) { @@ -1718,8 +1680,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } - else { // If some invoice's lines coming from page + } else { // If some invoice's lines coming from page $id = $object->create($user); for ($i = 1; $i <= $NBLINES; $i++) { @@ -1845,8 +1806,7 @@ if (empty($reshook)) if ($id <= 0) { $mesg = $object->error; - } - else { + } else { $nextSituationInvoice = new Facture($db); $nextSituationInvoice->fetch($id); @@ -1886,8 +1846,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit(); - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -1912,8 +1871,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -1960,8 +1918,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors'); } $error++; - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; } @@ -1987,8 +1944,7 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } - else { + } else { setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error++; } @@ -2052,8 +2008,7 @@ if (empty($reshook)) if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } - else { + } else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -2220,9 +2175,7 @@ if (empty($reshook)) $action = ''; } } - } - - elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) + } elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) { if (!$object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -2279,16 +2232,14 @@ if (empty($reshook)) setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; - } - elseif (GETPOST('progress') < $line->situation_percent) // TODO : use a modified $line->get_prev_progress($object->id) result + } elseif (GETPOST('progress') < $line->situation_percent) // TODO : use a modified $line->get_prev_progress($object->id) result { $mesg = $langs->trans("CantBeLessThanMinPercent"); setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; } - } - elseif (GETPOST('progress') < $percent) + } elseif (GETPOST('progress') < $percent) { $mesg = '
'.$langs->trans("CantBeLessThanMinPercent").'
'; setEventMessages($mesg, null, 'warnings'); @@ -2343,8 +2294,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors'); } $error++; - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; } @@ -2429,9 +2379,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice + } elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice { if (!$object->fetch($id) > 0) dol_print_error($db); if (GETPOST('all_progress') != "") @@ -2447,9 +2395,7 @@ if (empty($reshook)) } else $object->update_percent($line, $_POST['all_progress']); } } - } - - elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { + } elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page exit(); } @@ -2524,8 +2470,7 @@ if (empty($reshook)) { $searchPreviousInvoice = false; // find, exit; break; - } - else { + } else { $lineIndex--; // go to previous invoice in cycle } } @@ -2552,16 +2497,13 @@ if (empty($reshook)) { setEventMessages($langs->trans('Updated'), '', 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - } - else { + } else { setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors'); } - } - else { + } else { setEventMessages($langs->trans('ErrorOutingSituationInvoiceOnUpdate'), array(), 'errors'); } - } - else { + } else { setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors'); } } @@ -2583,8 +2525,7 @@ if (empty($reshook)) { dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'OrderLine'; - } - elseif ($fromElement == 'propal') + } elseif ($fromElement == 'propal') { dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'PropaleLigne'; @@ -2626,8 +2567,7 @@ if (empty($reshook)) $array_options = $originLine->array_options; if ($object->type == Facture::TYPE_SITUATION) { $situation_percent = 0; - } - else { + } else { $situation_percent = 100; } $fk_prev_id = ''; @@ -2641,8 +2581,7 @@ if (empty($reshook)) } else { $error++; } - } - else { + } else { $error++; } } @@ -2855,8 +2794,7 @@ if ($action == 'create') //Replicate extrafields $expesrc->fetch_optionals(); $object->array_options = $expesrc->array_options; - } - else { + } else { $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); @@ -2874,8 +2812,7 @@ if ($action == 'create') $object->array_options = $objectsrc->array_options; } } - } - else { + } else { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; $fk_account = $soc->fk_account; @@ -2957,8 +2894,7 @@ if ($action == 'create') print ')'; print ''; print ''."\n"; - } - else { + } else { print ''.$langs->trans('Customer').''; print ''; print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); @@ -3181,8 +3117,7 @@ if ($action == 'create') print $desc; print '
'; } - } - else { + } else { if (!empty($conf->global->INVOICE_USE_SITUATION)) { print '
'; @@ -3287,8 +3222,7 @@ if ($action == 'create') print '
'; } - } - else { + } else { print '
'; if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = ' '; else $tmp = ' '; @@ -3655,8 +3589,7 @@ if ($action == 'create') } print '
'; -} -elseif ($id > 0 || !empty($ref)) +} elseif ($id > 0 || !empty($ref)) { /* * Show object in view mode @@ -3765,8 +3698,7 @@ elseif ($id > 0 || !empty($ref)) array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); - } - else { + } else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); } } else { @@ -4247,8 +4179,7 @@ elseif ($id > 0 || !empty($ref)) if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT'); } print ''; @@ -4311,8 +4242,7 @@ elseif ($id > 0 || !empty($ref)) if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -4333,8 +4263,7 @@ elseif ($id > 0 || !empty($ref)) if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -4368,8 +4297,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; print ''; - } - else { + } else { print price($object->retained_warranty).'%'; } print ''; @@ -4402,8 +4330,7 @@ elseif ($id > 0 || !empty($ref)) $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print ''; print ''; - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); if (!$displayWarranty) { print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); @@ -4436,8 +4363,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; print ''; - } - else { + } else { print dol_print_date($object->retained_warranty_date_limit, 'day'); } print ''; @@ -4894,8 +4820,7 @@ elseif ($id > 0 || !empty($ref)) if ($object->type == Facture::TYPE_SITUATION) { $retainedWarranty = $total_global_ttc * $object->retained_warranty / 100; - } - else { + } else { // Because one day retained warranty could be used on standard invoices $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100; } @@ -4910,8 +4835,7 @@ elseif ($id > 0 || !empty($ref)) print !empty($object->retained_warranty_date_limit) ? ' '.$langs->trans("ToPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; print ' :'.price($retainedWarranty).' '; } - } - else // Credit note + } else // Credit note { $cssforamountpaymentcomplete = 'amountpaymentneutral'; @@ -5084,8 +5008,7 @@ elseif ($id > 0 || !empty($ref)) print ''.$langs->trans('Modify').''; } } - } - else { + } else { print ''.$langs->trans('Modify').''; } } @@ -5142,12 +5065,10 @@ elseif ($id > 0 || !empty($ref)) } else { print ''.$langs->trans('MakeWithdrawRequest').''; } - } - else { + } else { //print ''.$langs->trans("MakeWithdrawRequest").''; } - } - else { + } else { //print ''.$langs->trans("MakeWithdrawRequest").''; } } @@ -5181,8 +5102,7 @@ elseif ($id > 0 || !empty($ref)) if ($resteapayer == 0) { print ''.$langs->trans('DoPaymentBack').''; - } - else { + } else { print ''.$langs->trans('DoPaymentBack').''; } } @@ -5221,15 +5141,13 @@ elseif ($id > 0 || !empty($ref)) { // If one payment or one credit note was linked to this invoice print ''.$langs->trans('ClassifyPaidPartially').''; - } - else { + } else { if (empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED)) { if ($objectidnext) { print ''.$langs->trans('ClassifyCanceled').''; - } - else { + } else { print ''.$langs->trans('ClassifyCanceled').''; } } @@ -5291,8 +5209,7 @@ elseif ($id > 0 || !empty($ref)) if (($object->total_ttc - $totalcreditnotes) == 0) { print ''.$langs->trans("RemoveSituationFromCycle").''; - } - else { + } else { print ''.$langs->trans("RemoveSituationFromCycle").''; } } @@ -5315,25 +5232,19 @@ elseif ($id > 0 || !empty($ref)) //var_dump($isErasable); if ($isErasable == -4) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable == -3) { + } elseif ($isErasable == -3) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable == -2) { + } elseif ($isErasable == -2) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable == -1) { + } elseif ($isErasable == -1) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable <= 0) // Any other cases + } elseif ($isErasable <= 0) // Any other cases { print ''.$langs->trans('Delete').''; - } - elseif ($objectidnext) + } elseif ($objectidnext) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } else { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index d56d1b5cfef..c1ed5b809da 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -244,8 +244,7 @@ class Invoices extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve invoice list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -548,8 +547,7 @@ class Invoices extends DolibarrApi $updateRes = $this->invoice->deleteline($lineid); if ($updateRes > 0) { return $this->get($id); - } - else { + } else { throw new RestException(405, $this->invoice->error); } } @@ -1040,14 +1038,11 @@ class Invoices extends DolibarrApi $discount = new DiscountAbsolute($this->db); if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { $discount->description = '(CREDIT_NOTE)'; - } - elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) { + } elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) { $discount->description = '(DEPOSIT)'; - } - elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) { + } elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) { $discount->description = '(EXCESS RECEIVED)'; - } - else { + } else { throw new RestException(500, 'Cant convert to reduc an Invoice of this type'); } @@ -1123,16 +1118,14 @@ class Invoices extends DolibarrApi if ($result >= 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); throw new RestException(500, 'Could not set paid'); } } else { $this->db->commit(); } - } - else { + } else { $this->db->rollback(); throw new RestException(500, 'Discount creation error'); } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 904f59ea432..581e63be08a 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -336,8 +336,7 @@ class FactureRec extends CommonInvoice if ($result_insert < 0) { $error++; - } - else { + } else { $objectline = new FactureLigneRec($this->db); if ($objectline->fetch($result_insert)) { @@ -377,8 +376,7 @@ class FactureRec extends CommonInvoice $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -394,19 +392,16 @@ class FactureRec extends CommonInvoice if ($error) { $this->db->rollback(); - } - else { + } else { $this->db->commit(); return $this->id; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -1; } @@ -457,8 +452,7 @@ class FactureRec extends CommonInvoice } $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -580,14 +574,12 @@ class FactureRec extends CommonInvoice return -3; } return 1; - } - else { + } else { $this->error = 'Bill with id '.$rowid.' or ref '.$ref.' not found sql='.$sql; dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR); return -2; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -716,8 +708,7 @@ class FactureRec extends CommonInvoice $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } @@ -759,13 +750,11 @@ class FactureRec extends CommonInvoice // Delete extrafields $res = $this->deleteExtraFields(); if ($res < 0) $error = -4; - } - else { + } else { $this->error = $this->db->lasterror(); $error = -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $error = -2; } @@ -774,8 +763,7 @@ class FactureRec extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return $error; } @@ -850,8 +838,7 @@ class FactureRec extends CommonInvoice if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -958,8 +945,7 @@ class FactureRec extends CommonInvoice $this->id = $facid; $this->update_price(); return $lineId; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1033,8 +1019,7 @@ class FactureRec extends CommonInvoice if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -1118,8 +1103,7 @@ class FactureRec extends CommonInvoice $this->id = $facid; $this->update_price(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1273,8 +1257,7 @@ class FactureRec extends CommonInvoice $error++; } } - } - else { + } else { $error++; $this->error = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n"; $this->errors[] = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity; @@ -1287,8 +1270,7 @@ class FactureRec extends CommonInvoice dol_syslog("createRecurringInvoices Process invoice template ".$facturerec->ref." is finished with a success generation"); $nb_create++; $this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n"; - } - else { + } else { $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } @@ -1306,8 +1288,7 @@ class FactureRec extends CommonInvoice } $conf->entity = $saventity; // Restore entity context - } - else dol_print_error($db); + } else dol_print_error($db); $this->output = trim($this->output); @@ -1413,66 +1394,54 @@ class FactureRec extends CommonInvoice { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans("Draft"); } } - } - elseif ($mode == 1) + } elseif ($mode == 1) { $prefix = 'Short'; if ($recur) { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans("Draft"); } } - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($recur) { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } } - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($recur) { @@ -1480,24 +1449,20 @@ class FactureRec extends CommonInvoice if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } } - } - elseif ($mode == 4) + } elseif ($mode == 4) { $prefix = ''; if ($recur) @@ -1505,24 +1470,20 @@ class FactureRec extends CommonInvoice if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } } - } - elseif ($mode == 5 || $mode == 6) + } elseif ($mode == 5 || $mode == 6) { $prefix = ''; if ($mode == 5) $prefix = 'Short'; @@ -1531,18 +1492,15 @@ class FactureRec extends CommonInvoice if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } @@ -1631,16 +1589,14 @@ class FactureRec extends CommonInvoice $line->total_ht = -100; $line->total_ttc = -119.6; $line->total_tva = -19.6; - } - elseif ($xnbp == 2) // UP is negative (free line) + } elseif ($xnbp == 2) // UP is negative (free line) { $line->subprice = -100; $line->total_ht = -100; $line->total_ttc = -119.6; $line->total_tva = -19.6; $line->remise_percent = 0; - } - elseif ($xnbp == 3) // Discount is 50% (product line) + } elseif ($xnbp == 3) // Discount is 50% (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -1648,8 +1604,7 @@ class FactureRec extends CommonInvoice $line->total_ttc = 59.8; $line->total_tva = 9.8; $line->remise_percent = 50; - } - else // (product line) + } else // (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -1738,8 +1693,7 @@ class FactureRec extends CommonInvoice $this->frequency = $frequency; if (!empty($unit)) $this->unit_frequency = $unit; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1770,8 +1724,7 @@ class FactureRec extends CommonInvoice $this->date_when = $date; if ($increment_nb_gen_done > 0) $this->nb_gen_done++; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1802,8 +1755,7 @@ class FactureRec extends CommonInvoice { $this->nb_gen_max = $nb; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1832,8 +1784,7 @@ class FactureRec extends CommonInvoice { $this->auto_validate = $validate; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1862,8 +1813,7 @@ class FactureRec extends CommonInvoice { $this->generate_pdf = $validate; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1892,8 +1842,7 @@ class FactureRec extends CommonInvoice { $this->modelpdf = $model; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2038,8 +1987,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } @@ -2119,8 +2067,7 @@ class FactureLigneRec extends CommonInvoiceLine } $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 55adb5eb138..28f0883bb90 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -678,8 +678,7 @@ class Facture extends CommonInvoice $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -726,8 +725,7 @@ class Facture extends CommonInvoice //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } - } - else dol_print_error($resqlcontact); + } else dol_print_error($resqlcontact); } /* @@ -787,8 +785,7 @@ class Facture extends CommonInvoice break; } } - } - elseif (!$error && empty($this->fac_rec)) // If this->lines is an array of invoice line arrays + } elseif (!$error && empty($this->fac_rec)) // If this->lines is an array of invoice line arrays { $fk_parent_line = 0; @@ -987,25 +984,21 @@ class Facture extends CommonInvoice { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -4; } - } - else { + } else { $this->error = $langs->trans('FailedToUpdatePrice'); $this->db->rollback(); return -3; } - } - else { + } else { dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -1090,8 +1083,7 @@ class Facture extends CommonInvoice { $this->error = $facture->error; $this->errors = $facture->errors; - } - elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) + } elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { $this->fetchObjectLinked('', '', $this->id, 'facture'); @@ -1236,8 +1228,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1362,10 +1353,8 @@ class Facture extends CommonInvoice if (!$error) { return 1; - } - else return -1; - } - else return -1; + } else return -1; + } else return -1; } /** @@ -1640,14 +1629,12 @@ class Facture extends CommonInvoice return -3; } return 1; - } - else { + } else { $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1768,8 +1755,7 @@ class Facture extends CommonInvoice } $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -1807,8 +1793,7 @@ class Facture extends CommonInvoice ) { $this->tab_previous_situation_invoice[] = $invoice; - } - else { + } else { $this->tab_next_situation_invoice[] = $invoice; } } @@ -1924,8 +1909,7 @@ class Facture extends CommonInvoice } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -2011,20 +1995,17 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { $this->error = $facligne->error; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $facligne->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -3; } @@ -2080,8 +2061,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2245,20 +2225,17 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -6; } - } - else { + } else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -4; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -2303,8 +2280,7 @@ class Facture extends CommonInvoice $result = $this->call_trigger('BILL_PAYED', $user); if ($result < 0) $error++; // End call triggers - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -2313,13 +2289,11 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { return 0; } } @@ -2355,8 +2329,7 @@ class Facture extends CommonInvoice $result = $this->call_trigger('BILL_UNPAYED', $user); if ($result < 0) $error++; // End call triggers - } - else { + } else { $error++; $this->error = $this->db->error(); dol_print_error($this->db); @@ -2366,8 +2339,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2422,14 +2394,12 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -2; @@ -2538,8 +2508,7 @@ class Facture extends CommonInvoice if ($force_number) { $num = $force_number; - } - elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life + } elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life { if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date { @@ -2547,8 +2516,7 @@ class Facture extends CommonInvoice $this->date_lim_reglement = $this->calculate_date_lim_reglement(); } $num = $this->getNextNumRef($this->thirdparty); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -2777,8 +2745,7 @@ class Facture extends CommonInvoice $this->setFinal($user); } } - } - else { + } else { $error++; } @@ -2786,8 +2753,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2914,13 +2880,11 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -3039,8 +3003,7 @@ class Facture extends CommonInvoice if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -3181,20 +3144,17 @@ class Facture extends CommonInvoice { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -2; } - } - else { + } else { dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -3409,14 +3369,12 @@ class Facture extends CommonInvoice $this->update_price(1); $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = "Invoice statut makes operation forbidden"; return -2; } @@ -3536,14 +3494,12 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $line->error; return -1; @@ -3601,8 +3557,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3669,8 +3624,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3828,8 +3782,7 @@ class Facture extends CommonInvoice $this->date_closing = $this->db->jdate($obj->dateclosing); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3887,12 +3840,10 @@ class Facture extends CommonInvoice if ($shortlist == 1) { $ga[$obj->fid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->fid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->fid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -3901,8 +3852,7 @@ class Facture extends CommonInvoice } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3950,8 +3900,7 @@ class Facture extends CommonInvoice } //print_r($return); return $return; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3997,8 +3946,7 @@ class Facture extends CommonInvoice $sqlSit .= " GROUP BY fs.situation_cycle_ref"; $sqlSit .= " ORDER BY fs.situation_counter"; $sql .= " AND ( f.type != ".self::TYPE_SITUATION." OR f.rowid IN (".$sqlSit.") )"; // Type non 5 si facture non avoir - } - else { + } else { $sql .= " AND f.type != ".self::TYPE_SITUATION; // Type non 5 si facture non avoir } @@ -4023,8 +3971,7 @@ class Facture extends CommonInvoice } return $return; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -4100,8 +4047,7 @@ class Facture extends CommonInvoice dol_syslog(get_class($this).'::demandeprelevement Erreur'); $error++; } - } - else { + } else { $this->error = 'WithdrawRequestErrorNilAmount'; dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount'); $error++; @@ -4119,20 +4065,17 @@ class Facture extends CommonInvoice if ($error) return -1; return 1; - } - else { + } else { $this->error = "A request already exists"; dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours'); return 0; } - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::demandeprelevement Erreur -2'); return -2; } - } - else { + } else { $this->error = "Status of invoice does not allow this"; dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id"); return -3; @@ -4156,8 +4099,7 @@ class Facture extends CommonInvoice if ($this->db->query($sql)) { return 0; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error); return -1; @@ -4222,8 +4164,7 @@ class Facture extends CommonInvoice } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4343,8 +4284,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = -200; $line->multicurrency_total_ttc = -239.2; $line->multicurrency_total_tva = -39.2; - } - elseif ($xnbp == 2) // UP is negative (free line) + } elseif ($xnbp == 2) // UP is negative (free line) { $line->subprice = -100; $line->total_ht = -100; @@ -4354,8 +4294,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = -200; $line->multicurrency_total_ttc = -239.2; $line->multicurrency_total_tva = -39.2; - } - elseif ($xnbp == 3) // Discount is 50% (product line) + } elseif ($xnbp == 3) // Discount is 50% (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -4366,8 +4305,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc = 119.6; $line->multicurrency_total_tva = 19.6; $line->remise_percent = 50; - } - else // (product line) + } else // (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -4453,8 +4391,7 @@ class Facture extends CommonInvoice } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4615,8 +4552,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -4701,12 +4637,10 @@ class Facture extends CommonInvoice if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) { $hasDelay = 1; - } - elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) + } elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) { $hasDelay = 1; - } - else { + } else { $hasDelay = 0; } } @@ -4792,12 +4726,10 @@ class Facture extends CommonInvoice $total2BillWT += $this->total_ttc; $retainedWarrantyAmount = $total2BillWT * $this->retained_warranty / 100; - } - else { + } else { return -1; } - } - else { + } else { // Because one day retained warranty could be used on standard invoices $retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100; } @@ -4833,14 +4765,12 @@ class Facture extends CommonInvoice { $this->retained_warranty = floatval($value); return 1; - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible'); $this->error = 'Status of the object is incompatible '.$this->statut; return -2; @@ -4874,14 +4804,12 @@ class Facture extends CommonInvoice { $this->retained_warranty_date_limit = $timestamp; return 1; - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible'); $this->error = 'Status of the object is incompatible '.$this->statut; return -2; @@ -5062,8 +4990,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -5116,8 +5043,7 @@ class FactureLigne extends CommonInvoiceLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -5233,8 +5159,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->rollback(); return -3; } - } - else { + } else { $result = $discount->link_to_invoice($this->rowid, 0); if ($result < 0) { @@ -5244,15 +5169,13 @@ class FactureLigne extends CommonInvoiceLine return -3; } } - } - else { + } else { $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $discount->error; dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); @@ -5274,8 +5197,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -5328,8 +5250,7 @@ class FactureLigne extends CommonInvoiceLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -5407,8 +5328,7 @@ class FactureLigne extends CommonInvoiceLine } $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -5450,8 +5370,7 @@ class FactureLigne extends CommonInvoiceLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -5491,8 +5410,7 @@ class FactureLigne extends CommonInvoiceLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 1fddf20b023..9888bd23d13 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -145,8 +145,7 @@ class PaymentTerm // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -201,8 +200,7 @@ class PaymentTerm // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -237,8 +235,7 @@ class PaymentTerm // extends CommonObject } $this->db->free($resql); return $ret; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -302,8 +299,7 @@ class PaymentTerm // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -341,8 +337,7 @@ class PaymentTerm // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -391,8 +386,7 @@ class PaymentTerm // extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 77ff0f813c3..44954d863e5 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -69,14 +69,12 @@ if ($action == 'addcontact' && $user->rights->facture->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -88,8 +86,7 @@ elseif ($action == 'swapstatut' && $user->rights->facture->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -104,8 +101,7 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -204,8 +200,7 @@ if ($id > 0 || !empty($ref)) $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } - } - else { + } else { // Record not found print "ErrorRecordNotFound"; } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 7e95b92cc3d..ed9b032ae90 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -181,12 +181,10 @@ if ($id > 0 || !empty($ref)) $permtoedit = $user->rights->facture->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 8275dbcf450..dfda4a5b16d 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -609,8 +609,7 @@ if ($resql) if (!$invoicerectmp->isMaxNbGenReached()) { if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); - } - else { + } else { print img_info($langs->trans("MaxNumberOfGenerationReached")); } print '
'; @@ -653,17 +652,14 @@ if ($resql) if ($invoicerectmp->isMaxNbGenReached()) { print $langs->trans("MaxNumberOfGenerationReached"); - } - elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) + } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print ''; print $langs->trans("CreateBill").''; - } - else { + } else { print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); } - } - else { + } else { print " "; } if (!$i) $totalarray['nbfield']++; @@ -673,8 +669,7 @@ if ($resql) $i++; } - } - else { + } else { $colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } print ''.$langs->trans("NoRecordFound").''; @@ -689,8 +684,7 @@ if ($resql) print ""; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 7b3025db810..c21d19ad538 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -304,8 +304,7 @@ if ($massaction == 'makepayment'){ header('Location: '.$loc); exit; -} -elseif ($massaction == 'withdrawrequest') +} elseif ($massaction == 'withdrawrequest') { $langs->load("withdrawals"); @@ -313,8 +312,7 @@ elseif ($massaction == 'withdrawrequest') { $error++; setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); - } - else { + } else { //Checking error $error = 0; @@ -362,12 +360,10 @@ elseif ($massaction == 'withdrawrequest') if ($numprlv > 0) { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings'); - } - elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code != 'PRE') { + } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code != 'PRE') { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors'); - } - else { + } else { $listofbills[] = $objecttmp; // $listofbills will only contains invoices with good payment method and no request already done } } @@ -385,8 +381,7 @@ elseif ($massaction == 'withdrawrequest') { $db->commit(); $nbwithdrawrequestok++; - } - else { + } else { $db->rollback(); setEventMessages($aBill->error, $aBill->errors, 'errors'); } @@ -513,8 +508,7 @@ if ($search_status != '-1' && $search_status != '') if ($search_status == '1') $sql .= " AND f.fk_statut = 1"; // unpayed if ($search_status == '2') $sql .= " AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) if ($search_status == '3') $sql .= " AND f.fk_statut = 3"; // abandonned - } - else { + } else { $sql .= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } @@ -560,8 +554,7 @@ if (!$sall) if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); } -} -else { +} else { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } @@ -670,8 +663,7 @@ if ($resql) if ($user->rights->facture->supprimer) { if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) { $arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft"); - } - elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation + } elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation $arrayofmassactions['predelete'] = $langs->trans("Delete"); } } @@ -1215,8 +1207,7 @@ if ($resql) if ($contextpage == 'poslist') { print $obj->ref; - } - else { + } else { print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); } @@ -1311,8 +1302,7 @@ if ($resql) if ($contextpage == 'poslist') { print $thirdpartystatic->name; - } - else { + } else { print $thirdpartystatic->getNomUrl(1, 'customer'); } print ''; @@ -1613,8 +1603,7 @@ if ($resql) $title = ''; print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 109231a240d..7cbe336e126 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -86,8 +86,7 @@ if (empty($reshook)) $db->commit(); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -291,12 +290,10 @@ if ($object->id > 0) if ($action == 'editinvoicedate') { $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate'); - } - else { + } else { print dol_print_date($object->date, 'daytext'); } - } - else { + } else { print dol_print_date($object->date, 'daytext'); } print ''; @@ -315,12 +312,10 @@ if ($object->id > 0) if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); } - } - else { + } else { print ' '; } print ''; @@ -338,15 +333,13 @@ if ($object->id > 0) if ($action == 'editpaymentterm') { $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm'); - } - else { + } else { print dol_print_date($object->date_lim_reglement, 'daytext'); if ($object->hasDelay()) { print img_warning($langs->trans('Late')); } } - } - else { + } else { print ' '; } print ''; @@ -362,8 +355,7 @@ if ($object->id > 0) if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id'); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print ''; @@ -380,8 +372,7 @@ if ($object->id > 0) if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -493,8 +484,7 @@ if ($object->id > 0) { $num = $db->num_rows($result_sql); $numopen = $num; - } - else { + } else { dol_print_error($db); } @@ -510,8 +500,7 @@ if ($object->id > 0) { $obj = $db->fetch_object($result_sql); if ($obj) $pending = $obj->amount; - } - else { + } else { dol_print_error($db); } @@ -538,22 +527,18 @@ if ($object->id > 0) print ''; print ''; print ''; - } - else { + } else { print ''.$langs->trans("MakeWithdrawRequest").''; } - } - else { + } else { print ''.$langs->trans("MakeWithdrawRequest").''; } - } - else { + } else { if ($num == 0) { if ($object->statut > Facture::STATUS_DRAFT) print ''.$langs->trans("MakeWithdrawRequest").''; else print ''.$langs->trans("MakeWithdrawRequest").''; - } - else print ''.$langs->trans("MakeWithdrawRequest").''; + } else print ''.$langs->trans("MakeWithdrawRequest").''; } print "

\n"; @@ -620,8 +605,7 @@ if ($object->id > 0) } $db->free($result_sql); - } - else { + } else { dol_print_error($db); } @@ -681,8 +665,7 @@ if ($object->id > 0) print ''.$langs->trans("None").''; $db->free($result); - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index d0c7eacffc6..82ba8a33467 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -180,8 +180,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -368,8 +367,7 @@ print '
'; // Show graphs print ''; print ''; print ''; - } - else { + } else { print ''; } print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 571a00d6b47..ef35c03eb54 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -78,8 +78,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) // If not abandonned $total = $total + $sign * $objectlink->total_ht; echo price($objectlink->total_ht); - } - else { + } else { echo ''.price($objectlink->total_ht).''; } } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 2efe20a2fc5..d5daadcb557 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -214,14 +214,12 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'.$langs->trans("Total").''.price($tot_ttc).'
'.$langs->trans("NoInvoice").'

"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -300,14 +298,12 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''.$langs->trans("Total").''; print ''.price($tot_ttc).''; print ''; - } - else { + } else { print ''.$langs->trans("NoInvoice").''; } print "

"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -424,16 +420,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $i++; } - } - else { + } else { $colspan = 5; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -523,15 +517,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $totalam += $obj->am; $i++; } - } - else { + } else { $colspan = 5; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; - } - else { + } else { dol_print_error($db); } } @@ -600,13 +592,11 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire) $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print '
'; - } - else dol_print_error($db); + } else dol_print_error($db); } /** @@ -677,14 +667,12 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print ' '; print ''; - } - else { + } else { print ''.$langs->trans("None").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -804,8 +792,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user print '
'; } $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -927,16 +914,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print ''.price($totalam).''; print ' '; print ''; - } - else { + } else { $colspan = 6; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -1035,15 +1020,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''.price($totalam).''; print ' '; print ''; - } - else { + } else { $colspan = 6; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 91d855d4454..78ef32072d6 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -168,8 +168,7 @@ if ($result) $i++; } -} -else { +} else { dol_print_error($db); } @@ -238,8 +237,7 @@ foreach ($tabfac as $key => $val) { print ''.($mt < 0 ?price(-$mt) : '').""; print ''.($mt >= 0 ?price($mt) : '').""; - } - else { + } else { print ''.($mt >= 0 ?price($mt) : '').""; print ''.($mt < 0 ?price(-$mt) : '').""; } diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index a7eb09de31a..bd44f6c47cc 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -114,8 +114,7 @@ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.fk_statut > 0"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")"; -} -else { +} else { $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")"; } @@ -195,8 +194,7 @@ if ($result) $tabcompany[$obj->rowid] = array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client); $i++; } -} -else { +} else { dol_print_error($db); } @@ -268,8 +266,7 @@ foreach ($tabfac as $key => $val) { print ''.($mt >= 0 ?price($mt) : '').""; print ''.($mt < 0 ?price(-$mt) : '').""; - } - else { + } else { print ''.($mt < 0 ?price(-$mt) : '').""; print ''.($mt >= 0 ?price($mt) : '').""; } diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index e5a20b5486b..cd7bbfd11c2 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -80,8 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $db->commit(); header("Location: list.php?localTaxType=".$lttype); exit; - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $_GET["action"] = "create"; @@ -112,19 +111,16 @@ if ($action == 'delete') $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/localtax/list.php?localTaxType='.$object->ltt); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; setEventMessages($mesg, null, 'errors'); } @@ -285,8 +281,7 @@ if ($id) if ($object->rappro == 0) { print ''.$langs->trans("Delete").''; - } - else { + } else { print ''.$langs->trans("Delete").''; } print ""; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 59adc220c8f..1dfeb0b8930 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -137,13 +137,11 @@ class Localtax extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -204,8 +202,7 @@ class Localtax extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -267,8 +264,7 @@ class Localtax extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -373,13 +369,11 @@ class Localtax extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -412,13 +406,11 @@ class Localtax extends CommonObject $ret = $obj->total_localtax; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -453,13 +445,11 @@ class Localtax extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -537,8 +527,7 @@ class Localtax extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $ok = 0; } @@ -556,19 +545,16 @@ class Localtax extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -590,8 +576,7 @@ class Localtax extends CommonObject $result = $this->db->query($sql); if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 12112766c24..10111dd7faa 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -53,15 +53,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q"); if (empty($q)) { - if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } - else { + if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } else { $date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -199,8 +197,7 @@ if ($calc == 0 || $calc == 2) if ($coll->assuj == '1') { $intra = $langs->trans('Unknown'); - } - else { + } else { $intra = ''; } } @@ -226,8 +223,7 @@ if ($calc == 0 || $calc == 2) print ''.price($totalamount).''; print ''.price($total).''; print ''; - } - else { + } else { $langs->load("errors"); if ($coll_list == -1) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; @@ -269,8 +265,7 @@ if ($calc == 0 || $calc == 1) { if ($coll->assuj == '1') { $intra = $langs->trans('Unknown'); - } - else { + } else { $intra = ''; } } @@ -298,8 +293,7 @@ if ($calc == 0 || $calc == 1) { print ''; print ''; - } - else { + } else { $langs->load("errors"); if ($coll_list == -1) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index b8a906ac818..8e810495ff4 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -52,13 +52,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -150,8 +148,7 @@ function pt($db, $sql, $date) $amountpaid = 0; $previousmode = ''; $previousmonth = ''; - } - else { + } else { $previousmode = $obj->mode; $previousmonth = $obj->dm; } @@ -179,8 +176,7 @@ function pt($db, $sql, $date) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -385,8 +381,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc 'localtax2' =>$x_paye[$my_paye_rate]['localtax2_list'][$id], //'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { //$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; //$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 58ec8cb090e..a8b37c3ef93 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -95,8 +95,7 @@ if ($result) print ""; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 45d34f10cce..058f6871c7d 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -63,15 +63,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { $date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -221,8 +219,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) elseif ($x_coll == -2) print ''.$langs->trans("FeatureNotYetAvailable").''; else print ''.$langs->trans("Error").''; -} -else { +} else { $x_both = array(); //now, from these two arrays, get another array with one rate per line @@ -368,8 +365,7 @@ else { $product_static->type = $fields['ptype']; print $product_static->getNomUrl(1); if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - } - else { + } else { if ($type) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) @@ -411,8 +407,7 @@ else { if ($type == 0) { print $langs->trans("NotUsedForGoods"); - } - else { + } else { print price($fields['payment_amount']); if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice * 100, 2).'%)'; } @@ -527,8 +522,7 @@ else { $product_static->type = $fields['ptype']; print $product_static->getNomUrl(1); if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - } - else { + } else { if ($type) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); @@ -566,8 +560,7 @@ else { if ($type == 0) { print $langs->trans("NA"); - } - else { + } else { print price(price2num($fields['payment_amount'], 'MT')); if (isset($fields['payment_amount'])) { print ' ('.round($ratiopaymentinvoice * 100, 2).'%)'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5c0f258a091..4eea16f706b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -131,8 +131,7 @@ if (empty($reshook)) } $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => $_POST[$key]); - } - elseif (substr($key, 0, 21) == 'multicurrency_amount_') + } elseif (substr($key, 0, 21) == 'multicurrency_amount_') { $cursorfacid = substr($key, 21); $multicurrency_amounts[$cursorfacid] = price2num(trim(GETPOST($key))); @@ -312,8 +311,7 @@ if (empty($reshook)) else $loc = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id; header('Location: '.$loc); exit; - } - else { + } else { $db->rollback(); } } @@ -502,8 +500,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; $form->select_comptes($accountid, 'accountid', 0, '', 2); print ''; - } - else { + } else { print ' '; } print "\n"; @@ -558,8 +555,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($facture->type != Facture::TYPE_CREDIT_NOTE) { $sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation - } - else { + } else { $sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes } // Sort invoices by date and serial number: the older one comes first @@ -662,8 +658,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print ''; - } - else { + } else { print ''; } @@ -706,8 +701,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); print ''; print ''; - } - else { + } else { print ''; print ''; } @@ -741,8 +735,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; print ''; - } - else { + } else { print ''; print ''; } @@ -797,8 +790,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie //print "\n"; } $db->free($resql); - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index f67a2e2c12a..4acfd34a53a 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -65,8 +65,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement) { $db->commit(); $action = ''; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -86,13 +85,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: list.php"); exit; } - } - else { + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); @@ -128,8 +125,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); exit; - } - else { + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); @@ -143,8 +139,7 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) if ($res === 0) { setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors'); } } @@ -157,8 +152,7 @@ if ($action == 'setdatep' && !empty($_POST['datepday'])) if ($res === 0) { setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); } } @@ -407,8 +401,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -438,8 +431,7 @@ if ($user->socid == 0 && $action == '') if (!$disable_delete) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 44a160b35e0..5c490ce3128 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -79,8 +79,7 @@ if ($action == 'setdate' && $user->rights->banque->cheque) { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -97,8 +96,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque) { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -115,8 +113,7 @@ if ($action == 'setref' && $user->rights->banque->cheque) { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -146,12 +143,10 @@ if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->che header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); $action = 'new'; } @@ -165,8 +160,7 @@ if ($action == 'remove' && $id > 0 && $_GET["lineid"] > 0 && $user->rights->banq { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -179,8 +173,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c { header("Location: index.php"); exit; - } - else { + } else { setEventMessages($paiement->error, $paiement->errors, 'errors'); } } @@ -205,8 +198,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -224,8 +216,7 @@ if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->ban //header("Location: ".DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id); //exit; $action = ''; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -252,8 +243,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { dol_print_error($db, $object->error); exit; - } - else { + } else { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc')); exit; } @@ -304,8 +294,7 @@ if ($action == 'new') $h++; print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account'); -} -else { +} else { $result = $object->fetch($id, $ref); if ($result < 0) { @@ -498,8 +487,7 @@ if ($action == 'new') if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -509,8 +497,7 @@ if ($action == 'new') if ($accountlinestatic->rowid) { print $accountlinestatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -530,15 +517,13 @@ if ($action == 'new') if ($user->rights->banque->cheque) { print ''; - } - else { + } else { print ''.$langs->trans('NewCheckDepositOn', $account_label).''; } print '
'; print ''; } -} -else { +} else { $paymentstatic = new Paiement($db); $accountlinestatic = new AccountLine($db); $accountstatic = new Account($db); @@ -572,8 +557,7 @@ else { print $form->selectDate($object->date_bordereau, 'datecreate_', '', '', '', "setdate"); print ''; print ''; - } - else { + } else { print $object->date_bordereau ? dol_print_date($object->date_bordereau, 'day') : ' '; } @@ -683,8 +667,7 @@ else { if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -694,8 +677,7 @@ else { if ($accountlinestatic->rowid) { print $accountlinestatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -718,8 +700,7 @@ else { $i++; } - } - else { + } else { print ''; print $langs->trans("None"); print ''; @@ -736,8 +717,7 @@ else { } print ""; - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 9d252a7456e..48c58dc7219 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -120,16 +120,14 @@ class RemiseCheque extends CommonObject if ($this->statut == 0) { $this->ref = "(PROV".$this->id.")"; - } - else { + } else { $this->ref = $obj->ref; } } $this->db->free($resql); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -225,8 +223,7 @@ class RemiseCheque extends CommonObject array_push($lines, $row[0]); } $this->db->free($resql); - } - else { + } else { $this->errno = -1026; dol_syslog("RemiseCheque::Create Error ".$this->errno, LOG_ERR); } @@ -266,8 +263,7 @@ class RemiseCheque extends CommonObject dol_syslog("RemiseCheque::Create Error update amount ".$this->errno, LOG_ERR); } } - } - else { + } else { $this->errno = -1; $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); @@ -284,8 +280,7 @@ class RemiseCheque extends CommonObject $this->db->commit(); dol_syslog("RemiseCheque::Create end", LOG_DEBUG); return $this->id; - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::Create end", LOG_DEBUG); return $this->errno; @@ -336,8 +331,7 @@ class RemiseCheque extends CommonObject if ($this->errno === 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)"); } @@ -379,13 +373,11 @@ class RemiseCheque extends CommonObject { $this->ref = $numref; $this->statut = 1; - } - else { + } else { $this->errno = -1029; dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); } - } - else { + } else { $this->errno = -1033; dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); } @@ -396,8 +388,7 @@ class RemiseCheque extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR); return $this->errno; @@ -479,8 +470,7 @@ class RemiseCheque extends CommonObject } return $numref; - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank")); return ""; @@ -534,8 +524,7 @@ class RemiseCheque extends CommonObject } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -573,8 +562,7 @@ class RemiseCheque extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -652,15 +640,13 @@ class RemiseCheque extends CommonObject { //$outputlangs->charset_output=$sav_charset_output; return 1; - } - else { + } else { //$outputlangs->charset_output=$sav_charset_output; dol_syslog("Error"); dol_print_error($this->db, $docmodel->error); return 0; } - } - else { + } else { $this->error = $langs->trans("ErrorFileDoesNotExists", $dir.$file); return -1; } @@ -706,8 +692,7 @@ class RemiseCheque extends CommonObject $this->errno = -1030; dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)"); } - } - else { + } else { $this->errno = -1031; dol_syslog("RemiseCheque::updateAmount ERREUR SELECT ($this->errno)"); } @@ -715,8 +700,7 @@ class RemiseCheque extends CommonObject if ($this->errno === 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::updateAmount ROLLBACK ($this->errno)"); } @@ -745,8 +729,7 @@ class RemiseCheque extends CommonObject if ($resql) { $this->updateAmount(); - } - else { + } else { $this->errno = -1032; dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)"); } @@ -821,27 +804,23 @@ class RemiseCheque extends CommonObject { $this->db->commit(); return $rejectedPayment->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $rejectedPayment->error; $this->errors = $rejectedPayment->errors; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $rejectedPayment->error; $this->errors = $rejectedPayment->errors; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -914,13 +893,11 @@ class RemiseCheque extends CommonObject { $this->date_bordereau = $date; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } - } - else { + } else { return -2; } } @@ -947,13 +924,11 @@ class RemiseCheque extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } - } - else { + } else { return -2; } } @@ -1021,8 +996,7 @@ class RemiseCheque extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 7971a34db0d..1ee79aeafd9 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -76,8 +76,7 @@ if ($resql) { print ''.$num.''; print ''; print "\n"; -} -else { +} else { dol_print_error($db); } @@ -139,8 +138,7 @@ if ($resql) print ""; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index cda8c2a679d..e76936c71fd 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -221,8 +221,7 @@ if ($resql) print "\n"; $i++; } - } - else { + } else { print ''; print ''.$langs->trans("None").""; print ''; @@ -230,8 +229,7 @@ if ($resql) print ""; print ""; print "\n"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 99250bd9373..f57e4408a6f 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -200,13 +200,11 @@ class Paiement extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -240,8 +238,7 @@ class Paiement extends CommonObject { $amounts = &$this->amounts; $amounts_to_update = &$this->multicurrency_amounts; - } - else { + } else { $amounts = &$this->multicurrency_amounts; $amounts_to_update = &$this->amounts; } @@ -279,8 +276,7 @@ class Paiement extends CommonObject { $total = $totalamount; $mtotal = $totalamount_converted; // Maybe use price2num with MT for the converted value - } - else { + } else { $total = $totalamount_converted; // Maybe use price2num with MT for the converted value $mtotal = $totalamount; } @@ -424,13 +420,11 @@ class Paiement extends CommonObject $error++; } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } - } - else { + } else { dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.'); } } @@ -442,8 +436,7 @@ class Paiement extends CommonObject if ($result < 0) { $error++; } // Fin appel triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -455,8 +448,7 @@ class Paiement extends CommonObject $this->multicurrency_amount = $mtotal; $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -492,8 +484,7 @@ class Paiement extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -557,8 +548,7 @@ class Paiement extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error; $this->db->rollback(); return -5; @@ -719,8 +709,7 @@ class Paiement extends CommonObject if ($result < 0) { $error++; } // Fin appel triggers } - } - else { + } else { $this->error = $acc->error; $error++; } @@ -728,8 +717,7 @@ class Paiement extends CommonObject if (!$error) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); } } @@ -737,8 +725,7 @@ class Paiement extends CommonObject if (!$error) { return $bank_line_id; - } - else { + } else { return -1; } } @@ -762,8 +749,7 @@ class Paiement extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::update_fk_bank '.$this->error); return -1; @@ -824,8 +810,7 @@ class Paiement extends CommonObject $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); return -2; } @@ -854,8 +839,7 @@ class Paiement extends CommonObject { $this->num_payment = $this->db->escape($num); return 0; - } - else { + } else { $this->error = 'Error -1 '.$this->db->error(); return -2; } @@ -878,8 +862,7 @@ class Paiement extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::valide '.$this->error); return -1; @@ -901,8 +884,7 @@ class Paiement extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::reject '.$this->error); return -1; @@ -946,8 +928,7 @@ class Paiement extends CommonObject $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -979,8 +960,7 @@ class Paiement extends CommonObject } return $billsarray; - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG); return -1; @@ -1012,8 +992,7 @@ class Paiement extends CommonObject } return $amounts; - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::getAmountsArray Error '.$this->error.' -', LOG_DEBUG); return -1; @@ -1096,8 +1075,7 @@ class Paiement extends CommonObject } return $numref; - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice")); return ""; @@ -1198,8 +1176,7 @@ class Paiement extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $url = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index dbdf4f4675e..eb2523960f3 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -129,8 +129,7 @@ if (GETPOST("orphelins", "alpha")) $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -} -else { +} else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql .= " p.statut, p.num_paiement as num_payment,"; $sql .= " c.code as paiement_code,"; @@ -377,8 +376,7 @@ if ($resql) print "\n"; print ""; print "\n"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 66f239fdf96..9d3bae3140d 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -70,8 +70,7 @@ if ($action == 'builddoc') if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0) { $outputlangs->charset_output = $sav_charset_output; - } - else { + } else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, $obj->error); } diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index b978fc8e218..349c483a5db 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -126,8 +126,7 @@ if ($resql) if ($objp->statut == 0) { print ''.$langs->trans("PaymentStatusToValidShort").''; - } - else { + } else { print "-"; } diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index d1b448c5932..9c5ceea22bf 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -141,8 +141,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y $loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid; header('Location: '.$loc); exit; - } - else { + } else { $db->rollback(); } } @@ -282,8 +281,7 @@ if ($action == 'create') if ($objp->date_ech > 0) { print ''.dol_print_date($objp->date_ech, 'day').''."\n"; - } - else { + } else { print "!!!\n"; } @@ -303,8 +301,7 @@ if ($action == 'create') $remaintopay = $objp->amount - $sumpaid; print ''; print ''; - } - else { + } else { print '-'; } print ""; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 69b425356d1..fbe5d926d33 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -66,8 +66,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char $db->commit(); header("Location: ".DOL_URL_ROOT."/compta/sociales/payments.php?mode=sconly"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -282,8 +281,7 @@ if ($resql) print "\n"; $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -314,8 +312,7 @@ if ($action == '') if (!$disable_delete) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index d2611e8a354..63769e2bd9e 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -158,13 +158,11 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).''; } print "
"; -} -else { +} else { dol_print_error($db); } @@ -218,8 +216,7 @@ if ($result) } print "
"; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 106f848f732..347b3ebb37f 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -190,8 +190,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d5051e06bfa..7d56cec823e 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -408,8 +408,7 @@ if ($id > 0 || $ref) if ($obj->statut == 3) { print ''.$langs->trans("StatusRefused").''; - } - else { + } else { print " "; } @@ -441,8 +440,7 @@ if ($id > 0 || $ref) print ''; $db->free($result); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 91a165ee454..6192d97d92f 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -151,18 +151,15 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { $result = 0; - } - else { + } else { $result = -1; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } - } - else { + } else { $result = -2; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } - } - else { + } else { $result = -3; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } @@ -205,12 +202,10 @@ class BonPrelevement extends CommonObject if ($resql) { $num = $this->db->num_rows($resql); - } - else { + } else { $result = -1; } - } - else { + } else { /* * No aggregate */ @@ -238,8 +233,7 @@ class BonPrelevement extends CommonObject { $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); $result = 0; - } - else { + } else { dol_syslog(get_class($this)."::addline Error -2"); $result = -2; } @@ -314,13 +308,11 @@ class BonPrelevement extends CommonObject $this->fetched = 1; return 1; - } - else { + } else { dol_syslog(get_class($this)."::Fetch Erreur aucune ligne retournee"); return -1; } - } - else { + } else { return -2; } } @@ -388,15 +380,13 @@ class BonPrelevement extends CommonObject { $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::set_credite ROLLBACK "); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible "); return -2; } @@ -480,8 +470,7 @@ class BonPrelevement extends CommonObject { dol_syslog(get_class($this)."::set_infocredit AddPayment Error"); $error++; - } - else { + } else { $result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', ''); if ($result < 0) { @@ -505,8 +494,7 @@ class BonPrelevement extends CommonObject dol_syslog(get_class($this)."::set_infocredit Update lines Error"); $error++; } - } - else { + } else { dol_syslog(get_class($this)."::set_infocredit Update Bons Error"); $error++; } @@ -521,24 +509,20 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); dol_syslog("bon-prelevment::set_infocredit ROLLBACK "); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::set_infocredit 1025 Open SQL transaction impossible "); return -1025; } - } - else { + } else { dol_syslog("bon-prelevment::set_infocredit 1027 Date de credit < Date de trans "); return -1027; } - } - else { + } else { return -1026; } } @@ -580,8 +564,7 @@ class BonPrelevement extends CommonObject $message .= $langs->trans("InfoTransData", price($this->amount), $this->methodes_trans[$this->method_trans], dol_print_date($date, 'day')); // TODO Call trigger to create a notification using notification module - } - else { + } else { $error++; } @@ -592,15 +575,13 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT); return -2; } @@ -655,8 +636,7 @@ class BonPrelevement extends CommonObject } } $this->db->free($resql); - } - else { + } else { dol_syslog(get_class($this)."::getListInvoices Erreur"); } @@ -693,8 +673,7 @@ class BonPrelevement extends CommonObject $this->db->free($resql); return $obj->nb; - } - else { + } else { $error = 1; dol_syslog(get_class($this)."::SommeAPrelever Erreur -1"); dol_syslog($this->db->error()); @@ -737,8 +716,7 @@ class BonPrelevement extends CommonObject $this->db->free($resql); return $obj->nb; - } - else { + } else { $this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error(); return -1; } @@ -825,8 +803,7 @@ class BonPrelevement extends CommonObject } $this->db->free($resql); dol_syslog(__METHOD__."::Read invoices, ".$i." invoices to withdraw", LOG_DEBUG); - } - else { + } else { $error++; dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR); } @@ -870,23 +847,19 @@ class BonPrelevement extends CommonObject $factures_prev_id[$i] = $fac[0]; $i++; //dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG); - } - else { + } else { dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } - } - else { + } else { dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING); } - } - else { + } else { dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING); } } - } - else { + } else { dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING); } } @@ -912,8 +885,7 @@ class BonPrelevement extends CommonObject if ($mode == 'real') { $ok = 1; - } - else { + } else { print $langs->trans("ModeWarning"); //"Option for real mode was not set, we stop after this simulation\n"; } } @@ -970,13 +942,11 @@ class BonPrelevement extends CommonObject $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $this->id = $prev_id; $this->ref = $ref; - } - else { + } else { $error++; dol_syslog(__METHOD__."::Create withdraw receipt ".$this->db->lasterror(), LOG_ERR); } - } - else { + } else { $error++; dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR); } @@ -1097,14 +1067,12 @@ class BonPrelevement extends CommonObject if (!$error) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); } return count($factures_prev); - } - else { + } else { return 0; } } @@ -1164,8 +1132,7 @@ class BonPrelevement extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1224,8 +1191,7 @@ class BonPrelevement extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -1266,8 +1232,7 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { return 0; - } - else { + } else { return -1; } } @@ -1291,8 +1256,7 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { return 0; - } - else { + } else { return -1; } } @@ -1322,8 +1286,7 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { $result = 0; - } - else { + } else { $result = -1; dol_syslog(get_class($this)."::AddNotification Error $result"); } @@ -1426,8 +1389,7 @@ class BonPrelevement extends CommonObject $i++; } $nbtotalDrctDbtTxInf = $i; - } - else { + } else { fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers $result = -2; } @@ -1436,8 +1398,7 @@ class BonPrelevement extends CommonObject if ($result != -2) { $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); - } - else { + } else { fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company } @@ -1503,8 +1464,7 @@ class BonPrelevement extends CommonObject $this->total = $this->total + $obj->amount; $i++; } - } - else { + } else { $result = -2; } @@ -1874,8 +1834,7 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - } - else { + } else { fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); $result = -2; } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index accd64e2694..1e731b24524 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -96,15 +96,13 @@ class LignePrelevement $this->statut = $obj->statut; $this->bon_ref = $obj->ref; $this->bon_rowid = $obj->bon_rowid; - } - else { + } else { $result++; dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0"); } $this->db->free($resql); - } - else { + } else { $result++; dol_syslog("LignePrelevement::Fetch rowid=$rowid"); dol_syslog($this->db->error()); @@ -140,20 +138,17 @@ class LignePrelevement if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($status == 0) return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting elseif ($status == 2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited elseif ($status == 3) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts[$status]), 'statut1'); elseif ($status == 2) return img_picto($langs->trans($this->statuts[$status]), 'statut6'); elseif ($status == 3) return img_picto($langs->trans($this->statuts[$status]), 'statut8'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1'); elseif ($status == 2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6'); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 1edd942fc42..8599987fb23 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -160,8 +160,7 @@ class RejetPrelevement { $error++; dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); - } - else { + } else { $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); if ($result < 0) { @@ -190,8 +189,7 @@ class RejetPrelevement { dol_syslog("RejetPrelevement::Create Commit"); $this->db->commit(); - } - else { + } else { dol_syslog("RejetPrelevement::Create Rollback"); $this->db->rollback(); } @@ -225,8 +223,7 @@ class RejetPrelevement $row = $this->db->fetch_row($resql); $userid = $row[0]; } - } - else { + } else { dol_syslog("RejetPrelevement::_send_email Erreur lecture user"); } @@ -262,12 +259,10 @@ class RejetPrelevement if ($result) { dol_syslog("RejetPrelevement::_send_email email envoye"); - } - else { + } else { dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); } - } - else { + } else { dol_syslog("RejetPrelevement::_send_email Userid invalide"); } } @@ -315,8 +310,7 @@ class RejetPrelevement } } $this->db->free($resql); - } - else { + } else { dol_syslog("getListInvoices", LOG_ERR); } @@ -351,13 +345,11 @@ class RejetPrelevement $this->db->free($resql); return 0; - } - else { + } else { dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0"); return -1; } - } - else { + } else { dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid"); return -2; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 505ad070645..015380a669d 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -83,8 +83,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); - } - elseif ($result == 0) + } elseif ($result == 0) { $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); setEventMessages($mesg, null, 'errors'); @@ -93,8 +92,7 @@ if (empty($reshook)) { $mesg .= ''.$val."
\n"; } - } - else { + } else { setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); } } @@ -173,19 +171,16 @@ if ($nb) { } else { print '
'.$langs->trans("CreateAll")."\n"; } - } - else { + } else { if ($mysoc->isInEEC()) { print ''.$langs->trans("CreateForSepaFRST")."\n"; print ''.$langs->trans("CreateForSepaRCUR")."\n"; - } - else { + } else { print ''.$langs->trans("CreateAll")."\n"; } } -} -else { +} else { print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; } @@ -303,15 +298,13 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print ""; print ""; print "
\n"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 64ac904db6c..30618de8c24 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -88,8 +88,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (!$status) { $title = $langs->trans("RequestStandingOrderToTreat"); -} -else { +} else { $title = $langs->trans("RequestStandingOrderTreated"); } @@ -141,8 +140,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index bb3cced3eb4..c0fa4f55e68 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -134,8 +134,7 @@ if ($prev_id > 0 || $ref) print ''; dol_fiche_end(); - } - else { + } else { dol_print_error($db); } } @@ -245,12 +244,10 @@ if ($result) if ($obj->statut == 0) { print '-'; - } - elseif ($obj->statut == 2) + } elseif ($obj->statut == 2) { print $langs->trans("StatusCredited"); - } - elseif ($obj->statut == 3) + } elseif ($obj->statut == 3) { print ''.$langs->trans("StatusRefused").''; } @@ -288,8 +285,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 4bfc07b0292..65116878bb9 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -135,8 +135,7 @@ if ($prev_id > 0 || $ref) print ''; dol_fiche_end(); - } - else { + } else { dol_print_error($db); } } @@ -219,8 +218,7 @@ if ($resql) $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } @@ -236,8 +234,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 5dd01bad41d..0ada15853d9 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -132,8 +132,7 @@ if ($prev_id > 0 || $ref) print ''; dol_fiche_end(); - } - else { + } else { $langs->load("errors"); print $langs->trans("Error"); } @@ -184,8 +183,7 @@ if ($prev_id > 0 || $ref) print ""; $db->free($resql); - } - else { + } else { print $db->error().' '.$sql; } } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index faa56184891..d182176f0fa 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -158,13 +158,11 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).''; } print "
"; -} -else { +} else { dol_print_error($db); } @@ -218,8 +216,7 @@ if ($result) } print "
"; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 89d6ad93636..fd77d6d90f6 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -73,9 +73,7 @@ if ($action == 'confirm_rejet') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - } - - elseif ($daterej > dol_now()) + } elseif ($daterej > dol_now()) { $error++; $langs->load("error"); @@ -102,12 +100,10 @@ if ($action == 'confirm_rejet') header("Location: line.php?id=".$id); exit; } - } - else { + } else { $action = "rejet"; } - } - else { + } else { header("Location: line.php?id=".$id); exit; } @@ -159,22 +155,19 @@ if ($id) { /* Historique pour certaines install */ print $langs->trans("Unknown"); - } - else { + } else { print dol_print_date($rej->date_rejet, 'day'); } print ''; print ''.$langs->trans("RefusedInvoicing").''.$rej->invoicing.''; - } - else { + } else { print ''.$resf.''; } } print ''; dol_fiche_end(); - } - else { + } else { dol_print_error($db); } @@ -240,12 +233,10 @@ if ($id) if ($user->rights->prelevement->bons->credit) { print "id\">".$langs->trans("StandingOrderReject").""; - } - else { + } else { print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject").""; } - } - else { + } else { print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject").""; } } @@ -322,8 +313,7 @@ if ($id) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index b93042df8e6..3130aa475f6 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -235,8 +235,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index a7e7a6f3a53..61417a2cd5f 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -117,8 +117,7 @@ if ($result) print ""; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 609c75e065d..b12a6a2bb35 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -125,8 +125,7 @@ if ($resql) print ' '; print ""; $db->free(); -} -else { +} else { dol_print_error($db); } @@ -218,8 +217,7 @@ if ($resql) print ' '; print ""; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 83388f21e49..8b75ec38fce 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -211,13 +211,11 @@ if ($id > 0) } $db->free($resqlp); - } - else { + } else { dol_print_error($db); } } - } - else { + } else { dol_print_error($db); } @@ -286,8 +284,7 @@ if ($id > 0) print ""; } -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 8d7c0343b30..671921506d5 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -99,8 +99,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; else $year_end++; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -154,8 +153,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -166,8 +164,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesResultInOut"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -212,8 +209,7 @@ print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'amount', '', $param, 'class="right"', $sortfield, $sortorder); -} -else { +} else { if ($modecompta == 'CREANCES-DETTES') { print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], 'amount_ht', '', $param, 'class="right"', $sortfield, $sortorder); @@ -311,14 +307,11 @@ if ($modecompta == 'BOOKKEEPING') $i++; } - } - else { + } else { print ''.$langs->trans("NoRecordFound").''; } - } - else dol_print_error($db); -} -else { + } else dol_print_error($db); +} else { /* * Factures clients */ @@ -336,8 +329,7 @@ else { else $sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -462,8 +454,7 @@ else { else $sql .= " AND f.type IN (0,1,2,3)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; @@ -512,8 +503,7 @@ else { print "\n"; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -546,8 +536,7 @@ else { $sql .= " AND c.deductible = 0"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -591,8 +580,7 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -623,8 +611,7 @@ else { if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; $sql .= " AND cs.entity = ".$conf->entity; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -668,8 +655,7 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -761,14 +747,12 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; } - } - else { + } else { dol_print_error($db); } print ''; @@ -845,14 +829,12 @@ else { print ''.price(-$obj->amount_ttc).''; print ''; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; } - } - else { + } else { dol_print_error($db); } print ''; @@ -877,8 +859,7 @@ else { $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; $sql .= " WHERE p.entity IN (".getEntity('donation').")"; $sql .= " AND fk_statut in (1,2)"; - } - else { + } else { $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; @@ -924,14 +905,12 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; } - } - else { + } else { dol_print_error($db); } print ''; @@ -998,8 +977,7 @@ else { print ''.price($subtotal_ht).''; print ''.price($subtotal_ttc).''; print ''; - } - else dol_print_error($db); + } else dol_print_error($db); } /* @@ -1047,8 +1025,7 @@ else { print ''.price($subtotal_ht).''; print ''.price($subtotal_ttc).''; print ''; - } - else dol_print_error($db); + } else dol_print_error($db); } /* @@ -1157,8 +1134,7 @@ else { print ' '."\n"; print ''.price($amount)."\n"; print "\n"; - } - else { + } else { // VAT really already paid $amount = 0; $sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount"; @@ -1237,8 +1213,7 @@ else { } } $db->free($result); - } - else { + } else { dol_print_error($db); } print ' '; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 04bed25d6b2..7221e932ca6 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -78,8 +78,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; else $year_end++; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -134,8 +133,7 @@ if ($modecompta == 'CREANCES-DETTES') else $description .= "
".$langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") { +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; @@ -146,8 +144,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") { $description .= '
'.$langs->trans("RulesResultInOut"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -191,8 +188,7 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod else $sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -228,12 +224,10 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod $i++; } $db->free($result); - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -274,17 +268,14 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod $i++; } - } - else { + } else { dol_print_error($db); } - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { // Nothing from this table } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -307,8 +298,7 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod else $sql .= " AND f.type IN (0,1,2,3)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { $sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; @@ -343,12 +333,10 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod $i++; } $db->free($result); - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -429,8 +417,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } else { dol_print_error($db); } - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { // TVA really already paid $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; @@ -493,8 +480,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom dol_print_error($db); } } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -516,8 +502,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $sql .= " AND c.deductible = 0"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -554,8 +539,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -578,8 +562,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $sql .= " AND c.deductible = 1"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -616,8 +599,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -664,8 +646,7 @@ if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -723,12 +704,10 @@ if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' | $decaiss_ttc[$obj->dm] += $obj->amount_ttc; } } - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == 'BOOKKEEPING') { +} elseif ($modecompta == 'BOOKKEEPING') { // Nothing from this table } @@ -784,12 +763,10 @@ if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $i++; } } - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == 'BOOKKEEPING') { +} elseif ($modecompta == 'BOOKKEEPING') { // Nothing from this table } @@ -823,8 +800,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba $i++; } } - } - else { + } else { dol_print_error($db); } @@ -852,8 +828,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba $i++; } } - } - else { + } else { dol_print_error($db); } } @@ -889,8 +864,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan $i++; } } - } - else { + } else { dol_print_error($db); } } @@ -955,8 +929,7 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) $i++; } } - } - else { + } else { dol_print_error($db); } } @@ -1035,8 +1008,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if (!isset($totsorties[$annee])) $totsorties[$annee] = 0; $totsorties[$annee] += $decaiss[$case]; } - } - else { + } else { if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) { print ''.price(price2num($decaiss_ttc[$case], 'MT')).''; @@ -1055,8 +1027,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if (!isset($totentrees[$annee])) $totentrees[$annee] = 0; $totentrees[$annee] += $encaiss[$case]; } - } - else { + } else { if (isset($encaiss_ttc[$case])) { print ''.price(price2num($encaiss_ttc[$case], 'MT')).''; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 172929aabff..48cb8b1154e 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -90,8 +90,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; else $year_end++; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -181,8 +180,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") { +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("AnnualByAccountInputOutputMode"); $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; @@ -192,8 +190,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") { $description = $langs->trans("RulesResultInOut"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -248,13 +245,11 @@ if ($modecompta == 'CREANCES-DETTES') { //if (! empty($date_start) && ! empty($date_end)) // $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { //if (! empty($date_start) && ! empty($date_end)) // $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Get array of all report groups that are active $cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 0cb706d3177..f9d5a90d543 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -128,8 +128,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { header("Location: list.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -144,28 +143,23 @@ if ($action == 'add' && $user->rights->tax->charges->creer) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $action = 'create'; - } - elseif (!$dateperiod) + } elseif (!$dateperiod) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors'); $action = 'create'; - } - elseif (!$actioncode > 0) + } elseif (!$actioncode > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); $action = 'create'; - } - elseif (empty($amount)) + } elseif (empty($amount)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; - } - elseif (!is_numeric($amount)) + } elseif (!is_numeric($amount)) { setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; - } - else { + } else { $object->type = $actioncode; $object->label = GETPOST('label', 'alpha'); $object->date_ech = $dateech; @@ -193,23 +187,19 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $action = 'edit'; - } - elseif (!$dateperiod) + } elseif (!$dateperiod) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors'); $action = 'edit'; - } - elseif (empty($amount)) + } elseif (empty($amount)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); $action = 'edit'; - } - elseif (!is_numeric($amount)) + } elseif (!is_numeric($amount)) { setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; - } - else { + } else { $result = $object->fetch($id); $object->date_ech = $dateech; @@ -242,16 +232,14 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char if (GETPOST('clone_label', 'alphanohtml')) { $object->label = GETPOST('clone_label', 'alphanohtml'); - } - else { + } else { $object->label = $langs->trans("CopyOf").' '.$object->label; } if (GETPOST('clone_for_next_month', 'int')) { $object->periode = dol_time_plus_duree($object->periode, 1, 'm'); $object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm'); - } - else { + } else { $newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int')); $newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int')); if ($newdateperiod) $object->periode = $newdateperiod; @@ -268,16 +256,14 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { $id = $originalId; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - } - else { + } else { $db->rollback(); dol_print_error($db, $object->error); } @@ -426,8 +412,7 @@ if ($id > 0) if (!empty($conf->global->TAX_ADD_CLON_FOR_NEXT_MONTH_CHECKBOX)) { $formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1); - } - else { + } else { $formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1); } @@ -529,8 +514,7 @@ if ($id > 0) if ($action == 'edit') { print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); - } - else { + } else { print dol_print_date($object->periode, "day"); } print ""; @@ -541,8 +525,7 @@ if ($id > 0) print ''.$langs->trans("AmountTTC").""; print ''; print ""; - } - else { + } else { print ''.$langs->trans("AmountTTC").''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; } @@ -667,8 +650,7 @@ if ($id > 0) $totalpaye += $objp->amount; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; print ''; print ''; @@ -687,8 +669,7 @@ if ($id > 0) print ''; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -758,8 +739,7 @@ if ($id > 0) print ""; } - } - else { + } else { /* Social contribution not found */ dol_print_error('', $object->error); } diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index b91d9ca31ee..cc66b56aabd 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -459,28 +459,23 @@ class Cchargesociales { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 0c709c031d5..81ae1e28f20 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -171,12 +171,10 @@ class ChargeSociales extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -250,13 +248,11 @@ class ChargeSociales extends CommonObject if (empty($error)) { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -325,8 +321,7 @@ class ChargeSociales extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -382,8 +377,7 @@ class ChargeSociales extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -416,12 +410,10 @@ class ChargeSociales extends CommonObject $obj = $this->db->fetch_object($result); $this->db->free($result); return $obj->amount; - } - else { + } else { return 0; } - } - else { + } else { print $this->db->error(); return -1; } @@ -605,8 +597,7 @@ class ChargeSociales extends CommonObject $this->db->free($resql); return $amount; - } - else { + } else { return -1; } } @@ -659,8 +650,7 @@ class ChargeSociales extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 9164ab39f1e..4cb81422284 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -194,13 +194,11 @@ class PaymentSocialContribution extends CommonObject if ($remaintopay == 0) { $result = $contrib->set_paid($user); - } - else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); + } else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); } } } - } - else { + } else { $error++; } } @@ -214,8 +212,7 @@ class PaymentSocialContribution extends CommonObject $this->total = $totalamount; // deprecated $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -284,8 +281,7 @@ class PaymentSocialContribution extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -355,8 +351,7 @@ class PaymentSocialContribution extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -410,8 +405,7 @@ class PaymentSocialContribution extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -460,8 +454,7 @@ class PaymentSocialContribution extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -571,8 +564,7 @@ class PaymentSocialContribution extends CommonObject if ($result <= 0) dol_print_error($this->db); } } - } - else { + } else { $this->error = $acc->error; $error++; } @@ -581,8 +573,7 @@ class PaymentSocialContribution extends CommonObject if (!$error) { return 1; - } - else { + } else { return -1; } } @@ -605,8 +596,7 @@ class PaymentSocialContribution extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->error(); return 0; } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index e63c5f354d0..e7d76b94a76 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -163,8 +163,7 @@ if ($object->id) $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index be5f7e6f973..43823490ed9 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -80,8 +80,7 @@ if (!GETPOSTISSET('search_typeid')) $part = explode(':', $val); if ($part[0] == 'cs.fk_type') $search_typeid = $part[1]; } -} -else { +} else { $search_typeid = GETPOST('search_typeid', 'int'); } @@ -207,8 +206,7 @@ if ($resql) $countrynotdefined = $langs->trans("ErrorSetACountryFirst"); print $countrynotdefined; print ''; - } - else { + } else { print '
'; print ''."\n"; @@ -311,8 +309,7 @@ if ($resql) if ($obj->periode) { print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').''; - } - else { + } else { print ' '; } print "\n"; @@ -342,8 +339,7 @@ if ($resql) print ''; } print ''; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 05808877df9..fc1f66d5e2c 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -92,8 +92,7 @@ if ($mode != 'sconly') { $center = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."" : ""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1); -} -else { +} else { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit); } @@ -207,8 +206,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print '"; print ""; - } - else { + } else { dol_print_error($db); } print '
 '.price($totalpaye)."
'; @@ -285,8 +283,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -297,18 +294,15 @@ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $j = 1; $numlt = 3; -} -elseif ($mysoc->localtax1_assuj == "1") +} elseif ($mysoc->localtax1_assuj == "1") { $j = 1; $numlt = 2; -} -elseif ($mysoc->localtax2_assuj == "1") +} elseif ($mysoc->localtax2_assuj == "1") { $j = 2; $numlt = 3; -} -else { +} else { $j = 0; $numlt = 0; } @@ -384,8 +378,7 @@ while ($j < $numlt) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -467,8 +460,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) $db->free($result); print "
"; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 3859b19df91..dc5ebd1731d 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -77,8 +77,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end else $year_end++; } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -208,8 +207,7 @@ if ($modecompta == "CREANCES-DETTES") { } $builddate = dol_now(); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -219,11 +217,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 513b0ffa350..ab2c1dcadb1 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -103,8 +103,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end else $year_end++; } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -180,8 +179,7 @@ if ($modecompta == "CREANCES-DETTES") { } $builddate = dol_now(); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -191,11 +189,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } @@ -231,8 +227,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } - elseif ($selected_cat) // Into a specific category + } elseif ($selected_cat) // Into a specific category { $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; } @@ -254,8 +249,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " AND cp.fk_product is null"; - } - elseif ($selected_cat) { // Into a specific category + } elseif ($selected_cat) { // Into a specific category $sql .= " AND (c.rowid = ".$selected_cat; if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat; $sql .= ")"; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 6d720b4f96d..8b6caa89a8f 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -96,8 +96,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } -} -else { +} else { // TODO We define q } // $date_start and $date_end are defined. We force $year_start and $nbofyear @@ -156,8 +155,7 @@ if ($modecompta == "CREANCES-DETTES") { else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -166,12 +164,10 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // TODO -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { // TODO } @@ -395,8 +391,7 @@ if (count($amount)) { } else { //print ''; } - } - elseif ($modecompta == 'CREANCES-DETTES') { + } elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { @@ -415,8 +410,7 @@ if (count($amount)) { } else { //print ''; } - } - elseif ($modecompta == 'CREANCES-DETTES') { + } elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { @@ -430,8 +424,7 @@ if (count($amount)) { } else { //print ''; } - } - elseif ($modecompta == 'CREANCES-DETTES') { + } elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 85a27c7574a..ab71b147b50 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -113,8 +113,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } -} -else { +} else { // TODO We define q } @@ -182,8 +181,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -192,11 +190,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); @@ -222,8 +218,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($selected_cat) // Into a specific category + } elseif ($selected_cat) // Into a specific category { $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } @@ -240,8 +235,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($selected_cat) { // Into a specific category + } elseif ($selected_cat) { // Into a specific category $sql .= " AND (c.rowid = ".$db->escape($selected_cat); if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat); $sql .= ")"; @@ -260,8 +254,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($selected_cat) // Into a specific category + } elseif ($selected_cat) // Into a specific category { $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } @@ -274,8 +267,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($selected_cat) { // Into a specific category + } elseif ($selected_cat) { // Into a specific category $sql .= " AND (c.rowid = ".$selected_cat; if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat; $sql .= ")"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index cfc521c7c13..796ce2cc6a6 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -73,8 +73,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -127,8 +126,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -140,8 +138,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("Turnover"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -173,8 +170,7 @@ if ($modecompta == 'CREANCES-DETTES') else $sql .= " AND f.type IN (0,1,2,3,5)"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -188,8 +184,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $sql .= " AND pf.fk_facture = f.rowid"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.credit) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj"; @@ -223,8 +218,7 @@ if ($result) $i++; } $db->free($result); -} -else { +} else { dol_print_error($db); } @@ -259,8 +253,7 @@ if ($modecompta == 'RECETTES-DEPENSES') } $i++; } - } - else { + } else { dol_print_error($db); } } @@ -338,10 +331,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; } @@ -354,10 +345,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if ($modecompta != 'BOOKKEEPING') print ''; print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print ''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; @@ -387,11 +376,9 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { print '-'; } - } - else { + } else { print ''; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } - else { print ' '; } + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print ''; } @@ -479,8 +466,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; - } - else { + } else { print ' '; } } @@ -489,8 +475,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total[$annee] ?price($total[$annee]) : "0").""; - } - else { + } else { print ' '; } @@ -513,11 +498,9 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print '+0%'; } - } - else { + } else { print ''; - if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } - else { print ' '; } + if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } print ''; } diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index e9e0ec5926c..c257d5d1f73 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -69,8 +69,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -121,8 +120,7 @@ if ($modecompta == "CREANCES-DETTES") $description = $langs->trans("RulesPurchaseTurnoverDue"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -133,8 +131,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesPurchaseTurnoverIn"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("PurchaseTurnover"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -165,8 +162,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql .= " AND f.type IN (0,2)"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -176,8 +172,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $sql .= " AND pf.fk_facturefourn = f.rowid"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj"; @@ -211,8 +206,7 @@ if ($result) $i++; } $db->free($result); -} -else { +} else { dol_print_error($db); } @@ -289,10 +283,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; } @@ -305,10 +297,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if ($modecompta != 'BOOKKEEPING') print ''; print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print ''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; @@ -338,11 +328,9 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { print '-'; } - } - else { + } else { print ''; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } - else { print ' '; } + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print ''; } @@ -365,8 +353,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; - } - else { + } else { print ' '; } } @@ -375,8 +362,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total[$annee] ?price($total[$annee]) : "0").""; - } - else { + } else { print ' '; } @@ -399,11 +385,9 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print '+0%'; } - } - else { + } else { print ''; - if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } - else { print ' '; } + if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } print ''; } diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 9b25488c280..5911daaba45 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -100,8 +100,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end else $year_end++; } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -171,8 +170,7 @@ if ($modecompta == "CREANCES-DETTES") { $description = $langs->trans("RulesPurchaseTurnoverDue"); $builddate = dol_now(); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -180,11 +178,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesPurchaseTurnoverIn"); $builddate = dol_now(); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } @@ -220,8 +216,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } - elseif ($selected_cat) // Into a specific category + } elseif ($selected_cat) // Into a specific category { $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; } @@ -239,8 +234,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " AND cp.fk_product is null"; - } - elseif ($selected_cat) { // Into a specific category + } elseif ($selected_cat) { // Into a specific category $sql .= " AND (c.rowid = ".$selected_cat; if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat; $sql .= ")"; diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 76f9c246e87..60d65049800 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -107,8 +107,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } -} -else { +} else { // TODO We define q } @@ -174,8 +173,7 @@ if ($modecompta == "CREANCES-DETTES") $description = $langs->trans("RulesPurchaseTurnoverDue"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -183,11 +181,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesPurchaseTurnoverIn"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); @@ -214,8 +210,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($selected_cat) // Into a specific category + } elseif ($selected_cat) // Into a specific category { $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } @@ -228,8 +223,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($selected_cat) { // Into a specific category + } elseif ($selected_cat) { // Into a specific category $sql .= " AND (c.rowid = ".$db->escape($selected_cat); if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat); $sql .= ")"; @@ -244,8 +238,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($selected_cat) // Into a specific category + } elseif ($selected_cat) // Into a specific category { $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } @@ -258,8 +251,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($selected_cat) { // Into a specific category + } elseif ($selected_cat) { // Into a specific category $sql .= " AND (c.rowid = ".$selected_cat; if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat; $sql .= ")"; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 3df7419019a..6fa22885dee 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -131,8 +131,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $db->commit(); header("Location: list.php"); exit; - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -165,19 +164,16 @@ if ($action == 'delete') $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/tva/list.php'); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; setEventMessages($mesg, null, 'errors'); } @@ -384,12 +380,10 @@ if ($id) if (!empty($user->rights->tax->charges->supprimer)) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } print "
"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index baeaff7a5d6..3274a3eaebd 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -150,13 +150,11 @@ class Tva extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -222,8 +220,7 @@ class Tva extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -290,8 +287,7 @@ class Tva extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -400,13 +396,11 @@ class Tva extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -439,13 +433,11 @@ class Tva extends CommonObject $ret = $obj->total_tva; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -480,13 +472,11 @@ class Tva extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -602,8 +592,7 @@ class Tva extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $ok = 0; } @@ -621,18 +610,15 @@ class Tva extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -3; } - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -655,8 +641,7 @@ class Tva extends CommonObject if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -695,8 +680,7 @@ class Tva extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -737,8 +721,7 @@ class Tva extends CommonObject $this->db->free($resql); return $amount; - } - else { + } else { return -1; } } @@ -783,8 +766,7 @@ class Tva extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 158c974114d..52466e33d84 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -66,13 +66,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } - else { + if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year $year_start--; @@ -84,14 +82,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -319,8 +315,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], 'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { $invoice_supplier->id = $x_paye[$my_paye_thirdpartyid]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_thirdpartyid]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_thirdpartyid]['type'][$id]; @@ -690,8 +685,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { print $langs->trans("NA"); - } - else { + } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); } diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 45efc9681d8..cb26304cde5 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -148,8 +148,7 @@ if ($object->id) $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index c85f2bbdb8f..43db8353c4c 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -57,13 +57,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year $year_start--; @@ -75,14 +73,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -174,8 +170,7 @@ function pt($db, $sql, $date) $amountpaid = 0; $previousmode = ''; $previousmonth = ''; - } - else { + } else { $previousmode = $obj->mode; $previousmonth = $obj->dm; } @@ -204,8 +199,7 @@ function pt($db, $sql, $date) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -368,8 +362,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], //'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { //$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; //$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 98eede887c8..5b09da5305c 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -72,8 +72,7 @@ if (empty($_REQUEST['typeid'])) $part = explode(':', $val); if ($part[0] == 't.fk_typepayment') $typeid = $part[1]; } -} -else { +} else { $typeid = $_REQUEST['typeid']; } @@ -227,8 +226,7 @@ if ($result) if ($obj->payment_code <> '') { $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; - } - else { + } else { $type = ' '; } @@ -264,8 +262,7 @@ if ($result) $bankstatic->label = $obj->blabel; print $bankstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } // Amount @@ -289,8 +286,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 6e16165ab6c..abd5fb6841c 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -66,13 +66,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year $year_start--; @@ -84,14 +82,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -313,8 +309,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], 'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { $invoice_supplier->id = $x_paye[$my_paye_rate]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -436,8 +431,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) if (dol_string_nohtmltag($fields['descr'])) { print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); } - } - else { + } else { if ($type) { $text = img_object($langs->trans('Service'), 'service'); } else { @@ -616,8 +610,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) if (dol_string_nohtmltag($fields['descr'])) { print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); } - } - else { + } else { if ($type) { $text = img_object($langs->trans('Service'), 'service'); } else { @@ -668,8 +661,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { print $langs->trans("NA"); - } - else { + } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); } diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 874a964a965..0ea0018632b 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -76,8 +76,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -158,8 +157,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else { +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index e005d3dca7b..415d9e47790 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -119,8 +119,7 @@ abstract class ActionsContactCardCommon { $this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company_id'] = $objsoc->id; - } - else { + } else { $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1); } @@ -207,8 +206,7 @@ abstract class ActionsContactCardCommon $dolibarr_user = new User($this->db); $result = $dolibarr_user->fetch($this->object->user_id); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); - } - else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); + } else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); } if ($action == 'view' || $action == 'delete') @@ -221,8 +219,7 @@ abstract class ActionsContactCardCommon $objsoc->fetch($this->object->socid); $this->tpl['company'] = $objsoc->getNomUrl(1); - } - else { + } else { $this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany"); } @@ -307,8 +304,7 @@ abstract class ActionsContactCardCommon if ($resql) { $obj = $this->db->fetch_object($resql); - } - else { + } else { dol_print_error($this->db); } $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 6ac81ac8bd4..099c973b0a4 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -104,8 +104,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); - } - else { + } else { // Confirm delete contact if ($action == 'delete' && $user->rights->societe->contact->supprimer) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 885878138ba..6b73172decc 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -128,18 +128,15 @@ if (empty($reshook)) if ($result2) { $db->commit(); - } - else { + } else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } - } - else { + } else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } - } - else { + } else { $error = $object->error; $errors = $object->errors; } } @@ -152,8 +149,7 @@ if (empty($reshook)) if ($object->setstatus(0) < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -166,8 +162,7 @@ if (empty($reshook)) if ($object->setstatus(1) < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -272,8 +267,7 @@ if (empty($reshook)) else $url = 'card.php?id='.$id; header("Location: ".$url); exit; - } - else { + } else { $db->rollback(); } } @@ -293,13 +287,11 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/contact/list.php'); exit; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -342,20 +334,17 @@ if (empty($reshook)) if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; - } - else { + } else { $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Create thumbs $object->addThumbs($newfile); } } - } - else { + } else { $errors[] = "ErrorBadImageFormat"; } - } - else { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -440,8 +429,7 @@ if (empty($reshook)) $resql = $db->query($sql); } } - } - else { + } else { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = '".$db->escape($object->email)."' AND entity = ".$db->escape(getEntity('mailing', 0)); $resql = $db->query($sql); } @@ -452,8 +440,7 @@ if (empty($reshook)) $object->old_lastname = ''; $object->old_firstname = ''; $action = 'view'; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } @@ -512,8 +499,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else { +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -632,8 +618,7 @@ else { print ''; print ''; print ''; - } - else { + } else { print ''; print $form->select_company($socid, 'socid', '', 'SelectThirdParty'); print ''; @@ -688,16 +673,14 @@ else { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - } - else { + } else { print ''; } if ($object->country_id) { print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); - } - else { + } else { print $countrynotdefined; } print ''; @@ -854,8 +837,7 @@ else { if ($object->birthday) { print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); - } - else { + } else { print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } print ''; @@ -864,8 +846,7 @@ else { if ($object->birthday_alert) { print ''; - } - else { + } else { print ''; } print ''; @@ -881,16 +862,14 @@ else { { print '     '; print ''; - } - else { + } else { print '     '; print ''; } print ''; print ""; - } - elseif ($action == 'edit' && !empty($id)) + } elseif ($action == 'edit' && !empty($id)) { /* * Fiche en mode edition @@ -1011,8 +990,7 @@ else { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - } - else { + } else { print ''; } @@ -1049,8 +1027,7 @@ else { $langs->load("mails"); print ''.$langs->trans("NbOfEMailingsSend").''; print ''.$object->getNbOfEMailings().''; - } - else { + } else { print ''; } print ''; @@ -1074,8 +1051,7 @@ else { print ''; print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).''; - } - else { + } else { print ''; } print ''; @@ -1220,8 +1196,7 @@ else { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); print $dolibarr_user->getLoginUrl(1); - } - else print $langs->trans("NoDolibarrAccess"); + } else print $langs->trans("NoDolibarrAccess"); print ''; // Photo @@ -1396,8 +1371,7 @@ else { if (!empty($conf->commande->enabled) || !empty($conf->expedition->enabled)) { print ''; - if (!empty($conf->expedition->enabled)) { print $langs->trans("ContactForOrdersOrShipments"); } - else print $langs->trans("ContactForOrders"); + if (!empty($conf->expedition->enabled)) { print $langs->trans("ContactForOrdersOrShipments"); } else print $langs->trans("ContactForOrders"); print ''; $none = $langs->trans("NoContactForAnyOrder"); if (!empty($conf->expedition->enabled)) { $none = $langs->trans("NoContactForAnyOrderOrShipments"); } @@ -1425,8 +1399,7 @@ else { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); print $dolibarr_user->getLoginUrl(1); - } - else print $langs->trans("NoDolibarrAccess"); + } else print $langs->trans("NoDolibarrAccess"); print ''; print ''; @@ -1456,8 +1429,7 @@ else { { $langs->load("mails"); print '
'.$langs->trans('SendMail').'
'; - } - else { + } else { $langs->load("mails"); print '
'.$langs->trans('SendMail').'
'; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index fc640e7e032..cfe41eafca2 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -287,8 +287,7 @@ class Contact extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; @@ -387,14 +386,12 @@ class Contact extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -593,14 +590,12 @@ class Contact extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; } - } - else { + } else { $this->error = $this->db->lasterror().' sql='.$sql; $this->db->rollback(); return -1; @@ -756,12 +751,10 @@ class Contact extends CommonObject $error++; $this->error = $this->db->lasterror(); } - } - else { + } else { $result = true; } - } - else { + } else { $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert "; $sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $result = $this->db->query($sql); @@ -784,8 +777,7 @@ class Contact extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; @@ -858,8 +850,7 @@ class Contact extends CommonObject dol_syslog($this->error, LOG_ERR); return 2; - } - elseif ($num) // $num = 1 + } elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); @@ -933,8 +924,7 @@ class Contact extends CommonObject $this->user_id = $uobj->rowid; } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -960,8 +950,7 @@ class Contact extends CommonObject $this->birthday_alert = 1; } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -976,13 +965,11 @@ class Contact extends CommonObject } return 1; - } - else { + } else { $this->error = $langs->trans("RecordNotFound"); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1003,8 +990,7 @@ class Contact extends CommonObject if (in_array($this->civility_id, array('MR')) || in_array($this->civility_code, array('MR'))) { $this->gender = 'man'; - } - elseif (in_array($this->civility_id, array('MME', 'MLE')) || in_array($this->civility_code, array('MME', 'MLE'))) + } elseif (in_array($this->civility_id, array('MME', 'MLE')) || in_array($this->civility_code, array('MME', 'MLE'))) { $this->gender = 'woman'; } @@ -1048,8 +1034,7 @@ class Contact extends CommonObject } $this->db->free($resql); return 0; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1104,8 +1089,7 @@ class Contact extends CommonObject $i++; } - } - else { + } else { $error++; $this->error = $this->db->error().' sql='.$sql; } @@ -1171,8 +1155,7 @@ class Contact extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog("Error ".$this->error, LOG_ERR); return -1; @@ -1219,8 +1202,7 @@ class Contact extends CommonObject } $this->db->free($resql); - } - else { + } else { print $this->db->error(); } } @@ -1245,8 +1227,7 @@ class Contact extends CommonObject $this->db->free($resql); return $nb; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1507,8 +1488,7 @@ class Contact extends CommonObject { $this->db->rollback(); return -$error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1661,8 +1641,7 @@ class Contact extends CommonObject } return $tab; - } - else { + } else { $this->error = $this->db->error(); dol_print_error($this->db); return -1; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index ff3570e7e82..7655e00ea3f 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -178,8 +178,7 @@ if ($type_element == 'fichinter') $where = ' WHERE f.entity IN ('.getEntity('ficheinter').')'; $dateprint = 'f.datec'; $doc_number = 'f.ref'; -} -elseif ($type_element == 'invoice') +} elseif ($type_element == 'invoice') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $documentstatic = new Facture($db); @@ -193,8 +192,7 @@ elseif ($type_element == 'invoice') $dateprint = 'f.datef'; $doc_number = 'f.ref'; $thirdTypeSelect = 'customer'; -} -elseif ($type_element == 'propal') +} elseif ($type_element == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $documentstatic = new Propal($db); @@ -208,8 +206,7 @@ elseif ($type_element == 'propal') $datePrint = 'c.datep'; $doc_number = 'c.ref'; $thirdTypeSelect = 'customer'; -} -elseif ($type_element == 'order') +} elseif ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $documentstatic = new Commande($db); @@ -223,8 +220,7 @@ elseif ($type_element == 'order') $dateprint = 'c.date_commande'; $doc_number = 'c.ref'; $thirdTypeSelect = 'customer'; -} -elseif ($type_element == 'supplier_invoice') +} elseif ($type_element == 'supplier_invoice') { // Supplier : Show products from invoices. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $documentstatic = new FactureFournisseur($db); @@ -266,8 +262,7 @@ elseif ($type_element == 'supplier_order') $dateprint = 'c.date_valid'; $doc_number = 'c.ref'; $thirdTypeSelect = 'supplier'; -} -elseif ($type_element == 'contract') +} elseif ($type_element == 'contract') { // Order require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $documentstatic = new Contrat($db); @@ -423,8 +418,7 @@ if ($sql_select) if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); - } - else { + } else { print $documentstatic->getLibStatut(2); } print ''; @@ -466,8 +460,7 @@ if ($sql_select) } $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; - } - else { + } else { $label = $objp->product_label; } @@ -499,27 +492,23 @@ if ($sql_select) $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); - } - elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + } elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); - } - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + } elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); // Add date of deposit if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; - } - else { + } else { echo ($txt ? ' - ' : '').dol_htmlentitiesbr($objp->description); } } - } - else { + } else { if ($objp->fk_product > 0) { echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, ''); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 7934bbd5996..f601086ad05 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -67,8 +67,7 @@ if ($action == 'dolibarr2ldap') { setEventMessages($langs->trans("ContactSynchronized"), null, 'mesgs'); $db->commit(); - } - else { + } else { setEventMessages($ldap->error, $ldap->errors, 'errors'); $db->rollback(); } @@ -105,8 +104,7 @@ if ($object->socid > 0) $thirdparty->fetch($object->socid); print ''.$langs->trans("ThirdParty").''.$thirdparty->getNomUrl(1).''; -} -else { +} else { print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; @@ -181,19 +179,16 @@ if ($result > 0) if (!is_array($records)) { print ''.$langs->trans("ErrorFailedToReadLDAP").''; - } - else { + } else { $result = show_ldap_content($records, 0, $records['count'], true); } - } - else { + } else { print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; } $ldap->unbind(); $ldap->close(); -} -else { +} else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a6add5c7d75..fe80e709b28 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -123,14 +123,12 @@ if ($type == "c") if (empty($contextpage) || $contextpage == 'contactlist') $contextpage = 'contactcustomerlist'; $titre .= ' ('.$langs->trans("ThirdPartyCustomers").')'; $urlfiche = "card.php"; -} -elseif ($type == "f") +} elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') $contextpage = 'contactsupplierlist'; $titre .= ' ('.$langs->trans("ThirdPartySuppliers").')'; $urlfiche = "card.php"; -} -elseif ($type == "o") +} elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') $contextpage = 'contactotherlist'; $titre .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; @@ -326,8 +324,7 @@ if (!empty($userid)) // propre au commercial if ($search_priv != '0' && $search_priv != '1') { $sql .= " AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".$user->id."))"; -} -else { +} else { if ($search_priv == '0') $sql .= " AND p.priv='0'"; if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; } @@ -375,16 +372,13 @@ if ($search_import_key) $sql .= natural_search("p.import_key", $sear if ($type == "o") // filtre sur type { $sql .= " AND p.fk_soc IS NULL"; -} -elseif ($type == "f") // filtre sur type +} elseif ($type == "f") // filtre sur type { $sql .= " AND s.fournisseur = 1"; -} -elseif ($type == "c") // filtre sur type +} elseif ($type == "c") // filtre sur type { $sql .= " AND s.client IN (1, 3)"; -} -elseif ($type == "p") // filtre sur type +} elseif ($type == "p") // filtre sur type { $sql .= " AND s.client IN (2, 3)"; } @@ -402,8 +396,7 @@ $sql .= $hookmanager->resPrint; if ($view == "recent") { $sql .= $db->order("p.datec", "DESC"); -} -else { +} else { $sql .= $db->order($sortfield, $sortorder); } @@ -920,8 +913,7 @@ while ($i < min($num, $limit)) $objsoc = new Societe($db); $objsoc->fetch($obj->socid); print $objsoc->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 5665030b6d5..a5a1714b6e5 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -85,18 +85,15 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact- if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); - } - else { + } else { // Create thumbs $object->addThumbs($newfile); } } - } - else { + } else { setEventMessages("ErrorBadImageFormat", null, 'errors'); } - } - else { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -108,8 +105,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact- break; } } - } - else { + } else { $error = $object->error; } } @@ -179,8 +175,7 @@ if ($action == 'edit') $objsoc->fetch($object->socid); print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; - } - else { + } else { print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; @@ -202,8 +197,7 @@ if ($action == 'edit') if (!empty($object->birthday_alert)) { print ''; - } - else { + } else { print ''; } print ''; @@ -219,8 +213,7 @@ if ($action == 'edit') print ''; print ""; -} -else { +} else { // View mode dol_fiche_head($head, 'perso', $title, -1, 'contact'); @@ -294,8 +287,7 @@ else { if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn"); else print $langs->trans("BirthdayAlertOff"); print ''; - } - else { + } else { print ''.$langs->trans("DateToBirth").''; } print ""; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 36a9c950069..d016cb23d75 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -39,8 +39,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 7a2f8cf311f..c4f923a7372 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -112,13 +112,10 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) + } elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { if (!GETPOST('dateend')) { @@ -132,8 +129,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -301,13 +297,11 @@ if (empty($reshook)) } $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; - } - else { + } else { $label = $lines[$i]->product_label; } $desc = ($lines[$i]->desc && $lines[$i]->desc != $lines[$i]->libelle) ?dol_htmlentitiesbr($lines[$i]->desc) : ''; - } - else { + } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); } @@ -352,8 +346,7 @@ if (empty($reshook)) } } } - } - else { + } else { setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error++; } @@ -364,28 +357,23 @@ if (empty($reshook)) // modified by hook if ($reshook < 0) $error++; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } - else { + } else { $result = $object->create($user); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } $action = 'create'; } } - } - - elseif ($action == 'classin' && $user->rights->contrat->creer) + } elseif ($action == 'classin' && $user->rights->contrat->creer) { $object->setProject(GETPOST('projectid')); } @@ -402,8 +390,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -474,8 +461,7 @@ if (empty($reshook)) $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - } - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; @@ -507,8 +493,7 @@ if (empty($reshook)) if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } - else { + } else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -518,8 +503,7 @@ if (empty($reshook)) else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $fk_unit = $prod->fk_unit; - } - else { + } else { $pu_ht = GETPOST('price_ht'); $price_base_type = 'HT'; $tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0 @@ -545,8 +529,7 @@ if (empty($reshook)) { $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1; - } - else { + } else { // Insert line $result = $object->addline( $desc, @@ -619,14 +602,11 @@ if (empty($reshook)) unset($_POST['date_endday']); unset($_POST['date_endmonth']); unset($_POST['date_endyear']); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) { $error = 0; if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update) @@ -732,13 +712,10 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - - elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) + } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->deleteline(GETPOST('lineid'), $user); @@ -746,13 +723,10 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) + } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->validate($user); @@ -774,13 +748,10 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'reopen' && $user->rights->contrat->creer) + } elseif ($action == 'reopen' && $user->rights->contrat->creer) { $result = $object->reopen($user); if ($result < 0) @@ -807,22 +778,17 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) + } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) { $result = $object->delete($user); if ($result >= 0) { header("Location: list.php?restore_lastsearch_values=1"); return; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) + } elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) { if (GETPOST('newcid') > 0) { @@ -834,16 +800,13 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); return; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors'); } - } - elseif ($action == 'update_extras') + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -863,8 +826,7 @@ if (empty($reshook)) if ($error) { $action = 'edit_extras'; } - } - elseif ($action == 'setref_supplier') + } elseif ($action == 'setref_supplier') { $cancelbutton = GETPOST('cancel', 'alpha'); if (!$cancelbutton) { @@ -878,13 +840,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - elseif ($action == 'setref_customer') + } elseif ($action == 'setref_customer') { $cancelbutton = GETPOST('cancel', 'alpha'); @@ -900,13 +860,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - elseif ($action == 'setref') + } elseif ($action == 'setref') { $cancelbutton = GETPOST('cancel', 'alpha'); @@ -940,13 +898,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - elseif ($action == 'setdate_contrat') + } elseif ($action == 'setdate_contrat') { $cancelbutton = GETPOST('cancel', 'alpha'); @@ -964,8 +920,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } @@ -996,14 +951,12 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1024,8 +977,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1037,8 +989,7 @@ if (empty($reshook)) if (!GETPOST('socid', 3)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { $result = $object->createFromClone($user, $socid); if ($result > 0) { @@ -1098,8 +1049,7 @@ if ($action == 'create') if ($element == 'project') { $projectid = GETPOST('originid'); - } - else { + } else { // For compatibility if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } @@ -1126,8 +1076,7 @@ if ($action == 'create') // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } - } - else { + } else { $projectid = GETPOST('projectid', 'int'); $note_private = GETPOST("note_private"); $note_public = GETPOST("note_public"); @@ -1173,8 +1122,7 @@ if ($action == 'create') print $soc->getNomUrl(1); print ''; print ''; - } - else { + } else { print ''; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); print ' '.$langs->trans("AddThirdParty").''; @@ -1268,8 +1216,7 @@ if ($action == 'create') } print "\n"; -} -else /* *************************************************************************** */ +} else /* *************************************************************************** */ /* */ /* Mode vue et edition */ /* */ @@ -1575,8 +1522,7 @@ else /* ************************************************************************ echo $form->textwithtooltip($text, $description, 3, '', '', $cursorline, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); print ''; - } - else { + } else { print ''.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."\n"; } // VAT @@ -1597,8 +1543,7 @@ else /* ************************************************************************ if ($objp->remise_percent > 0) { print ''.$objp->remise_percent."%\n"; - } - else { + } else { print ' '; } @@ -1655,8 +1600,7 @@ else /* ************************************************************************ $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print " ".img_warning($textlate); } - } - else print $langs->trans("Unknown"); + } else print $langs->trans("Unknown"); print '  -  '; print $langs->trans("DateEndPlanned").': '; if ($objp->date_fin) @@ -1667,8 +1611,7 @@ else /* ************************************************************************ $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print " ".img_warning($textlate); } - } - else print $langs->trans("Unknown"); + } else print $langs->trans("Unknown"); print ''; print ''; @@ -1696,8 +1639,7 @@ else /* ************************************************************************ print $productstatic->getNomUrl(1, '', 32); print $objp->label ? ' - '.dol_trunc($objp->label, 32) : ''; print '
'; - } - else { + } else { print $objp->label ? $objp->label.'
' : ''; } @@ -1773,8 +1715,7 @@ else /* ************************************************************************ } $db->free($result); - } - else { + } else { dol_print_error($db); } @@ -1844,8 +1785,7 @@ else /* ************************************************************************ if (empty($dateactend)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors'); - } - else { + } else { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService", dol_print_date($dateactend, "%A %d %B %Y")), "confirm_closeline", '', 0, 1); } print '
'; @@ -2121,8 +2061,7 @@ else /* ************************************************************************ if ($user->rights->contrat->activer) { print '
'.$langs->trans("ActivateAllContracts").'
'; - } - else { + } else { print '
'.$langs->trans("ActivateAllContracts").'
'; } } @@ -2131,8 +2070,7 @@ else /* ************************************************************************ if ($user->rights->contrat->desactiver) { print '
'.$langs->trans("CloseAllContracts").'
'; - } - else { + } else { print '
'.$langs->trans("CloseAllContracts").'
'; } @@ -2151,8 +2089,7 @@ else /* ************************************************************************ if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer) { print '
'.$langs->trans("Delete").'
'; - } - else { + } else { print '
'.$langs->trans("Delete").'
'; } } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 9caa33fca2d..ffe66208afe 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -169,8 +169,7 @@ class Contracts extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve contrat list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -464,8 +463,7 @@ class Contracts extends DolibarrApi $updateRes = $this->contract->deleteline($lineid, DolibarrApiAccess::$user); if ($updateRes > 0) { return $this->get($id); - } - else { + } else { throw new RestException(405, $this->contract->error); } } @@ -500,8 +498,7 @@ class Contracts extends DolibarrApi if ($this->contract->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->contract->error); } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 304628d97cc..a702847e23b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -298,14 +298,12 @@ class Contrat extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; dol_print_error($db, get_class($this)."::getNextValue ".$obj->error); return ""; } - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Contract")); return ""; @@ -408,8 +406,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -464,8 +461,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -504,12 +500,10 @@ class Contrat extends CommonObject if ($force_number) { $num = $force_number; - } - elseif (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + } elseif (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $num = $this->getNextNumRef($this->thirdparty); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -586,8 +580,7 @@ class Contrat extends CommonObject $this->brouillon = 0; $this->date_validation = $now; } - } - else { + } else { $error++; } @@ -595,8 +588,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -659,8 +651,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -712,8 +703,7 @@ class Contrat extends CommonObject $this->error = 'Fetch found several records.'; dol_syslog($this->error, LOG_ERR); $result = -2; - } - elseif ($num) // $num = 1 + } elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); if ($obj) @@ -762,14 +752,12 @@ class Contrat extends CommonObject return $this->id; } - } - else { + } else { dol_syslog(get_class($this)."::fetch Contract not found"); $this->error = "Contract not found"; return 0; } - } - else { + } else { dol_syslog(get_class($this)."::fetch Error searching contract"); $this->error = $this->db->error(); return -1; @@ -929,8 +917,7 @@ class Contrat extends CommonObject $pos++; } $this->db->free($result); - } - else { + } else { dol_syslog(get_class($this)."::Fetch Error when reading lines of contracts linked to products"); return -3; } @@ -1070,8 +1057,7 @@ class Contrat extends CommonObject $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1118,8 +1104,7 @@ class Contrat extends CommonObject //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } - } - else dol_print_error($resqlcontact); + } else dol_print_error($resqlcontact); } } @@ -1134,21 +1119,18 @@ class Contrat extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = "Failed to add contract"; dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG); $this->db->rollback(); @@ -1317,8 +1299,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1411,8 +1392,7 @@ class Contrat extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1489,8 +1469,7 @@ class Contrat extends CommonObject if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -1541,8 +1520,7 @@ class Contrat extends CommonObject if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0) { return $result; - } - else { + } else { $pa_ht = $result; } } @@ -1613,19 +1591,16 @@ class Contrat extends CommonObject { $this->db->rollback(); return -1; - } - else { + } else { $this->db->commit(); return $contractlineid; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error()." sql=".$sql; return -1; } - } - else { + } else { dol_syslog(get_class($this)."::addline ErrorTryToAddLineOnValidatedContract", LOG_ERR); return -2; } @@ -1677,8 +1652,7 @@ class Contrat extends CommonObject { $remise = round(($pu * $remise_percent / 100), 2); $price = $pu - $remise; - } - else { + } else { $remise_percent = 0; } @@ -1728,8 +1702,7 @@ class Contrat extends CommonObject if (($result = $this->defineBuyPrice($pu, $remise_percent)) < 0) { return $result; - } - else { + } else { $pa_ht = $result; } } @@ -1752,14 +1725,10 @@ class Contrat extends CommonObject $sql .= ", total_ttc='".price2num($total_ttc)."'"; $sql .= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null"); $sql .= ", buy_price_ht='".price2num($pa_ht)."'"; - if ($date_start > 0) { $sql .= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; } - else { $sql .= ",date_ouverture_prevue=null"; } - if ($date_end > 0) { $sql .= ",date_fin_validite='".$this->db->idate($date_end)."'"; } - else { $sql .= ",date_fin_validite=null"; } - if ($date_debut_reel > 0) { $sql .= ",date_ouverture='".$this->db->idate($date_debut_reel)."'"; } - else { $sql .= ",date_ouverture=null"; } - if ($date_fin_reel > 0) { $sql .= ",date_cloture='".$this->db->idate($date_fin_reel)."'"; } - else { $sql .= ",date_cloture=null"; } + if ($date_start > 0) { $sql .= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; } else { $sql .= ",date_ouverture_prevue=null"; } + if ($date_end > 0) { $sql .= ",date_fin_validite='".$this->db->idate($date_end)."'"; } else { $sql .= ",date_fin_validite=null"; } + if ($date_debut_reel > 0) { $sql .= ",date_ouverture='".$this->db->idate($date_debut_reel)."'"; } else { $sql .= ",date_ouverture=null"; } + if ($date_fin_reel > 0) { $sql .= ",date_cloture='".$this->db->idate($date_fin_reel)."'"; } else { $sql .= ",date_cloture=null"; } $sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null"); $sql .= " WHERE rowid = ".$rowid; @@ -1802,14 +1771,12 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::updateline Erreur -2"); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error(); dol_syslog(get_class($this)."::updateline Erreur -1"); @@ -1870,8 +1837,7 @@ class Contrat extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -2; } @@ -1967,8 +1933,7 @@ class Contrat extends CommonObject $text .= ($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : ''; $text .= ($mode == 7 ? '' : ''); return $text; - } - else { + } else { return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } } @@ -2086,8 +2051,7 @@ class Contrat extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -2122,8 +2086,7 @@ class Contrat extends CommonObject $i++; } return $tab; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2159,8 +2122,7 @@ class Contrat extends CommonObject $i++; } return $tab; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2192,8 +2154,7 @@ class Contrat extends CommonObject $sql .= " WHERE c.statut = 1"; $sql .= " AND c.rowid = cd.fk_contrat"; $sql .= " AND cd.statut = 0"; - } - elseif ($mode == 'expired') + } elseif ($mode == 'expired') { $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql .= $this->from; @@ -2201,8 +2162,7 @@ class Contrat extends CommonObject $sql .= " AND c.rowid = cd.fk_contrat"; $sql .= " AND cd.statut = 4"; $sql .= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'"; - } - elseif ($mode == 'active') + } elseif ($mode == 'active') { $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql .= $this->from; @@ -2228,8 +2188,7 @@ class Contrat extends CommonObject $label = $langs->trans("BoardNotActivatedServices"); $labelShort = $langs->trans("BoardNotActivatedServicesShort"); $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc'; - } - elseif ($mode == 'expired') { + } elseif ($mode == 'expired') { $warning_delay = $conf->contrat->services->expires->warning_delay; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc'; $label = $langs->trans("BoardExpiredServices"); @@ -2260,8 +2219,7 @@ class Contrat extends CommonObject } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2302,8 +2260,7 @@ class Contrat extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2759,11 +2716,7 @@ class ContratLigne extends CommonObjectLine global $langs; $langs->load("contracts"); - if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); } - elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); } - elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); } - elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); } - elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } + if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); } elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); } elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); } elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); } elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } $statusType = 'status'.$status; if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status1'; @@ -2927,8 +2880,7 @@ class ContratLigne extends CommonObjectLine $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -3013,8 +2965,7 @@ class ContratLigne extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -3161,8 +3112,7 @@ class ContratLigne extends CommonObjectLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -3243,8 +3193,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error()." sql=".$sql; return -1; @@ -3297,8 +3246,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 250d89e3e88..02d9c71776d 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -70,8 +70,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $msg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); @@ -89,8 +88,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db, $object->error); } } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index e43db63826f..d60d54258bb 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -193,8 +193,7 @@ if ($object->id) $permtoedit = $user->rights->contrat->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 4530d01a6af..40a9a4100da 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -140,8 +140,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } // Search by status (only expired) @@ -178,8 +177,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -296,14 +294,12 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) //$tot_ttc+=$obj->total_ttc; $i++; } - } - else { + } else { print ''.$langs->trans("NoContracts").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -379,8 +375,7 @@ if ($result) $db->free($result); print ""; -} -else { +} else { dol_print_error($db); } @@ -434,8 +429,7 @@ if ($resql) $productstatic->ref = $obj->pref; $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); - } - else { + } else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -456,8 +450,7 @@ if ($resql) $db->free(); print ""; -} -else { +} else { dol_print_error($db); } @@ -512,8 +505,7 @@ if ($resql) $productstatic->ref = $obj->pref; $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); - } - else { + } else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -533,8 +525,7 @@ if ($resql) $db->free(); print ""; -} -else { +} else { dol_print_error($db); } @@ -590,8 +581,7 @@ if ($resql) $productstatic->ref = $obj->pref; $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); - } - else { + } else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -611,8 +601,7 @@ if ($resql) $db->free(); print ""; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 5053b703966..3627661c727 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -708,8 +708,7 @@ while ($i < min($num, $limit)) if ($nbofsalesrepresentative > 3) { // We print only number print $nbofsalesrepresentative; - } - elseif ($nbofsalesrepresentative > 0) + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; @@ -731,8 +730,7 @@ while ($i < min($num, $limit)) } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } - else { + } else { print ' '; } print ''; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 62a853270e1..fd46b8eba98 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -102,8 +102,7 @@ if ($search_status != '') if ($tmp[1] == 'filter=notexpired') $filter = 'notexpired'; if ($tmp[1] == 'filter=expired') $filter = 'expired'; } -} -else { +} else { $search_status = $mode; if ($filter == 'expired') $search_status .= '&filter=expired'; if ($filter == 'notexpired') $search_status .= '&filter=notexpired'; @@ -595,8 +594,7 @@ while ($i < min($num, $limit)) print $productstatic->getNomUrl(1, '', 24); print $obj->label ? ' - '.dol_trunc($obj->label, 16) : ''; if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) print '
'.dol_nl2br($obj->description); - } - else { + } else { if ($obj->type == 0) print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24); if ($obj->type == 1) print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24); } @@ -679,8 +677,7 @@ while ($i < min($num, $limit)) $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24; $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print img_warning($textlate); - } - else print '    '; + } else print '    '; print ''; if (!$i) $totalarray['nbfield']++; } @@ -721,8 +718,7 @@ while ($i < min($num, $limit)) { // If contract is draft, we say line is also draft print $contractstatic->LibStatut(0, 5); - } - else { + } else { print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0); } print ''; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 2d6695ff6cb..f9f10f636ca 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -40,8 +40,7 @@ if ($cancel) { header("Location: ".$backtopageforcancel); exit; - } - elseif (!empty($backtopage)) + } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -57,8 +56,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { if ($object->fields[$key]['type'] == 'duration') { if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') continue; // The field was not submited to be edited - } - else { + } else { if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited } // Ignore special fields @@ -106,15 +104,13 @@ if ($action == 'add' && !empty($permissiontoadd)) $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation header("Location: ".$urltogo); exit; - } - else { + } else { // Creation KO if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); $action = 'create'; } - } - else { + } else { $action = 'create'; } } @@ -127,15 +123,12 @@ if ($action == 'update' && !empty($permissiontoadd)) // Check if field was submited to be edited if ($object->fields[$key]['type'] == 'duration') { if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) continue; // The field was not submited to be edited - } - elseif ($object->fields[$key]['type'] == 'boolean') { + } elseif ($object->fields[$key]['type'] == 'boolean') { if (!GETPOSTISSET($key)) { $object->$key = 0; // use 0 instead null if the field is defined as not null continue; } - } - - else { + } else { if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited } // Ignore special fields @@ -178,14 +171,12 @@ if ($action == 'update' && !empty($permissiontoadd)) if ($result > 0) { $action = 'view'; - } - else { + } else { // Creation KO setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } - } - else { + } else { $action = 'edit'; } } @@ -204,8 +195,7 @@ if ($action == "update_extras" && !empty($permissiontoadd)) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); $action = 'view'; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit_extras'; } @@ -227,8 +217,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) setEventMessages("RecordDeleted", null, 'mesgs'); header("Location: ".$backurlforlist); exit; - } - else { + } else { if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } @@ -263,8 +252,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs'); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -291,8 +279,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -319,8 +306,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -332,8 +318,7 @@ if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) if ($result >= 0) { // Nothing else done - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -360,8 +345,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -372,8 +356,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid. //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); // ... @@ -385,8 +368,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) else $newid = $result; header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object exit; - } - else { + } else { setEventMessages($objectutil->error, $objectutil->errors, 'errors'); $action = ''; } diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index f4b5f1fbb4c..eb51796eccd 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -37,8 +37,7 @@ if ($action == 'builddoc' && $permissiontoadd) if (is_numeric(GETPOST('model', 'alpha'))) { $error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Model")); - } - else { + } else { // Reload to get all modified line records and be ready for hooks $ret = $object->fetch($id); $ret = $object->fetch_thirdparty(); @@ -88,8 +87,7 @@ if ($action == 'builddoc' && $permissiontoadd) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; - } - else { + } else { if (empty($donotredirect)) // This is set when include is done by bulk action "Bill Orders" { setEventMessages($langs->trans("FileGenerated"), null); @@ -132,8 +130,7 @@ if ($action == 'remove_file' && $permissiontoadd) header('Location: '.$urltoredirect); exit; - } - else { + } else { setEventMessages('BugFoundVarUploaddirnotDefined', null, 'errors'); } } diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php index 3d18c2d7c24..c352f07f9f7 100644 --- a/htdocs/core/actions_comments.inc.php +++ b/htdocs/core/actions_comments.inc.php @@ -49,8 +49,7 @@ if ($action == 'addcomment') setEventMessages($langs->trans("CommentAdded"), null, 'mesgs'); header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { setEventMessages($comment->error, $comment->errors, 'errors'); $action = ''; } @@ -66,8 +65,7 @@ if ($action === 'updatecomment') setEventMessages($langs->trans("CommentAdded"), null, 'mesgs'); header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1#comment' : '')); exit; - } - else { + } else { setEventMessages($comment->error, $comment->errors, 'errors'); $action = ''; } @@ -82,8 +80,7 @@ if ($action == 'deletecomment') setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs'); header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { setEventMessages($comment->error, $comment->errors, 'errors'); $action = ''; } diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 5a044d7a464..46a6a31c202 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -122,8 +122,7 @@ if ($action == 'add') $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'create'; } - } - else { + } else { $error++; $langs->load("errors"); $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); @@ -148,8 +147,7 @@ if ($action == 'add') { $params['options'] = array($parameters=>null); } - } - else { + } else { //Esle it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { @@ -189,22 +187,19 @@ if ($action == 'add') setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { $error++; $mesg = $extrafields->error; setEventMessages($mesg, null, 'errors'); } - } - else { + } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode")); setEventMessages($mesg, null, 'errors'); $action = 'create'; } - } - else { + } else { setEventMessages($mesg, null, 'errors'); } } @@ -288,8 +283,7 @@ if ($action == 'update') $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'edit'; } - } - else { + } else { $error++; $langs->load("errors"); $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); @@ -313,8 +307,7 @@ if ($action == 'update') { $params['options'] = array($parameters=>null); } - } - else { + } else { //Esle it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { @@ -354,21 +347,18 @@ if ($action == 'update') setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { $error++; $mesg = $extrafields->error; setEventMessages($mesg, null, 'errors'); } - } - else { + } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode")); setEventMessages($mesg, null, 'errors'); } - } - else { + } else { setEventMessages($mesg, null, 'errors'); } } @@ -384,10 +374,8 @@ if ($action == 'delete') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else $mesg = $extrafields->error; - } - else { + } else $mesg = $extrafields->error; + } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode")); diff --git a/htdocs/core/actions_fetchobject.inc.php b/htdocs/core/actions_fetchobject.inc.php index 6da2b0e674e..a77fc6e5ff6 100644 --- a/htdocs/core/actions_fetchobject.inc.php +++ b/htdocs/core/actions_fetchobject.inc.php @@ -37,16 +37,14 @@ if (($id > 0 || (!empty($ref) && !in_array($action, array('create', 'createtask' { $object->fetch_thirdparty(); $id = $object->id; - } - else { + } else { if (empty($object->error) && !count($object->errors)) { if ($ret < 0) // if $ret == 0, it means not found. { setEventMessages('Fetch on object (type '.get_class($object).') return an error without filling $object->error nor $object->errors', null, 'errors'); } - } - else setEventMessages($object->error, $object->errors, 'errors'); + } else setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index aeb86f9c609..ea55052f880 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -41,8 +41,7 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) $error++; if ($_FILES['userfile']['error'][$key] == 1 || $_FILES['userfile']['error'][$key] == 2) { setEventMessages($langs->trans('ErrorFileSizeTooLarge'), null, 'errors'); - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); } } @@ -58,15 +57,13 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); - } - elseif (!empty($upload_dir)) + } elseif (!empty($upload_dir)) { $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); } } } -} -elseif (GETPOST('linkit', 'none') && !empty($conf->global->MAIN_UPLOAD_DOC)) +} elseif (GETPOST('linkit', 'none') && !empty($conf->global->MAIN_UPLOAD_DOC)) { $link = GETPOST('link', 'alpha'); if ($link) @@ -86,8 +83,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if (GETPOST('section', 'alpha')) { // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir $file = $upload_dir.(preg_match('/\/$/', $upload_dir) ? '' : '/').$urlfile; - } - else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. + } else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. { $urlfile = basename($urlfile); $file = $upload_dir.(preg_match('/\/$/', $upload_dir) ? '' : '/').$urlfile; @@ -124,8 +120,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') } else { setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); } - } - elseif ($linkid) // delete of external link + } elseif ($linkid) // delete of external link { require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $link = new Link($db); @@ -148,15 +143,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if ($backtopage) { header('Location: '.$backtopage); exit; - } - else { + } else { $tmpurl = $_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : ''); header('Location: '.$tmpurl); exit; } } -} -elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha')) +} elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha')) { require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $langs->load('link'); @@ -175,12 +168,10 @@ elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST(' { setEventMessages($langs->trans("ErrorFailedToUpdateLink", $link->label), null, 'mesgs'); } - } - else { + } else { //error fetching } -} -elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) +} elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) { // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. if (!empty($upload_dir)) @@ -233,13 +224,11 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) } setEventMessages($langs->trans("FileRenamed"), null); - } - else { + } else { $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); } - } - else { + } else { $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorDestinationAlreadyExists", $filenameto), null, 'errors'); } @@ -265,8 +254,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $ecmfile->share = getRandomPassword(true); } - } - else { + } else { $ecmfile->share = ''; } $result = $ecmfile->update($user); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 41660a47815..23c76ae81fb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -180,8 +180,7 @@ if (!$error && $massaction == 'confirm_presend') if ($val == 'thirdparty') // Id of third party or user { $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact + } elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $sendtoid[] = $val; @@ -210,8 +209,7 @@ if (!$error && $massaction == 'confirm_presend') if ($val == 'thirdparty') // Id of third party { $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val) // Id du contact + } elseif ($val) // Id du contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); //$sendtoid[] = $val; TODO Add also id of contact in CC ? @@ -256,20 +254,17 @@ if (!$error && $massaction == 'confirm_presend') if ($objectobj->element == 'societe') { $sendto = $objectobj->email; - } - elseif ($objectobj->element == 'expensereport') + } elseif ($objectobj->element == 'expensereport') { $fuser = new User($db); $fuser->fetch($objectobj->fk_user_author); $sendto = $fuser->email; - } - elseif ($objectobj->element == 'holiday') + } elseif ($objectobj->element == 'holiday') { $fuser = new User($db); $fuser->fetch($objectobj->fk_user); $sendto = $fuser->email; - } - elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) + } elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) { $emails_to_sends = array(); $objectobj->fetch_thirdparty(); @@ -283,8 +278,7 @@ if (!$error && $massaction == 'confirm_presend') if (count($emails_to_sends) > 0) { $sendto = implode(',', $emails_to_sends); } - } - else { + } else { $objectobj->fetch_thirdparty(); $sendto = $objectobj->thirdparty->email; } @@ -335,8 +329,7 @@ if (!$error && $massaction == 'confirm_presend') 'names'=>array($filename), 'mimes'=>array($mime) ); - } - else { + } else { $nbignored++; $langs->load("errors"); $resaction .= '
'.$langs->trans('ErrorCantReadFile', $file).'

'; @@ -362,19 +355,15 @@ if (!$error && $massaction == 'confirm_presend') $fromtype = GETPOST('fromtype'); if ($fromtype === 'user') { $from = $user->getFullName($langs).' <'.$user->email.'>'; - } - elseif ($fromtype === 'company') { + } elseif ($fromtype === 'company') { $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; - } - elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { $tmp = explode(',', $user->email_aliases); $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { + } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1]; $resql = $db->query($sql); $obj = $db->fetch_object($resql); @@ -382,8 +371,7 @@ if (!$error && $massaction == 'confirm_presend') { $from = $obj->label.' <'.$obj->email.'>'; } - } - else { + } else { $from = $_POST['fromname'].' <'.$_POST['frommail'].'>'; } @@ -410,8 +398,7 @@ if (!$error && $massaction == 'confirm_presend') { $looparray[$key]->thirdparty = $thirdparty; // Force thirdparty on object } - } - else { + } else { $objectforloop = new $objectclass($db); $objectforloop->thirdparty = $thirdparty; // Force thirdparty on object (even if object was not loaded) $looparray[0] = $objectforloop; @@ -461,8 +448,7 @@ if (!$error && $massaction == 'confirm_presend') ); } } - } - elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])) { + } elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])) { // Create form object // if "one email per recipient" isn't check we must separate $attachedfiles by object $attachedfiles = $attachedfilesThirdpartyObj[$thirdparty->id][$objectid]; @@ -478,8 +464,7 @@ if (!$error && $massaction == 'confirm_presend') $trackid = 'thi'.$thirdparty->id; if ($objecttmp->element == 'expensereport') $trackid = 'use'.$thirdparty->id; if ($objecttmp->element == 'holiday') $trackid = 'use'.$thirdparty->id; - } - else { + } else { $trackid = strtolower(get_class($objecttmp)); if (get_class($objecttmp) == 'Contrat') $trackid = 'con'; if (get_class($objecttmp) == 'Propal') $trackid = 'pro'; @@ -503,8 +488,7 @@ if (!$error && $massaction == 'confirm_presend') if ($mailfile->error) { $resaction .= '
'.$mailfile->error.'
'; - } - else { + } else { $result = $mailfile->sendfile(); if ($result) { @@ -569,15 +553,13 @@ if (!$error && $massaction == 'confirm_presend') $nbsent++; // Nb of object sent } - } - else { + } else { $langs->load("other"); if ($mailfile->error) { $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); $resaction .= '
'.$mailfile->error.'
'; - } - else { + } else { $resaction .= '
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; } } @@ -598,8 +580,7 @@ if (!$error && $massaction == 'confirm_presend') //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); setEventMessages($resaction, null, 'mesgs'); - } - else { + } else { //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file setEventMessages($resaction, null, 'warnings'); } @@ -714,14 +695,12 @@ if ($massaction == 'confirm_createbills') // Create bills from orders { $result = $objecttmp->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $error++; break; } - } - else { + } else { // Positive line $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Date start @@ -779,8 +758,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders if ($result > 0) { $lineid = $result; - } - else { + } else { $lineid = 0; $error++; break; @@ -870,8 +848,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); exit; - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -901,16 +878,14 @@ if (!$error && $massaction == 'cancelorders') setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); $error++; break; - } - else $result = $cmd->cancel(); + } else $result = $cmd->cancel(); if ($result < 0) { setEventMessages($cmd->error, $cmd->errors, 'errors'); $error++; break; - } - else $nbok++; + } else $nbok++; } if (!$error) { @@ -918,8 +893,7 @@ if (!$error && $massaction == 'cancelorders') setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -1020,12 +994,10 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } - } - else { + } else { // Create empty PDF $formatarray = pdf_getFormat(); $page_largeur = $formatarray['width']; @@ -1082,8 +1054,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } } @@ -1139,16 +1110,13 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); $error++; break; - } - elseif ($result < 0) + } elseif ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1160,8 +1128,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } //var_dump($listofobjectthirdparties);exit; @@ -1183,8 +1150,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio $error++; break; } else $nbok++; - } - else { + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1196,8 +1162,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -1244,10 +1209,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1259,8 +1222,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } //var_dump($listofobjectthirdparties);exit; @@ -1304,10 +1266,8 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1319,8 +1279,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index e2da8a4170c..e88fc937e38 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -75,8 +75,7 @@ if ($action == 'print_file' && $user->rights->printing->read) { setEventMessages($printer->error, $printer->errors); setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); } - } - catch (Exception $e) + } catch (Exception $e) { $ret = 1; setEventMessages($e->getMessage(), null, 'errors'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index df461e47a95..bc38d9839af 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -120,38 +120,32 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST if ($object->element == 'user' && $result == 0) $result = 1; // Even if not found, we consider ok $thirdparty = $object->thirdparty; $sendtosocid = $thirdparty->id; - } - elseif ($object->element == 'member' || $object->element == 'user') + } elseif ($object->element == 'member' || $object->element == 'user') { $thirdparty = $object; if ($object->socid > 0) $sendtosocid = $object->socid; - } - elseif ($object->element == 'expensereport') + } elseif ($object->element == 'expensereport') { $tmpuser = new User($db); $tmpuser->fetch($object->fk_user_author); $thirdparty = $tmpuser; if ($object->socid > 0) $sendtosocid = $object->socid; - } - elseif ($object->element == 'societe') + } elseif ($object->element == 'societe') { $thirdparty = $object; if ($thirdparty->id > 0) $sendtosocid = $thirdparty->id; - } - elseif ($object->element == 'contact') + } elseif ($object->element == 'contact') { $contact = $object; if ($contact->id > 0) $sendtosocid = $contact->fetch_thirdparty()->id; - } - else dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported"); + } else dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported"); if (is_object($hookmanager)) { $parameters = array(); $reshook = $hookmanager->executeHooks('initSendToSocid', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks } - } - else $thirdparty = $mysoc; + } else $thirdparty = $mysoc; if ($result > 0) { @@ -189,8 +183,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST elseif ($val == 'contact') // Key selected means current contact { $tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>'; - } - elseif ($val) // $val is the Id of a contact + } elseif ($val) // $val is the Id of a contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $sendtoid[] = $val; @@ -239,8 +232,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST elseif ($val == 'contact') // Key selected means current contact { $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>'; - } - elseif ($val) // $val is the Id of a contact + } elseif ($val) // $val is the Id of a contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); //$sendtoid[] = $val; TODO Add also id of contact in CC ? @@ -277,22 +269,17 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $fromtype = GETPOST('fromtype', 'alpha'); if ($fromtype === 'robot') { $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>'; - } - elseif ($fromtype === 'user') { + } elseif ($fromtype === 'user') { $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>'; - } - elseif ($fromtype === 'company') { + } elseif ($fromtype === 'company') { $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; - } - elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { $tmp = explode(',', $user->email_aliases); $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { + } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile'; $sql .= ' WHERE rowid = '.(int) $reg[1]; $resql = $db->query($sql); @@ -301,8 +288,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST { $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>'; } - } - else { + } else { $from = dol_string_nospecial($_POST['fromname'], ' ', array(",")).' <'.$_POST['frommail'].'>'; } @@ -419,8 +405,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = 'presend'; - } - else { + } else { $result = $mailfile->sendfile(); if ($result) { @@ -478,16 +463,14 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST if (isset($paramname2) || isset($paramval2)) $moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2; header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ? $paramname : 'id').'='.(is_object($object) ? $object->id : '').$moreparam); exit; - } - else { + } else { $langs->load("other"); $mesg = '
'; if ($mailfile->error) { $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto)); $mesg .= '
'.$mailfile->error; - } - else { + } else { $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } $mesg .= '
'; @@ -496,15 +479,13 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $action = 'presend'; } } - } - else { + } else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("MailTo")), null, 'warnings'); dol_syslog('Try to send email with no recipient defined', LOG_WARNING); $action = 'presend'; } - } - else { + } else { $langs->load("other"); setEventMessages($langs->trans('ErrorFailedToReadObject', $object->element), null, 'errors'); dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element); diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index ea407375e12..05be4a31d18 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -50,8 +50,7 @@ if ($action == 'update' && is_array($arrayofparameters)) { $db->commit(); if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors'); } @@ -110,8 +109,7 @@ if ($action == 'setModuleOptions') { $db->commit(); if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors'); } diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index d5cf3ae1b48..9fb743f1208 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -68,8 +68,7 @@ if (!isset($mode) || $mode != 'noajax') // For ajax call //dol_print_error($db,$ecmdir->error); //exit; } -} -else // For no ajax call +} else // For no ajax call { $rootdirfordoc = $conf->ecm->dir_output; @@ -85,8 +84,7 @@ else // For no ajax call } $relativepath = $ecmdir->getRelativePath(); // Example 'mydir/' - } - elseif (GETPOST('section_dir')) + } elseif (GETPOST('section_dir')) { $relativepath = GETPOST('section_dir'); } @@ -258,8 +256,7 @@ if ($type == 'directory') if (!preg_match('/pageid=/', $param)) $param .= '&pageid='.urlencode(GETPOST('pageid', 'int')); //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); } - } - else { + } else { $relativepath = $ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; } @@ -268,8 +265,7 @@ if ($type == 'directory') if (($section === '0' || empty($section)) && ($module != 'medias')) { $filearray = array(); - } - else { + } else { $filearray = dol_dir_list($upload_dir, "files", 0, '', array('^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^CVS$'), $sortfield, $sorting, 1); } @@ -279,13 +275,11 @@ if ($type == 'directory') if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref; $textifempty = $langs->trans('NoFileFound'); - } - elseif ($section === '0') + } elseif ($section === '0') { if ($module == 'ecm') $textifempty = '
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; else $textifempty = $langs->trans('NoFileFound'); - } - else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection")); + } else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection")); if ($module == 'medias') { @@ -293,8 +287,7 @@ if ($type == 'directory') $modulepart = 'medias'; $perm = ($user->rights->website->write || $user->rights->emailing->creer); $title = 'none'; - } - elseif ($module == 'ecm') // DMS/ECM -> manual structure + } elseif ($module == 'ecm') // DMS/ECM -> manual structure { if ($user->rights->ecm->read) { @@ -317,8 +310,7 @@ if ($type == 'directory') $perm = $user->rights->ecm->upload; $modulepart = 'ecm'; $title = ''; // Use default - } - else { + } else { $useinecm = 5; $modulepart = 'ecm'; $perm = $user->rights->ecm->upload; diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index f5ac3e2e422..620643da8f2 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -49,8 +49,7 @@ if (!isset($mode) || $mode != 'noajax') // For ajax call $preopened = GETPOST('preopened'); if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/' -} -else // For no ajax call +} else // For no ajax call { //if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = GETPOST('preopened'); } @@ -73,8 +72,7 @@ if ($modulepart == 'ecm') { $fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : ''); -} -elseif ($modulepart == 'medias') +} elseif ($modulepart == 'medias') { $fullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened = $dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : ''); @@ -95,8 +93,7 @@ if (preg_match('/\.\./', $fullpathselecteddir) || preg_match('/[<>|]/', $fullpat if ($modulepart == 'ecm') { if (!$user->rights->ecm->read) accessforbidden(); -} -elseif ($modulepart == 'medias') +} elseif ($modulepart == 'medias') { // Always allowed } @@ -471,8 +468,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, if ($modulepart == 'ecm') { $newfullpathselecteddir = $conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); - } - elseif ($modulepart == 'medias') + } elseif ($modulepart == 'medias') { $newfullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); } @@ -486,7 +482,6 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, echo "\n"; } - } - else print "PermissionDenied"; + } else print "PermissionDenied"; } } diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 674dab95842..98d7d00a8dc 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -60,8 +60,7 @@ if ($time >= $_SESSION['auto_check_events_not_before']) dol_syslog("We ask to check browser notification on a too large period. We fix this with current date."); $starttime = $time; } - } - else { + } else { $starttime = $time; } @@ -108,8 +107,7 @@ if ($time >= $_SESSION['auto_check_events_not_before']) $eventfound[] = $event; } - } - else { + } else { dol_syslog("Error sql = ".$db->lasterror(), LOG_ERR); } } diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index c7e5bbd8991..1ed8ca34076 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -57,8 +57,7 @@ if (!empty($action) && !empty($name)) if ($action == 'set') { dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); - } - elseif ($action == 'del') + } elseif ($action == 'del') { dolibarr_del_const($db, $name, $entity); } diff --git a/htdocs/core/ajax/extraparams.php b/htdocs/core/ajax/extraparams.php index a3db4505f70..803155ce784 100644 --- a/htdocs/core/ajax/extraparams.php +++ b/htdocs/core/ajax/extraparams.php @@ -51,20 +51,11 @@ if (!empty($id) && !empty($element) && !empty($htmlelement) && !empty($type)) $classpath = $subelement = $element; // For compatibility - if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } - elseif ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; } - elseif ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; } - elseif ($element == 'contract') { $classpath = $subelement = 'contrat'; } - elseif ($element == 'shipping') { $classpath = $subelement = 'expedition'; } - elseif ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } - elseif ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } - elseif ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; } + if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } elseif ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; } elseif ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; } elseif ($element == 'contract') { $classpath = $subelement = 'contrat'; } elseif ($element == 'shipping') { $classpath = $subelement = 'expedition'; } elseif ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } elseif ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } elseif ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; } dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php'); - if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; } - elseif ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } - else $classname = ucfirst($subelement); + if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; } elseif ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } else $classname = ucfirst($subelement); $object = new $classname($db); $object->fetch($id); diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 742e22a5a9f..b1a72868312 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -62,8 +62,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e elseif ($element == 'order_supplier') { $element = 'fournisseur'; $subelement = 'commande'; - } - elseif ($element == 'invoice_supplier') { + } elseif ($element == 'invoice_supplier') { $element = 'fournisseur'; $subelement = 'facture'; } @@ -83,8 +82,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e { $ret = $form->$methodname(); if ($ret > 0) echo json_encode($form->$cachename); - } - elseif (!empty($ext_element)) + } elseif (!empty($ext_element)) { $module = $subelement = $ext_element; if (preg_match('/^([^_]+)_([^_]+)/i', $ext_element, $regs)) @@ -99,14 +97,12 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $ret = $object->$methodname($fk_element); if ($ret > 0) echo json_encode($object->$cachename); } - } - else { + } else { $object = new GenericObject($db); $value = $object->$loadmethod($table_element, $fk_element, $field); echo $value; } - } - else { + } else { echo $langs->transnoentities('NotEnoughPermissions'); } } diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 6466df89a07..6c9f97bfbb0 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -58,11 +58,9 @@ print ''; $return .= ''; - } - else { + } else { $return .= ''; $return .= ''; } - } - else { + } else { $return .= ''; $return .= ''; } - } - else { + } else { if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { $return .= ''; $return .= ''; - } - else { + } else { $return .= ''; $return .= ''; } @@ -7443,8 +7218,7 @@ abstract class CommonObject { $return .= ''; if (($nbphoto % $nbbyrow) == 0) $return .= ''; - } - elseif ($nbbyrow < 0) $return .= ''; + } elseif ($nbbyrow < 0) $return .= ''; } if (empty($size)) { // Format origine @@ -7533,8 +7307,7 @@ abstract class CommonObject { if (isset($info['type']) && ($info['type'] == 'duration')) return true; else return false; - } - else return false; + } else return false; } /** @@ -7549,8 +7322,7 @@ abstract class CommonObject { if (isset($info['type']) && ($info['type'] == 'int' || preg_match('/^integer/i', $info['type']))) return true; else return false; - } - else return false; + } else return false; } /** @@ -7654,12 +7426,10 @@ abstract class CommonObject if (empty($this->{$field})) { $queryarray[$field] = null; - } - else { + } else { $queryarray[$field] = $this->db->idate($this->{$field}); } - } - elseif ($this->isArray($info)) + } elseif ($this->isArray($info)) { if (!empty($this->{$field})) { if (!is_array($this->{$field})) { @@ -7669,14 +7439,12 @@ abstract class CommonObject } else { $queryarray[$field] = null; } - } - elseif ($this->isDuration($info)) + } elseif ($this->isDuration($info)) { // $this->{$field} may be null, '', 0, '0', 123, '123' if ($this->{$field} != '' || !empty($info['notnull'])) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 else $queryarray[$field] = null; - } - elseif ($this->isInt($info) || $this->isFloat($info)) + } elseif ($this->isInt($info) || $this->isFloat($info)) { if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity; else { @@ -7684,11 +7452,9 @@ abstract class CommonObject if ($this->{$field} != '' || !empty($info['notnull'])) { if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 - } - else $queryarray[$field] = null; + } else $queryarray[$field] = null; } - } - else { + } else { $queryarray[$field] = $this->{$field}; } @@ -7713,8 +7479,7 @@ abstract class CommonObject { if (empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0; else $this->{$field} = strtotime($obj->{$field}); - } - elseif ($this->isArray($info)) + } elseif ($this->isArray($info)) { if (!empty($obj->{$field})) { $this->{$field} = @unserialize($obj->{$field}); @@ -7723,8 +7488,7 @@ abstract class CommonObject } else { $this->{$field} = array(); } - } - elseif ($this->isInt($info)) + } elseif ($this->isInt($info)) { if ($field == 'rowid') $this->id = (int) $obj->{$field}; else { @@ -7732,8 +7496,7 @@ abstract class CommonObject { if (empty($obj->{$field})) $this->{$field} = null; else $this->{$field} = (double) $obj->{$field}; - } - else { + } else { if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->{$field} = (int) $obj->{$field}; } else { @@ -7741,23 +7504,20 @@ abstract class CommonObject } } } - } - elseif ($this->isFloat($info)) + } elseif ($this->isFloat($info)) { if ($this->isForcedToNullIfZero($info)) { if (empty($obj->{$field})) $this->{$field} = null; else $this->{$field} = (double) $obj->{$field}; - } - else { + } else { if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->{$field} = (double) $obj->{$field}; } else { $this->{$field} = null; } } - } - else { + } else { $this->{$field} = $obj->{$field}; } } @@ -7970,12 +7730,10 @@ abstract class CommonObject { $this->setVarsFromFetchObj($obj); return $this->id; - } - else { + } else { return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; return -1; @@ -8023,8 +7781,7 @@ abstract class CommonObject } return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; return -1; @@ -8151,8 +7908,7 @@ abstract class CommonObject return -1; } } - } - elseif (!empty($this->fk_element) && !empty($this->childtables)) // If object has childs linked with a foreign key field, we check all child tables. + } elseif (!empty($this->fk_element) && !empty($this->childtables)) // If object has childs linked with a foreign key field, we check all child tables. { $objectisused = $this->isObjectUsed($this->id); if (!empty($objectisused)) @@ -8318,8 +8074,7 @@ abstract class CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 9edbe27aae0..f92004120ff 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -82,8 +82,7 @@ abstract class CommonObjectLine extends CommonObject $label = $res[$label_type]; $this->db->free($resql); return $label; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR); return -1; diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 50330f26b17..6c832c4788d 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -175,8 +175,7 @@ abstract class CommonStickerGenerator $hauteur = abs($y1 - $y2); if ($length > $hauteur) { $Pointilles = ($length / $nbPointilles) / 2; // taille des pointilles - } - else { + } else { $Pointilles = ($hauteur / $nbPointilles) / 2; } for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e535a4f0ca4..4bcbf3e2e99 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -251,8 +251,7 @@ class Conf { try { date_default_timezone_set($this->global->MAIN_SERVER_TZ); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR); } @@ -334,8 +333,7 @@ class Conf // For backward compatibility $this->$module->$dirname = $rootfordata."/".$name; - } - else { + } else { // For multicompany sharings $this->$module->$multidirname = array($this->entity => $rootfortemp."/".$name."/temp"); diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index 0b017022e41..caaeb706c32 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -74,8 +74,7 @@ class CoreObject extends CommonObject $this->is_clone = false; return true; - } - else { + } else { return false; } } @@ -92,8 +91,7 @@ class CoreObject extends CommonObject if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) { return $this->{'is_'.$type}($this->fields[$field]); - } - else { + } else { return false; } } @@ -197,8 +195,7 @@ class CoreObject extends CommonObject $this->{$className}[] = $o; } - } - else { + } else { $this->errors[] = $this->db->lasterror(); } } @@ -253,8 +250,7 @@ class CoreObject extends CommonObject $result = $this->call_trigger(strtoupper($this->element).'_UPDATE', $user); if ($result < 0) $error++; else $this->saveChild($user); - } - else { + } else { $error++; $this->error = $this->db->lasterror(); $this->errors[] = $this->error; @@ -264,8 +260,7 @@ class CoreObject extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -292,8 +287,7 @@ class CoreObject extends CommonObject $result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user); if ($result < 0) $error++; else $this->saveChild($user); - } - else { + } else { $error++; $this->error = $this->db->lasterror(); $this->errors[] = $this->error; @@ -303,8 +297,7 @@ class CoreObject extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -349,8 +342,7 @@ class CoreObject extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; $this->db->rollback(); @@ -386,8 +378,7 @@ class CoreObject extends CommonObject if (empty($date)) { $this->{$field} = 0; - } - else { + } else { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $this->{$field} = dol_stringtotime($date); } @@ -409,15 +400,12 @@ class CoreObject extends CommonObject if ($this->checkFieldType($key, 'date')) { $this->setDate($key, $value); - } - elseif ($this->checkFieldType($key, 'float')) + } elseif ($this->checkFieldType($key, 'float')) { $this->{$key} = (double) price2num($value); - } - elseif ($this->checkFieldType($key, 'int')) { + } elseif ($this->checkFieldType($key, 'int')) { $this->{$key} = (int) price2num($value); - } - else { + } else { $this->{$key} = dol_string_nohtmltag($value); } } diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 9f49e77f35a..34ef707b674 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -132,8 +132,7 @@ class Cstate // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -175,8 +174,7 @@ class Cstate // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -262,8 +260,7 @@ class Cstate // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 8e567a552b2..07d3563088e 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -136,8 +136,7 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -184,8 +183,7 @@ class Ctypent // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -238,8 +236,7 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -277,8 +274,7 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 80ea8e2f0cc..ac7b07ea5a9 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -135,8 +135,7 @@ class CUnits // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -194,8 +193,7 @@ class CUnits // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -234,14 +232,11 @@ class CUnits // extends CommonObject foreach ($filter as $key => $value) { if ($key == 't.rowid' || $key == 't.active' || $key == 't.scale') { $sqlwhere[] = $key.'='.(int) $value; - } - elseif (strpos($key, 'date') !== false) { + } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 't.unit_type' || $key == 't.code' || $key == 't.short_label') { + } elseif ($key == 't.unit_type' || $key == 't.code' || $key == 't.short_label') { $sqlwhere[] = $key.' = \''.$this->db->escape($value).'\''; - } - else { + } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -337,8 +332,7 @@ class CUnits // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -376,8 +370,7 @@ class CUnits // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -395,8 +388,7 @@ class CUnits // extends CommonObject if ($mode == 'short_label'){ return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid'); - } - elseif ($mode == 'code'){ + } elseif ($mode == 'code'){ return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid'); } diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 8cf13771d35..4cddc65d636 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -187,13 +187,11 @@ class DiscountAbsolute $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -262,8 +260,7 @@ class DiscountAbsolute { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except"); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror().' - sql='.$sql; return -1; } @@ -300,8 +297,7 @@ class DiscountAbsolute $this->error = 'ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved'; return -2; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -327,8 +323,7 @@ class DiscountAbsolute $this->error = 'ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved'; return -2; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -363,14 +358,12 @@ class DiscountAbsolute { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } - } - elseif ($this->fk_invoice_supplier_source) { + } elseif ($this->fk_invoice_supplier_source) { $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; $sql .= " set paye=0, fk_statut=1"; $sql .= " WHERE (type = 2 or type = 3) AND rowid=".$this->fk_invoice_supplier_source; @@ -381,19 +374,16 @@ class DiscountAbsolute { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } - } - else { + } else { $this->db->commit(); return 1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -449,8 +439,7 @@ class DiscountAbsolute $this->fk_facture = $rowidinvoice; } return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -480,8 +469,7 @@ class DiscountAbsolute if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -557,15 +545,13 @@ class DiscountAbsolute $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql .= ' AND f.type = 3'; - } - elseif ($invoice->element == 'invoice_supplier') + } elseif ($invoice->element == 'invoice_supplier') { $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id; $sql .= ' AND f.type = 3'; - } - else { + } else { $this->error = get_class($this)."::getSumDepositsUsed was called with a bad object as a first parameter"; dol_print_error($this->error); return -1; @@ -577,8 +563,7 @@ class DiscountAbsolute $obj = $this->db->fetch_object($resql); if ($multicurrency == 1) return $obj->multicurrency_amount; else return $obj->amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -601,15 +586,13 @@ class DiscountAbsolute $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql .= ' AND f.type IN ('.$invoice::TYPE_STANDARD.', '.$invoice::TYPE_CREDIT_NOTE.', '.$invoice::TYPE_SITUATION.')'; // Find discount coming from credit note or excess received - } - elseif ($invoice->element == 'invoice_supplier') + } elseif ($invoice->element == 'invoice_supplier') { $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id; $sql .= ' AND f.type IN ('.$invoice::TYPE_STANDARD.', '.$invoice::TYPE_CREDIT_NOTE.')'; // Find discount coming from credit note or excess paid - } - else { + } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; dol_print_error($this->error); return -1; @@ -621,8 +604,7 @@ class DiscountAbsolute $obj = $this->db->fetch_object($resql); if ($multicurrency == 1) return $obj->multicurrency_amount; else return $obj->amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -643,14 +625,12 @@ class DiscountAbsolute $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc'; $sql .= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.$invoice->id; - } - elseif ($invoice->element == 'invoice_supplier') + } elseif ($invoice->element == 'invoice_supplier') { $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc'; $sql .= ' WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = '.$invoice->id; - } - else { + } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; dol_print_error($this->error); return -1; @@ -662,8 +642,7 @@ class DiscountAbsolute $obj = $this->db->fetch_object($resql); if ($multicurrency) return $obj->multicurrency_amount; else return $obj->amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 743f2968289..2b148a96e8a 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -55,16 +55,14 @@ class DolGeoIP { require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar'; } - } - elseif ($type == 'city') + } elseif ($type == 'city') { // geoip may have been already included with PEAR if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) { require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar'; } - } - else { print 'ErrorBadParameterInConstructor'; return 0; } + } else { print 'ErrorBadParameterInConstructor'; return 0; } // Here, function exists (embedded into PHP or exists because we made include) if (empty($type) || empty($datfile)) @@ -85,19 +83,16 @@ class DolGeoIP { try { $this->gi = new GeoIp2\Database\Reader($datfile); // '/usr/local/share/GeoIP/GeoIP2-City.mmdb' - } - catch (Exception $e) + } catch (Exception $e) { $this->error = $e->getMessage(); dol_syslog('DolGeoIP '.$this->errorlabel, LOG_ERR); return 0; } - } - elseif (function_exists('geoip_open')) + } elseif (function_exists('geoip_open')) { $this->gi = geoip_open($datfile, GEOIP_STANDARD); - } - else { + } else { $this->gi = 'NOGI'; // We are using embedded php geoip functions //print 'function_exists(geoip_country_code_by_name))='.function_exists('geoip_country_code_by_name'); //print geoip_database_info(); @@ -125,8 +120,7 @@ class DolGeoIP { // geoip_country_code_by_addr does not exists return strtolower(geoip_country_code_by_name($ip)); - } - else { + } else { if (preg_match('/^[0-9]+.[0-9]+\.[0-9]+\.[0-9]+/', $ip)) { if ($geoipversion == '2') @@ -134,30 +128,25 @@ class DolGeoIP try { $record = $this->gi->country($ip); return strtolower($record->country->isoCode); - } - catch (Exception $e) { + } catch (Exception $e) { //return $e->getMessage(); return ''; } - } - else { + } else { if (!function_exists('geoip_country_code_by_addr')) return strtolower(geoip_country_code_by_name($this->gi, $ip)); return strtolower(geoip_country_code_by_addr($this->gi, $ip)); } - } - else { + } else { if ($geoipversion == '2') { try { $record = $this->gi->country($ip); return strtolower($record->country->isoCode); - } - catch (Exception $e) { + } catch (Exception $e) { //return $e->getMessage(); return ''; } - } - else { + } else { if (!function_exists('geoip_country_code_by_addr_v6')) return strtolower(geoip_country_code_by_name_v6($this->gi, $ip)); return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); } @@ -188,13 +177,11 @@ class DolGeoIP try { $record = $this->gi->country($name); return $record->country->isoCode; - } - catch (Exception $e) { + } catch (Exception $e) { //return $e->getMessage(); return ''; } - } - else { + } else { return geoip_country_code_by_name($this->gi, $name); } } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index b840f767a97..4ca072897bb 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -472,12 +472,10 @@ class DolGraph { //print 'ee'.join(',',$theme_bgcoloronglet); $this->bgcolor = $theme_bgcoloronglet; - } - else { + } else { $this->bgcolor = $theme_bgcolor; } - } - else { + } else { $this->bgcolor = $bg_color; } } @@ -500,12 +498,10 @@ class DolGraph { //print 'ee'.join(',',$theme_bgcoloronglet); $this->bgcolorgrid = $theme_bgcoloronglet; - } - else { + } else { $this->bgcolorgrid = $theme_bgcolor; } - } - else { + } else { $this->bgcolorgrid = $bg_colorgrid; } } @@ -721,8 +717,7 @@ class DolGraph foreach ($values as $x => $y) { if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n"; } - } - else { + } else { foreach ($values as $x => $y) { if (isset($y)) $serie[$i] .= 'd'.$i.'.push(['.$x.', '.$y.']);'."\n"; } @@ -753,8 +748,7 @@ class DolGraph if ($nblot < 0) { $this->stringtoshow .= ''."\n"; - } - else { + } else { while ($i < $nblot) { $this->stringtoshow .= ''."\n"; @@ -893,8 +887,7 @@ class DolGraph elseif ($i == $firstlot + 1) $align = 'center'; else $align = 'left'; $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.$align.'", barWidth: 0.45 }, '; - } - else $this->stringtoshow.='bars: { lineWidth: 1, show: true, align: "'.($i==$firstlot?'center':'left').'", barWidth: 0.5 }, '; + } else $this->stringtoshow.='bars: { lineWidth: 1, show: true, align: "'.($i==$firstlot?'center':'left').'", barWidth: 0.5 }, '; } if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: '.($this->type[$i] == 'linesnopoint' ? 'false' : 'true').' }, '; $this->stringtoshow .= 'color: "#'.$color.'", label: "'.(isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '').'", data: d'.$i.' }'; @@ -1051,8 +1044,7 @@ class DolGraph if ($nblot < 0) { $this->stringtoshow .= ''; - } - else { + } else { while ($i < $nblot) { //$this->stringtoshow .= ''."\n"; @@ -1095,8 +1087,7 @@ class DolGraph if (strpos($tmp, '-') !== false) { $foundnegativecolor++; $color = '#FFFFFF'; // If $val is '-123' - } - else $color = "#".$tmp; // If $val is '123' or '#123' + } else $color = "#".$tmp; // If $val is '123' or '#123' } $this->stringtoshow .= "'".$color."'"; $i++; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index e390565748a..25a0d2a25c5 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -350,28 +350,23 @@ class EmailSenderProfile extends CommonObject { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 6) + } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); @@ -424,8 +419,7 @@ class EmailSenderProfile extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index cd6e3b42e0a..bffd23f05d2 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -173,8 +173,7 @@ class Events // extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."events"); return $this->id; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -259,8 +258,7 @@ class Events // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4157870972d..c82e877fa80 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -253,10 +253,8 @@ class ExtraFields $this->error = ''; $this->errno = 0; return 1; - } - else return -2; - } - else { + } else return -2; + } else { return -1; } } @@ -337,14 +335,12 @@ class ExtraFields $resql = $this->db->query($sql, 1, 'dml'); } return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); return -1; } - } - else { + } else { return 0; } } @@ -398,12 +394,10 @@ class ExtraFields if (is_array($param) && count($param) > 0) { $params = serialize($param); - } - elseif (strlen($param) > 0) + } elseif (strlen($param) > 0) { $params = trim($param); - } - else { + } else { $params = ''; } @@ -461,8 +455,7 @@ class ExtraFields if ($this->db->query($sql)) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); return -1; @@ -522,8 +515,7 @@ class ExtraFields } return $result; - } - else { + } else { return 0; } } @@ -556,13 +548,11 @@ class ExtraFields if ($resql) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } - } - else { + } else { return 0; } } @@ -651,25 +641,21 @@ class ExtraFields if ($unique) { $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; - } - else { + } else { $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname; } dol_syslog(get_class($this).'::update', LOG_DEBUG); $resql = $this->db->query($sql, 1, 'dml'); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { return 0; } } @@ -727,12 +713,10 @@ class ExtraFields if (is_array($param) && count($param) > 0) { $params = serialize($param); - } - elseif (strlen($param) > 0) + } elseif (strlen($param) > 0) { $params = trim($param); - } - else { + } else { $params = ''; } @@ -743,8 +727,7 @@ class ExtraFields $sql_del .= " WHERE name = '".$attrname."'"; $sql_del .= " AND entity IN (0, ".($entity === '' ? $conf->entity : $entity).")"; $sql_del .= " AND elementtype = '".$elementtype."'"; - } - else { + } else { // We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity) $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; $sql_del .= " WHERE name = '".$attrname."'"; @@ -809,14 +792,12 @@ class ExtraFields { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_print_error($this->db); return -1; } - } - else { + } else { return 0; } } @@ -916,8 +897,7 @@ class ExtraFields } } if ($elementtype) $this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded' - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR); } @@ -974,8 +954,7 @@ class ExtraFields $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } - else // Old usage + } else // Old usage { $label = $this->attribute_label[$key]; $type = $this->attribute_type[$key]; @@ -1003,37 +982,29 @@ class ExtraFields if ($type == 'date') { $morecss = 'minwidth100imp'; - } - elseif ($type == 'datetime' || $type == 'link') + } elseif ($type == 'datetime' || $type == 'link') { $morecss = 'minwidth200imp'; - } - elseif (in_array($type, array('int', 'integer', 'double', 'price'))) + } elseif (in_array($type, array('int', 'integer', 'double', 'price'))) { $morecss = 'maxwidth75'; - } - elseif ($type == 'password') + } elseif ($type == 'password') { $morecss = 'maxwidth100'; - } - elseif ($type == 'url') + } elseif ($type == 'url') { $morecss = 'minwidth400'; - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { $morecss = ''; - } - else { + } else { if (round($size) < 12) { $morecss = 'minwidth100'; - } - elseif (round($size) <= 48) + } elseif (round($size) <= 48) { $morecss = 'minwidth200'; - } - else { + } else { $morecss = 'minwidth400'; } } @@ -1051,46 +1022,38 @@ class ExtraFields // TODO Must also support $moreparam $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); - } - elseif (in_array($type, array('int', 'integer'))) + } elseif (in_array($type, array('int', 'integer'))) { $tmp = explode(',', $size); $newsize = $tmp[0]; $out = ''; - } - elseif (preg_match('/varchar/', $type)) + } elseif (preg_match('/varchar/', $type)) { $out = ''; - } - elseif (in_array($type, array('mail', 'phone', 'url'))) + } elseif (in_array($type, array('mail', 'phone', 'url'))) { $out = ''; - } - elseif ($type == 'text') + } elseif ($type == 'text') { if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); $out = $doleditor->Create(1); - } - else { + } else { $out = ''; } - } - elseif ($type == 'html') + } elseif ($type == 'html') { if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); $out = $doleditor->Create(1); - } - else { + } else { $out = ''; } - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { if (empty($mode)) { @@ -1101,26 +1064,22 @@ class ExtraFields $checked = ' value="1" '; } $out = ''; - } - else { + } else { $out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); } - } - elseif ($type == 'price') + } elseif ($type == 'price') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value = price($value); } $out = ' '.$langs->getCurrencySymbol($conf->currency); - } - elseif ($type == 'double') + } elseif ($type == 'double') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value = price($value); } $out = ' '; - } - elseif ($type == 'select') + } elseif ($type == 'select') { $out = ''; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) @@ -1144,8 +1103,7 @@ class ExtraFields $out .= ''; } $out .= ''; - } - elseif ($type == 'sellist') + } elseif ($type == 'sellist') { $out = ''; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) @@ -1304,13 +1262,11 @@ class ExtraFields } } $out .= ''; - } - elseif ($type == 'checkbox') + } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); - } - elseif ($type == 'radio') + } elseif ($type == 'radio') { $out = ''; foreach ($param['options'] as $keyopt => $val) @@ -1321,13 +1277,11 @@ class ExtraFields $out .= ($value == $keyopt ? 'checked' : ''); $out .= '/>
'; } - } - elseif ($type == 'chkbxlst') + } elseif ($type == 'chkbxlst') { if (is_array($value)) { $value_arr = $value; - } - else { + } else { $value_arr = explode(',', $value); } @@ -1525,14 +1479,12 @@ class ExtraFields $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); } } - } - elseif ($type == 'link') + } elseif ($type == 'link') { $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' $showempty = (($required && $default != '') ? 0 : 1); $out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss); - } - elseif ($type == 'password') + } elseif ($type == 'password') { // If prefix is 'search_', field is used as a filter, we use a common text field. $out = ''; // Hidden field to reduce impact of evil Google Chrome autopopulate bug. @@ -1580,8 +1532,7 @@ class ExtraFields $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } - else // Old usage + } else // Old usage { //dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING); $label = $this->attribute_label[$key]; @@ -1608,17 +1559,14 @@ class ExtraFields { $showsize = 10; $value = dol_print_date($value, 'day'); - } - elseif ($type == 'datetime') + } elseif ($type == 'datetime') { $showsize = 19; $value = dol_print_date($value, 'dayhour'); - } - elseif ($type == 'int') + } elseif ($type == 'int') { $showsize = 10; - } - elseif ($type == 'double') + } elseif ($type == 'double') { if (!empty($value)) { //$value=price($value); @@ -1626,38 +1574,31 @@ class ExtraFields $number_decimals = $sizeparts[1]; $value = price($value, 0, $langs, 0, 0, $number_decimals, ''); } - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { $checked = ''; if (!empty($value)) { $checked = ' checked '; } $value = ''; - } - elseif ($type == 'mail') + } elseif ($type == 'mail') { $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); - } - elseif ($type == 'url') + } elseif ($type == 'url') { $value = dol_print_url($value, '_blank', 32, 1); - } - elseif ($type == 'phone') + } elseif ($type == 'phone') { $value = dol_print_phone($value, '', 0, 0, '', ' ', 'phone'); - } - elseif ($type == 'price') + } elseif ($type == 'price') { //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') $value = price($value, 0, $langs, 0, 0, -1); - } - elseif ($type == 'select') + } elseif ($type == 'select') { if ($langfile && $param['options'][$value]) $value = $langs->trans($param['options'][$value]); else $value = $param['options'][$value]; - } - elseif ($type == 'sellist') + } elseif ($type == 'sellist') { $param_list = array_keys($param['options']); $InfoFieldList = explode(":", $param_list[0]); @@ -1718,8 +1659,7 @@ class ExtraFields $value .= $obj->$field_toshow.' '; } } - } - else { + } else { $translabel = ''; if (!empty($obj->{$InfoFieldList[1]})) { $translabel = $langs->trans($obj->{$InfoFieldList[1]}); @@ -1730,14 +1670,11 @@ class ExtraFields $value = $obj->{$InfoFieldList[1]}; } } - } - else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); - } - elseif ($type == 'radio') + } else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); + } elseif ($type == 'radio') { $value = $param['options'][$value]; - } - elseif ($type == 'checkbox') + } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); $value = ''; @@ -1749,8 +1686,7 @@ class ExtraFields } } $value = '
'; - } - elseif ($type == 'chkbxlst') + } elseif ($type == 'chkbxlst') { $value_arr = explode(',', $value); @@ -1817,8 +1753,7 @@ class ExtraFields } else { dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); } - } - elseif ($type == 'link') + } elseif ($type == 'link') { $out = ''; @@ -1839,26 +1774,21 @@ class ExtraFields $object->fetch($value); $value = $object->getNomUrl(3); } - } - else { + } else { dol_syslog('Error bad setup of extrafield', LOG_WARNING); return 'Error bad setup of extrafield'; } } - } - elseif ($type == 'text') + } elseif ($type == 'text') { $value = dol_htmlentitiesbr($value); - } - elseif ($type == 'html') + } elseif ($type == 'html') { $value = dol_htmlentitiesbr($value); - } - elseif ($type == 'password') + } elseif ($type == 'password') { $value = dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1); - } - else { + } else { $showsize = round($size); if ($showsize > 48) $showsize = 48; } @@ -1888,36 +1818,28 @@ class ExtraFields if ($type == 'date') { $align = "center"; - } - elseif ($type == 'datetime') + } elseif ($type == 'datetime') { $align = "center"; - } - elseif ($type == 'int') + } elseif ($type == 'int') { $align = "right"; - } - elseif ($type == 'price') + } elseif ($type == 'price') { $align = "right"; - } - elseif ($type == 'double') + } elseif ($type == 'double') { $align = "right"; - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { $align = "center"; - } - elseif ($type == 'radio') + } elseif ($type == 'radio') { $align = "center"; - } - elseif ($type == 'checkbox') + } elseif ($type == 'checkbox') { $align = "center"; - } - elseif ($type == 'price') + } elseif ($type == 'price') { $align = "right"; } @@ -2040,14 +1962,12 @@ class ExtraFields // Clean parameters // TODO GMT date in memory must be GMT so we should add gm=true in parameters $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - elseif (in_array($key_type, array('datetime'))) + } elseif (in_array($key_type, array('datetime'))) { // Clean parameters // TODO GMT date in memory must be GMT so we should add gm=true in parameters $value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) + } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { $value_arr = GETPOST("options_".$key, 'array'); // check if an array if (!empty($value_arr)) { @@ -2055,13 +1975,11 @@ class ExtraFields } else { $value_key = ''; } - } - elseif (in_array($key_type, array('price', 'double'))) + } elseif (in_array($key_type, array('price', 'double'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); - } - else { + } else { $value_key = GETPOST("options_".$key); if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = ''; } @@ -2073,12 +1991,10 @@ class ExtraFields $langs->load('errors'); setEventMessages($langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors'); return -1; - } - else { + } else { return 1; } - } - else { + } else { return 0; } } @@ -2098,8 +2014,7 @@ class ExtraFields if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label'])) { $extralabels = $this->attributes[$extrafieldsobjectkey]['label']; - } - else { + } else { $extralabels = $extrafieldsobjectkey; } @@ -2121,22 +2036,19 @@ class ExtraFields if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) continue; // Value was not provided, we should not set it. // Clean parameters $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); - } - elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) + } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); // Make sure we get an array even if there's only one checkbox $value_arr = (array) $value_arr; $value_key = implode(',', $value_arr); - } - elseif (in_array($key_type, array('price', 'double', 'int'))) + } elseif (in_array($key_type, array('price', 'double', 'int'))) { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); $value_key = price2num($value_arr); - } - else { + } else { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); } diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index f549c7520f7..c941a3a0745 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -64,46 +64,36 @@ class FileUpload if ($element == 'propal') { $pathname = 'comm/propal'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'facture') { + } elseif ($element == 'facture') { $pathname = 'compta/facture'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'project') { + } elseif ($element == 'project') { $element = $pathname = 'projet'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'project_task') { + } elseif ($element == 'project_task') { $pathname = 'projet'; $filename = 'task'; $dir_output = $conf->projet->dir_output; $parentForeignKey = 'fk_project'; $parentClass = 'Project'; $parentElement = 'projet'; $parentObject = 'project'; - } - elseif ($element == 'fichinter') { + } elseif ($element == 'fichinter') { $element = 'ficheinter'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'order_supplier') { + } elseif ($element == 'order_supplier') { $pathname = 'fourn'; $filename = 'fournisseur.commande'; $dir_output = $conf->fournisseur->commande->dir_output; - } - elseif ($element == 'invoice_supplier') { + } elseif ($element == 'invoice_supplier') { $pathname = 'fourn'; $filename = 'fournisseur.facture'; $dir_output = $conf->fournisseur->facture->dir_output; - } - elseif ($element == 'product') { + } elseif ($element == 'product') { $dir_output = $conf->product->multidir_output[$conf->entity]; - } - elseif ($element == 'productbatch') { + } elseif ($element == 'productbatch') { $dir_output = $conf->productbatch->multidir_output[$conf->entity]; - } - elseif ($element == 'action') { + } elseif ($element == 'action') { $pathname = 'comm/action'; $filename = 'actioncomm'; $dir_output = $conf->agenda->dir_output; - } - elseif ($element == 'chargesociales') { + } elseif ($element == 'chargesociales') { $pathname = 'compta/sociales'; $filename = 'chargesociales'; $dir_output = $conf->tax->dir_output; } else { @@ -298,8 +288,7 @@ class FileUpload if (preg_match('/error/i', $res)) return false; return true; - } - else { + } else { return false; } } @@ -450,8 +439,7 @@ class FileUpload } else { dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile'); } - } - else { + } else { // Non-multipart uploads (PUT method support) file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0); } @@ -467,8 +455,7 @@ class FileUpload $file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]); } } - } - elseif ($this->options['discard_aborted_uploads']) + } elseif ($this->options['discard_aborted_uploads']) { unlink($file_path); $file->error = 'abort'; @@ -491,8 +478,7 @@ class FileUpload if ($file_name) { $info = $this->getFileObject($file_name); - } - else { + } else { $info = $this->getFileObjects(); } header('Content-type: application/json'); diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index a09d0bc3e30..0686b68115a 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -157,14 +157,12 @@ class Fiscalyear extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return $result; } - } - else { + } else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -1; @@ -204,8 +202,7 @@ class Fiscalyear extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog($this->error, LOG_ERR); $this->db->rollback(); @@ -239,8 +236,7 @@ class Fiscalyear extends CommonObject $this->statut = $obj->statut; return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -264,8 +260,7 @@ class Fiscalyear extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -299,27 +294,22 @@ class Fiscalyear extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); @@ -364,8 +354,7 @@ class Fiscalyear extends CommonObject $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -396,8 +385,7 @@ class Fiscalyear extends CommonObject { $obj = $this->db->fetch_object($resql); $nb = $obj->nb; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return $nb; } @@ -428,8 +416,7 @@ class Fiscalyear extends CommonObject { $obj = $this->db->fetch_object($resql); $nb = $obj->nb; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return $nb; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 353102b6189..bfccd8e9b03 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -124,8 +124,7 @@ class Form } if ($fieldrequired) $ret .= ''; $ret .= ''."\n"; - } - else { + } else { if ($fieldrequired) $ret .= ''; if ($help) { $ret .= $this->textwithpicto($langs->trans($text), $help); @@ -134,8 +133,7 @@ class Form } if ($fieldrequired) $ret .= ''; } - } - else { + } else { if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) $ret .= '
'; if ($fieldrequired) $ret .= ''; if ($help) { @@ -188,8 +186,7 @@ class Form if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) // TODO add jquery timepicker and support select { $ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); - } - else { + } else { if (GETPOST('action', 'aZ09') == 'edit'.$htmlname) { $ret .= "\n"; @@ -203,14 +200,12 @@ class Form { $tmp = explode(':', $typeofdata); $ret .= ''; - } - elseif (preg_match('/^(numeric|amount)/', $typeofdata)) + } elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { $tmp = explode(':', $typeofdata); $valuetoshow = price2num($editvalue ? $editvalue : $value); $ret .= ''; - } - elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor' + } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor' { $tmp = explode(':', $typeofdata); $cols = $tmp[2]; @@ -228,16 +223,13 @@ class Form $valuetoshow = str_replace('&', '&', $valuetoshow); $ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea')); $ret .= ''; - } - elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') + } elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, 0); - } - elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') + } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, 0); - } - elseif (preg_match('/^select;/', $typeofdata)) + } elseif (preg_match('/^select;/', $typeofdata)) { $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); $arraylist = array(); @@ -248,8 +240,7 @@ class Form $arraylist[$tmpkey] = $tmp[1]; } $ret .= $this->selectarray($htmlname, $arraylist, $value); - } - elseif (preg_match('/^ckeditor/', $typeofdata)) + } elseif (preg_match('/^ckeditor/', $typeofdata)) { $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -267,8 +258,7 @@ class Form if (empty($notabletag)) $ret .= '
'."\n"; $ret .= ''."\n"; - } - else { + } else { if (preg_match('/^(email)/', $typeofdata)) $ret .= dol_print_email($value, 0, 0, 0, 0, 1); elseif (preg_match('/^(amount|numeric)/', $typeofdata)) $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : ''); elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) $ret .= dol_htmlentitiesbr($value); @@ -285,8 +275,7 @@ class Form $arraylist[$tmp[0]] = $tmp[1]; } $ret .= $arraylist[$value]; - } - elseif (preg_match('/^ckeditor/', $typeofdata)) + } elseif (preg_match('/^ckeditor/', $typeofdata)) { $tmpcontent = dol_htmlentitiesbr($value); if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) @@ -298,8 +287,7 @@ class Form // We dont use dol_escape_htmltag to get the html formating active, but this need we must also // clean data from some dangerous html $ret .= dol_string_onlythesehtmltags(dol_htmlentitiesbr($tmpcontent)); - } - else { + } else { $ret .= dol_escape_htmltag($value); } @@ -437,8 +425,7 @@ class Form if (!empty($tmp[1])) $inputOption = $tmp[1]; if (!empty($tmp[2])) $savemethod = $tmp[2]; $out .= ''."\n"; - } - elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) + } elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { $tmp = explode(':', $inputType); $inputType = $tmp[0]; @@ -446,22 +433,19 @@ class Form if (!empty($tmp[2])) $savemethod = $tmp[2]; $out .= ''."\n"; // Use for timestamp format - } - elseif (preg_match('/^(select|autocomplete)/', $inputType)) + } elseif (preg_match('/^(select|autocomplete)/', $inputType)) { $tmp = explode(':', $inputType); $inputType = $tmp[0]; $loadmethod = $tmp[1]; if (!empty($tmp[2])) $savemethod = $tmp[2]; if (!empty($tmp[3])) $button_only = true; - } - elseif (preg_match('/^textarea/', $inputType)) + } elseif (preg_match('/^textarea/', $inputType)) { $tmp = explode(':', $inputType); $inputType = $tmp[0]; $rows = (empty($tmp[1]) ? '8' : $tmp[1]); $cols = (empty($tmp[2]) ? '80' : $tmp[2]); - } - elseif (preg_match('/^ckeditor/', $inputType)) + } elseif (preg_match('/^ckeditor/', $inputType)) { $tmp = explode(':', $inputType); $inputType = $tmp[0]; $toolbar = $tmp[1]; @@ -472,8 +456,7 @@ class Form if (!empty($conf->fckeditor->enabled)) { $out .= ''."\n"; - } - else { + } else { $inputType = 'textarea'; } } @@ -492,8 +475,7 @@ class Form $out .= ''."\n"; if (!empty($custommsg['error'])) $out .= ''."\n"; - } - else $out .= ''."\n"; + } else $out .= ''."\n"; } if ($inputType == 'textarea') { $out .= ''."\n"; @@ -501,8 +483,7 @@ class Form } $out .= ''.$value.''."\n"; $out .= ''.(!empty($editvalue) ? $editvalue : $value).''."\n"; - } - else { + } else { $out = $value; } @@ -550,8 +531,7 @@ class Form if ($tooltiptrigger == '') { $htmltext = str_replace('"', '"', $htmltext); - } - else { + } else { $classfortooltip = 'classfortooltiponclick'; $textfordialog .= ''; } @@ -560,15 +540,13 @@ class Form $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; if ($tooltiptrigger == '') $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip else $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; - } - else $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag + } else $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag if ($tooltipon == 1 || $tooltipon == 3) { $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; if ($tooltiptrigger == '') $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip else $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; - } - else $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag + } else $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag if (empty($notabs)) $s .= ''; elseif ($notabs == 2) $s .= '
'; // Define value if value is before @@ -849,8 +827,7 @@ class Form { $foundselected = true; $out .= ''; - } - else { + } else { $out .= ''; } - } - else { + } else { array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); } @@ -1357,8 +1326,7 @@ class Form } } $out .= ''."\n"; - } - else { + } else { dol_print_error($this->db); } @@ -1438,8 +1406,7 @@ class Form } print ''; return $qualifiedlines; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1569,8 +1536,7 @@ class Form if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')'; if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')'; $out .= ''; - } - else { + } else { $out .= ''; } - } - else { + } else { if (in_array($obj->rowid, $selected)) { $out .= $contactstatic->getFullName($langs); @@ -1591,8 +1556,7 @@ class Form } $i++; } - } - else { + } else { $out .= ''; @@ -1616,8 +1580,7 @@ class Form $this->num = $num; return $out; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1691,8 +1654,7 @@ class Form { // Build list includeUsers to have only hierarchy $includeUsers = implode(",", $user->getAllChildIds(0)); - } - elseif ($include == 'hierarchyme') + } elseif ($include == 'hierarchyme') { // Build list includeUsers to have only hierarchy and current user $includeUsers = implode(",", $user->getAllChildIds(1)); @@ -1713,15 +1675,13 @@ class Form $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=u.entity"; if ($force_entity) $sql .= " WHERE u.entity IN (0,".$force_entity.")"; else $sql .= " WHERE u.entity IS NOT NULL"; - } - else { + } else { if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " ON ug.fk_user = u.rowid"; $sql .= " WHERE ug.entity = ".$conf->entity; - } - else { + } else { $sql .= " WHERE u.entity IN (0,".$conf->entity.")"; } } @@ -1738,8 +1698,7 @@ class Form if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname { $sql .= " ORDER BY u.firstname ASC"; - } - else { + } else { $sql .= " ORDER BY u.lastname ASC"; } @@ -1778,8 +1737,7 @@ class Form $out .= ''; @@ -2397,8 +2342,7 @@ class Form array_push($outarray, $optJson); } } - } - else { + } else { if (!empty($conf->dynamicprices->enabled) && !empty($objp->fk_price_expression)) { $price_product = new Product($this->db); $price_product->fetch($objp->rowid, '', '', 1); @@ -2430,8 +2374,7 @@ class Form if (empty($outputmode)) return $out; return $outarray; - } - else { + } else { dol_print_error($db); } } @@ -2581,8 +2524,7 @@ class Form { $opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); $outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); - } - else { + } else { $opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); $outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); } @@ -2591,8 +2533,7 @@ class Form $outpricebasetype = $objp2->price_base_type; $outtva_tx = $objp2->tva_tx; } - } - else { + } else { dol_print_error($this->db); } } @@ -2609,8 +2550,7 @@ class Form $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; $opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outval .= $langs->transnoentities("Unit"); - } - else { + } else { $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding @@ -2644,8 +2584,7 @@ class Form { $opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); $outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); - } - else { + } else { $opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); $outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); } @@ -2664,8 +2603,7 @@ class Form { $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); - } - else { + } else { $opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); $outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); } @@ -2682,7 +2620,7 @@ class Form if ($objp->stock > 0) { $outval .= ' - '; - }elseif ($objp->stock <= 0) { + } elseif ($objp->stock <= 0) { $outval .= ' - '; } $outval .= $langs->transnoentities("Stock").':'.$objp->stock; @@ -2701,7 +2639,7 @@ class Form $outval .= ' - '.$langs->transnoentities("VirtualStock").':'; if ($virtualstock > 0) { $outval .= ' - '; - }elseif ($virtualstock <= 0) { + } elseif ($virtualstock <= 0) { $outval .= ' - '; } $outval .= $virtualstock; @@ -2753,8 +2691,7 @@ class Form $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').''; - } - else { + } else { print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice, $morecss); } } @@ -2963,8 +2900,7 @@ class Form $outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; $optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outvallabel .= $langs->transnoentities("Unit"); - } - else { + } else { $optlabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding @@ -2999,14 +2935,12 @@ class Form $optlabel .= " - ".$reputations[$objp->supplier_reputation]; $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; } - } - else { + } else { if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier { $optlabel .= " - ".$langs->trans("NoPriceDefinedForThisSupplier").''; $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); - } - else // No supplier price defined for product, even on other suppliers + } else // No supplier price defined for product, even on other suppliers { $optlabel .= " - ".$langs->trans("NoPriceDefinedForThisSupplier").''; $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); @@ -3054,8 +2988,7 @@ class Form if (empty($outputmode)) return $out; return $outarray; - } - else { + } else { dol_print_error($this->db); } } @@ -3100,8 +3033,7 @@ class Form if (!$num) { $form .= ''; - } - else { + } else { require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $form .= ''; @@ -3144,8 +3076,7 @@ class Form if ($objp->quantity == 1) { $opt .= $langs->trans("Unit"); - } - else { + } else { $opt .= $langs->trans("Units"); } if ($objp->quantity > 1) @@ -3164,8 +3095,7 @@ class Form $form .= ''; $this->db->free($result); return $form; - } - else { + } else { dol_print_error($this->db); } } @@ -3206,8 +3136,7 @@ class Form if ($selected && $selected == $obj->rowid) { print ''; - } - else { + } else { print ''; } $i++; @@ -3215,8 +3144,7 @@ class Form } print ''; return $num; - } - else { + } else { dol_print_error($this->db); } } @@ -3263,8 +3191,7 @@ class Form //$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label', 'asc', 0, 0, 1); // We use the field sortorder of table return $num; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3311,8 +3238,7 @@ class Form $this->cache_availability = dol_sort_array($this->cache_availability, 'label', 'asc', 0, 0, 1); return $num; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3342,8 +3268,7 @@ class Form if ($selected == $id) { print ''; @@ -3770,8 +3690,7 @@ class Form } } } - } - else { + } else { dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); } if ($opt == '') @@ -3816,8 +3735,7 @@ class Form if ($selected == $res->rowid) { $return .= ''; - } - else { + } else { $return .= ''; } } @@ -3875,8 +3793,7 @@ class Form if ($selected == $obj->rowid) { print ''; @@ -4187,19 +4096,16 @@ class Form if ($input['type'] == 'text') { $more .= '
'.$input['label'].'
'."\n"; - } - elseif ($input['type'] == 'password') + } elseif ($input['type'] == 'password') { $more .= '
'.$input['label'].'
'."\n"; - } - elseif ($input['type'] == 'select') + } elseif ($input['type'] == 'select') { $more .= '
'; if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); $more .= '
'."\n"; - } - elseif ($input['type'] == 'checkbox') + } elseif ($input['type'] == 'checkbox') { $more .= '
'; $more .= '
'.$input['label'].'
'; @@ -4209,8 +4115,7 @@ class Form if (isset($input['disabled'])) $more .= ' disabled'; $more .= ' />
'; $more .= '
'."\n"; - } - elseif ($input['type'] == 'radio') + } elseif ($input['type'] == 'radio') { $i = 0; foreach ($input['values'] as $selkey => $selval) @@ -4225,8 +4130,7 @@ class Form $more .= '
'."\n"; $i++; } - } - elseif ($input['type'] == 'date') + } elseif ($input['type'] == 'date') { $more .= '
'.$input['label'].'
'; $more .= '
'; @@ -4237,16 +4141,13 @@ class Form $formquestion[] = array('name'=>$input['name'].'year'); $formquestion[] = array('name'=>$input['name'].'hour'); $formquestion[] = array('name'=>$input['name'].'min'); - } - elseif ($input['type'] == 'other') + } elseif ($input['type'] == 'other') { $more .= '
'; if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $input['value']; $more .= '
'."\n"; - } - - elseif ($input['type'] == 'onecolumn') + } elseif ($input['type'] == 'onecolumn') { $moreonecolumn .= '
'; $moreonecolumn .= $input['value']; @@ -4371,8 +4272,7 @@ class Form }); '; $formconfirm .= "\n"; - } - else { + } else { $formconfirm .= "\n\n"; if (empty($disableformtag)) $formconfirm .= '
'."\n"; @@ -4455,16 +4355,14 @@ class Form $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1); $out .= ''; $out .= ''; - } - else { + } else { if ($selected) { $projet = new Project($this->db); $projet->fetch($selected); //print ''.$projet->title.''; $out .= $projet->getNomUrl(0, '', 1); - } - else { + } else { $out .= " "; } } @@ -4499,8 +4397,7 @@ class Form $this->select_conditions_paiements($selected, $htmlname, -1, $addempty); print ''; print ''; - } - else { + } else { if ($selected) { $this->load_cache_conditions_paiements(); @@ -4533,8 +4430,7 @@ class Form $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); print ''; print ''; - } - else { + } else { if ($selected) { $this->load_cache_availability(); @@ -4566,8 +4462,7 @@ class Form $this->selectInputReason($selected, $htmlname, -1, $addempty); print ''; print ''; - } - else { + } else { if ($selected) { $this->loadCacheInputReason(); @@ -4616,8 +4511,7 @@ class Form $ret .= ''; $ret .= '
'; $ret .= '
'; - } - else { + } else { if ($displayhour) $ret .= dol_print_date($selected, 'dayhour'); else $ret .= dol_print_date($selected, 'day'); } @@ -4651,8 +4545,7 @@ class Form print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); print ''; print ''; - } - else { + } else { if ($selected) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -4690,8 +4583,7 @@ class Form $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active); print ''; print ''; - } - else { + } else { if ($selected) { $this->load_cache_types_paiements(); @@ -4723,8 +4615,7 @@ class Form print $this->selectMultiCurrency($selected, $htmlname, 0); print ''; print ''; - } - else { + } else { dol_include_once('/core/lib/company.lib.php'); print !empty($selected) ? currency_name($selected, 1) : ' '; } @@ -4757,14 +4648,12 @@ class Form print ' '; print ''; print ''; - } - else { + } else { if (!empty($rate)) { print price($rate, 1, $langs, 1, 0); if ($currency && $rate != 1) print '   ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')'; - } - else { + } else { print 1; } } @@ -4802,8 +4691,7 @@ class Form { if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice else $translationKey = 'HasCreditNoteFromSupplier'; - } - else { + } else { if (!$filter || $filter == "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") $translationKey = 'HasAbsoluteDiscountFromSupplier'; else $translationKey = 'HasCreditNoteFromSupplier'; } @@ -4812,8 +4700,7 @@ class Form { if (!$filter || $filter == "fk_facture_source IS NULL") $translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice else $translationKey = 'CompanyHasCreditNote'; - } - else { + } else { if (!$filter || $filter == "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") $translationKey = 'CompanyHasAbsoluteDiscount'; else $translationKey = 'CompanyHasCreditNote'; } @@ -4851,13 +4738,11 @@ class Form print ''; } print ''; - } - else { + } else { if ($selected) { print $selected; - } - else { + } else { print "0"; } } @@ -4895,8 +4780,7 @@ class Form print ''; print ''; print ''; - } - else { + } else { if ($selected) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -4938,16 +4822,14 @@ class Form $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events); $out .= ''; $out .= ''; - } - else { + } else { if ($selected) { require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $soc = new Societe($this->db); $soc->fetch($selected); $out .= $soc->getNomUrl($langs); - } - else { + } else { $out .= " "; } } @@ -4995,16 +4877,14 @@ class Form if ($selected && $selected == $code_iso) { $out .= ''; @@ -5128,13 +5008,11 @@ class Form } return $num; - } - else { + } else { $this->error = ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).''; return -1; } - } - else { + } else { $this->error = ''.$this->db->error().''; return -2; } @@ -5189,8 +5067,7 @@ class Form if ($societe_vendeuse->id == $mysoc->id) { $return .= ''.$langs->trans("ErrorYourCountryIsNotDefined").''; - } - else { + } else { $return .= ''.$langs->trans("ErrorSupplierCountryIsNotDefined").''; } return $return; @@ -5205,8 +5082,7 @@ class Form if (is_object($societe_vendeuse)) { $code_country = "'".$societe_vendeuse->country_code."'"; - } - else { + } else { $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente } if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on @@ -5221,12 +5097,10 @@ class Form { $code_country .= ",'".$societe_acheteuse->country_code."'"; } - } - elseif (!$idprod) // We don't know type of product + } elseif (!$idprod) // We don't know type of product { $code_country .= ",'".$societe_acheteuse->country_code."'"; - } - else { + } else { $prodstatic = new Product($this->db); $prodstatic->fetch($idprod); if ($prodstatic->type == Product::TYPE_SERVICE) // We know product is a service @@ -5300,8 +5174,7 @@ class Form $return .= ' selected'; $selectedfound = true; } - } - elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) + } elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) { $return .= ' selected'; $selectedfound = true; @@ -5312,8 +5185,7 @@ class Form if ($mysoc->country_code == 'IN' || !empty($conf->global->MAIN_VAT_LABEL_IS_POSITIVE_RATES)) { $return .= $rate['labelpositiverates']; - } - else { + } else { $return .= vatrate($rate['label']); } //$return.=($rate['code']?' '.$rate['code']:''); @@ -5323,8 +5195,7 @@ class Form } if (!$options_only) $return .= ''; - } - else { + } else { $return .= $this->error; } @@ -5425,8 +5296,7 @@ class Form $sday = (!empty($reg[3]) ? $reg[3] : ''); $shour = (!empty($reg[4]) ? $reg[4] : ''); $smin = (!empty($reg[5]) ? $reg[5] : ''); - } - elseif (strval($set_time) != '' && $set_time != -1) + } elseif (strval($set_time) != '' && $set_time != -1) { // set_time est un timestamps (0 possible) $syear = dol_print_date($set_time, "%Y"); @@ -5437,14 +5307,12 @@ class Form $shour = dol_print_date($set_time, "%H"); $smin = dol_print_date($set_time, "%M"); $ssec = dol_print_date($set_time, "%S"); - } - else { + } else { $shour = ''; $smin = ''; $ssec = ''; } - } - else { + } else { // Date est '' ou vaut -1 $syear = ''; $smonth = ''; @@ -5491,14 +5359,12 @@ class Form $base = DOL_URL_ROOT.'/core/'; $retstring .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; $retstring .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').''; - } - else $retstring .= ''; + } else $retstring .= ''; $retstring .= ''."\n"; $retstring .= ''."\n"; $retstring .= ''."\n"; - } - elseif ($usecalendar == 'jquery') + } elseif ($usecalendar == 'jquery') { if (!$disabled) { @@ -5551,8 +5417,7 @@ class Form $retstring.=' });'; $retstring.='});'; $retstring.="";*/ - } - else { + } else { $retstring .= ''; } @@ -5560,8 +5425,7 @@ class Form $retstring .= ''."\n"; $retstring .= ''."\n"; $retstring .= ''."\n"; - } - else { + } else { $retstring .= "Bad value of MAIN_POPUP_CALENDAR"; } } @@ -5602,8 +5466,7 @@ class Form if ($emptydate || $set_time == -1) { $retstring .= ''; - } - else { + } else { $retstring .= ''; for ($year = $syear - 10; $year < $syear + 10; $year++) @@ -5678,8 +5541,7 @@ class Form $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; - } - elseif ($addnowlink == 2) + } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));'; $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());'; @@ -5705,8 +5567,7 @@ class Form if ($addnowlink == 1) { $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; - } - elseif ($addnowlink == 2) + } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; } @@ -5721,8 +5582,7 @@ class Form if ($addnowlink == 1) { $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; - } - elseif ($addnowlink == 2) + } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; } @@ -5827,12 +5687,10 @@ class Form $retstring .= ">".$hour.""; } $retstring .= ""; - } - elseif ($typehour == 'text' || $typehour == 'textselect') + } elseif ($typehour == 'text' || $typehour == 'textselect') { $retstring .= ''; - } - else return 'BadValueForParameterTypeHour'; + } else return 'BadValueForParameterTypeHour'; if ($typehour != 'text') $retstring .= ' '.$langs->trans('HourShort'); else $retstring .= ':'; @@ -5851,8 +5709,7 @@ class Form $retstring .= '>'.$min.''; } $retstring .= ""; - } - elseif ($typehour == 'text') + } elseif ($typehour == 'text') { $retstring .= ''; } @@ -5947,8 +5804,7 @@ class Form $out .= ''; if ($placeholder) $placeholder = ' placeholder="'.$placeholder.'"'; $out .= ''; - } - else { + } else { // Immediate load of table record. Note: filter is inside $objecttmp->filter $out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled); } @@ -5976,8 +5832,7 @@ class Form if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { $tmpescaped = "'".$db->escape($regbis[1])."'"; - } - else { + } else { $tmpescaped = $db->escape($tmpescaped); } return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; @@ -6019,8 +5874,7 @@ class Form if ($val['showoncombobox']) $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; } if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow; - } - else { + } else { // For backward compatibility $objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1); } @@ -6029,8 +5883,7 @@ class Form { if (isset($objecttmp->fields['ref'])) { $fieldstoshow = 't.ref'; - } - else { + } else { $langs->load("errors"); $this->error = $langs->trans("ErrorNoFieldWithAttributeShowoncombobox"); return $langs->trans('ErrorNoFieldWithAttributeShowoncombobox'); @@ -6118,12 +5971,10 @@ class Form if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { $out .= ''; - } - else { + } else { $out .= ''; } - } - else { + } else { array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); } @@ -6133,8 +5984,7 @@ class Form } $out .= ''."\n"; - } - else { + } else { dol_print_error($this->db); } @@ -6240,8 +6090,7 @@ class Form { if (empty($nohtmlescape)) $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value)); else $selectOptionValue = $key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value); - } - else { + } else { if (empty($nohtmlescape)) $selectOptionValue = dol_escape_htmltag($maxlen ?dol_trunc($value, $maxlen) : $value); else $selectOptionValue = $maxlen ?dol_trunc($value, $maxlen) : $value; if ($value == '' || $value == '-') $selectOptionValue = ' '; @@ -6369,8 +6218,7 @@ class Form if ($acceptdelayedhtml) { $delayedhtmlcontent .= $outdelayed; - } - else { + } else { $out .= $outdelayed; } return $out; @@ -6486,8 +6334,7 @@ class Form if ($acceptdelayedhtml) { $delayedhtmlcontent .= $outdelayed; - } - else { + } else { $out .= $outdelayed; } return $out; @@ -6534,8 +6381,7 @@ class Form if ($elemtype == 'category') { $out .= 'return \' \'+record.text+\'\';'; - } - else { + } else { $out .= 'return record.text;'; } $out .= '};'."\n"; @@ -6543,8 +6389,7 @@ class Form if ($elemtype == 'category') { $out .= 'return \' \'+record.text+\'\';'; - } - else { + } else { $out .= 'return record.text;'; } $out .= '};'."\n"; @@ -6559,8 +6404,7 @@ class Form templateSelection: formatSelection /* For 4.0 */ }); });'."\n"; - } - elseif ($addjscombo == 2) + } elseif ($addjscombo == 2) { // Add other js lib // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin @@ -6817,41 +6661,31 @@ class Form if ($objecttype == 'facture') { $tplpath = 'compta/'.$element; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'facturerec') { + } elseif ($objecttype == 'facturerec') { $tplpath = 'compta/facture'; $tplname = 'linkedobjectblockForRec'; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'propal') { + } elseif ($objecttype == 'propal') { $tplpath = 'comm/'.$element; if (empty($conf->propal->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'supplier_proposal') { + } elseif ($objecttype == 'supplier_proposal') { if (empty($conf->supplier_proposal->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'shipping' || $objecttype == 'shipment') { + } elseif ($objecttype == 'shipping' || $objecttype == 'shipment') { $tplpath = 'expedition'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'reception') { + } elseif ($objecttype == 'reception') { $tplpath = 'reception'; if (empty($conf->reception->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'delivery') { + } elseif ($objecttype == 'delivery') { $tplpath = 'livraison'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'invoice_supplier') { + } elseif ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; - } - elseif ($objecttype == 'order_supplier') { + } elseif ($objecttype == 'order_supplier') { $tplpath = 'fourn/commande'; - } - elseif ($objecttype == 'expensereport') { + } elseif ($objecttype == 'expensereport') { $tplpath = 'expensereport'; - } - elseif ($objecttype == 'subscription') { + } elseif ($objecttype == 'subscription') { $tplpath = 'adherents'; } @@ -6959,8 +6793,7 @@ class Form { $possiblelinks = array_merge($possiblelinks, $hookmanager->resArray); } - } - elseif ($reshook > 0) + } elseif ($reshook > 0) { if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) { @@ -7047,8 +6880,7 @@ class Form '; - } - else { + } else { $linktoelem = ''; } @@ -7098,8 +6930,7 @@ class Form { $resultyesno .= ''."\n"; $resultyesno .= ''."\n"; - } - else { + } else { $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); $resultyesno .= ''."\n"; $resultyesno .= ''."\n"; @@ -7142,8 +6973,7 @@ class Form if ($selected == $obj->rowid) { print ''; $i++; } - } - else { + } else { if ($show_empty) $out .= ''."\n"; $out .= ''; } $out .= ''; - } - else { + } else { dol_print_error($this->db); } @@ -7809,8 +7618,7 @@ class Form } } } - } - else { + } else { dol_print_error($db); } @@ -7844,8 +7652,7 @@ class Form $out .= ''; } $out .= ''; - } - else { + } else { dol_print_error($db); } @@ -7886,8 +7693,7 @@ class Form $out .= ''; } $out .= ''; - } - else { + } else { dol_print_error($db); } @@ -7983,8 +7789,7 @@ class Form if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($usertofilter->rights->societe->lire)) { // Do nothing - } - else { + } else { if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) { $i++; @@ -8003,13 +7808,11 @@ class Form { $disabled = 1; $labeltoshow .= ' - '.$langs->trans("Draft"); - } - elseif ($obj->fk_statut == Project::STATUS_CLOSED) + } elseif ($obj->fk_statut == Project::STATUS_CLOSED) { if ($discard_closed == 2) $disabled = 1; $labeltoshow .= ' - '.$langs->trans("Closed"); - } - elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) + } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled = 1; $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); @@ -8021,13 +7824,11 @@ class Form $out .= ''; - } - else { + } else { $out .= ''; } } @@ -183,8 +182,7 @@ class FormAdmin if ($file == $selected) { $menuarray[$prefix.'_'.$file] = ''; - } - else { + } else { $menuarray[$prefix.'_'.$file] = ''; } } @@ -383,8 +381,7 @@ class FormAdmin $i++; } - } - else { + } else { dol_print_error($this->db); return ''; } @@ -402,8 +399,7 @@ class FormAdmin if ($selected == $key) { $out .= ''; - } - else { + } else { $out .= ''; } } diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 8c27666dfc4..104daf6de0e 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -176,8 +176,7 @@ class FormBarCode } $out .= ""; $out .= ajax_combobox("select_".$htmlname); - } - else { + } else { dol_print_error($this->db); } return $out; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a5e31916827..f4e551c6452 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -166,8 +166,7 @@ class FormCompany extends Form } print Form::selectarray($htmlname, $options, $selected); - } - else dol_print_error($this->db); + } else dol_print_error($this->db); if (!empty($htmlname) && $user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; print ''; @@ -241,8 +240,7 @@ class FormCompany extends Form if ($obj->code == '0') // Le code peut etre une chaine { $out .= ''; - } - else { + } else { if (!$country || $country != $obj->country) { // Affiche la rupture si on est en mode liste multipays @@ -256,8 +254,7 @@ class FormCompany extends Form if (!empty($selected) && $selected == $obj->rowid) { $out .= ''; - } - else { + } else { if ($country == '' || $country != $obj->country) { // Show break @@ -354,8 +346,7 @@ class FormCompany extends Form if ($selected > 0 && $selected == $obj->code) { print ''; - } - else { + } else { print ''; } } @@ -363,8 +354,7 @@ class FormCompany extends Form } } print ''; - } - else { + } else { dol_print_error($this->db); } } @@ -405,8 +395,7 @@ class FormCompany extends Form if ($selected == $obj->code) { $out .= ''; $firstCompany = $obj->rowid; - } - else { + } else { print ''; @@ -695,8 +679,7 @@ class FormCompany extends Form print "\n"; print ajax_combobox($htmlname); return $firstCompany; - } - else { + } else { dol_print_error($this->db); return 0; } @@ -838,8 +821,7 @@ class FormCompany extends Form elseif ($idprof == 3) $formlength = 5; // 4 chiffres et 1 lettre depuis janvier elseif ($idprof == 4) $formlength = 32; // No maximum as we need to include a town name in this id } - } - elseif ($country_code == 'ES') + } elseif ($country_code == 'ES') { if ($idprof == 1) $formlength = 9; //CIF/NIF/NIE 9 digits if ($idprof == 2) $formlength = 12; //NASS 12 digits without / @@ -902,8 +884,7 @@ class FormCompany extends Form if ($selected == $valors[$i]) { print ''; - } - else { + } else { $disabled = 0; if ($obj->statut == 0) { @@ -128,8 +126,7 @@ class FormContract if ($hideunselectables && $disabled) { $resultat = ''; - } - else { + } else { $resultat = '