From 2c1b3722f22f473ca158911800a029d1e752e4a4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 17 Sep 2011 19:49:50 +0000 Subject: [PATCH] Fix: replace sizeof() by count() --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/adherents/document.php | 2 +- htdocs/adherents/fiche.php | 12 +-- htdocs/adherents/fiche_subscription.php | 2 +- htdocs/adherents/ldap.php | 2 +- htdocs/cashdesk/class/Auth.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/action/document.php | 2 +- htdocs/comm/action/index.php | 4 +- htdocs/comm/mailing/fiche.php | 8 +- htdocs/comm/propal.php | 4 +- htdocs/comm/propal/class/propal.class.php | 10 +-- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/class/commande.class.php | 15 ++-- htdocs/commande/contact.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/commande/fiche.php | 2 +- htdocs/compta/bank/annuel.php | 2 +- htdocs/compta/bank/graph.php | 2 +- htdocs/compta/bank/ligne.php | 2 +- htdocs/compta/facture.php | 4 +- htdocs/compta/facture/apercu.php | 2 +- .../facture/class/facture-rec.class.php | 3 +- htdocs/compta/facture/class/facture.class.php | 22 ++--- htdocs/compta/facture/contact.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/facture/fiche-rec.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/compta/paiement/cheque/fiche.php | 2 +- .../compta/paiement/class/paiement.class.php | 2 +- htdocs/compta/paiement_charge.php | 2 +- .../class/bon-prelevement.class.php | 22 ++--- .../class/rejet-prelevement.class.php | 6 +- htdocs/compta/propal.php | 2 +- htdocs/compta/stats/cabyuser.php | 2 +- htdocs/contact/fiche.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/contrat/contact.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/contrat/fiche.php | 4 +- htdocs/core/class/commonobject.class.php | 10 +-- htdocs/core/class/dolgraph.class.php | 14 ++-- htdocs/core/class/hookmanager.class.php | 6 +- htdocs/core/class/html.form.class.php | 12 +-- htdocs/core/class/html.formcompany.class.php | 4 +- htdocs/core/class/html.formfile.class.php | 12 +-- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/class/html.formother.class.php | 4 +- htdocs/core/class/html.formsms.class.php | 2 +- htdocs/core/class/menu.class.php | 4 +- htdocs/core/class/menubase.class.php | 4 +- htdocs/core/class/notify.class.php | 2 +- htdocs/core/class/translate.class.php | 4 +- htdocs/ecm/class/ecmdirectory.class.php | 6 +- htdocs/ecm/class/htmlecm.form.class.php | 2 +- htdocs/ecm/docfile.php | 2 +- htdocs/ecm/docmine.php | 4 +- htdocs/ecm/docother.php | 2 +- htdocs/ecm/index.php | 2 +- htdocs/expedition/class/expedition.class.php | 5 +- htdocs/expedition/fiche.php | 9 ++- htdocs/expedition/shipment.php | 2 +- htdocs/exports/export.php | 18 ++--- htdocs/exports/index.php | 4 +- htdocs/fichinter/contact.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fichinter/fiche.php | 2 +- .../class/fournisseur.commande.class.php | 9 ++- .../fourn/class/fournisseur.facture.class.php | 6 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/fiche.php | 2 +- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/fourn/facture/fiche.php | 10 ++- htdocs/fourn/index.php | 2 +- htdocs/fourn/product/categorie.php | 2 +- htdocs/imports/import.php | 80 ++++++++++--------- htdocs/imports/index.php | 4 +- htdocs/includes/boxes/box_comptes.php | 2 +- htdocs/includes/boxes/box_external_rss.php | 2 +- htdocs/includes/boxes/modules_boxes.php | 6 +- .../includes/menus/standard/auguria.lib.php | 5 +- htdocs/includes/menus/standard/eldy.lib.php | 5 +- htdocs/includes/menus/standard/empty.php | 3 +- .../modules/DolibarrModules.class.php | 8 +- .../modules/cheque/pdf/pdf_blochet.class.php | 7 +- .../modules/commande/pdf_edison.modules.php | 4 +- .../modules/commande/pdf_einstein.modules.php | 2 +- .../pdf/pdf_expedition_merou.modules.php | 4 +- .../pdf/pdf_expedition_rouget.modules.php | 7 +- .../doc/doc_generic_invoice_odt.modules.php | 6 +- .../modules/facture/doc/pdf_crabe.modules.php | 8 +- .../facture/doc/pdf_oursin.modules.php | 10 +-- .../modules/facture/modules_facture.php | 2 +- .../modules/import/import_csv.modules.php | 6 +- .../livraison/pdf/pdf_sirocco.modules.php | 6 +- .../livraison/pdf/pdf_typhon.modules.php | 6 +- .../modules/mailings/modules_mailings.php | 2 +- .../thirdparties_services_expired.modules.php | 2 +- .../project/pdf/pdf_baleine.modules.php | 6 +- .../propale/pdf_propale_azur.modules.php | 4 +- .../propale/pdf_propale_jaune.modules.php | 4 +- .../modules/rapport/pdf_paiement.class.php | 2 +- .../societe/doc/doc_generic_odt.modules.php | 4 +- .../pdf/pdf_canelle.modules.php | 4 +- .../pdf/pdf_muscadet.modules.php | 4 +- .../interface_modLdap_Ldapsynchro.class.php | 10 +-- htdocs/install/check.php | 6 +- htdocs/install/etape1.php | 3 +- htdocs/install/etape2.php | 6 +- htdocs/install/inc.php | 2 +- htdocs/install/upgrade.php | 8 +- htdocs/install/upgrade2.php | 25 +++--- htdocs/lib/admin.lib.php | 2 +- htdocs/lib/fourn.lib.php | 4 +- htdocs/lib/functions.lib.php | 35 ++++---- htdocs/lib/functions2.lib.php | 6 +- htdocs/lib/invoice.lib.php | 2 +- htdocs/lib/memory.lib.php | 8 +- htdocs/lib/order.lib.php | 2 +- htdocs/lib/pdf.lib.php | 2 +- htdocs/lib/project.lib.php | 12 +-- htdocs/lib/propal.lib.php | 2 +- htdocs/livraison/class/livraison.class.php | 8 +- htdocs/livraison/fiche.php | 7 +- htdocs/main.inc.php | 4 +- .../product/class/html.formproduct.class.php | 4 +- htdocs/product/class/product.class.php | 6 +- htdocs/product/composition/fiche.php | 18 ++--- htdocs/product/document.php | 2 +- htdocs/product/fiche.php | 4 +- htdocs/product/fournisseurs.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/class/task.class.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 5 +- htdocs/projet/fiche.php | 2 +- htdocs/projet/ganttview.php | 8 +- htdocs/projet/tasks.php | 8 +- htdocs/projet/tasks/contact.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/public/members/new.php | 2 +- .../canvas/company/tpl/card_create.tpl.php | 2 +- .../canvas/company/tpl/card_edit.tpl.php | 2 +- .../canvas/individual/tpl/card_create.tpl.php | 2 +- .../canvas/individual/tpl/card_edit.tpl.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/societe/soc.php | 8 +- test/phpunit/CategorieTest.php | 6 +- 154 files changed, 430 insertions(+), 393 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 944d7772e85..47d59d198f0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -339,7 +339,7 @@ class Adherent extends CommonObject // Fin appel triggers } - if (sizeof($this->errors)) + if (count($this->errors)) { dol_syslog(get_class($this)."::create ".join(',',$this->errors), LOG_ERR); $this->db->rollback(); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 0723291c647..91f8be836a3 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -183,7 +183,7 @@ if ($id > 0) print ''.$langs->trans("Status").''.$member->getLibStatut(4).''; // Nbre fichiers - print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; //Total taille print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 3f2e9a2ccad..c41286ace00 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -283,7 +283,7 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe } $result=$object->update($user,0,$nosyncuser,$nosyncuserpass); - if ($result >= 0 && ! sizeof($object->errors)) + if ($result >= 0 && ! count($object->errors)) { $dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos'; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -514,7 +514,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_valid' && $_P $adht = new AdherentType($db); $adht->fetch($object->typeid); - if ($result >= 0 && ! sizeof($object->errors)) + if ($result >= 0 && ! count($object->errors)) { // Send confirmation Email (selon param du type adherent sinon generique) if ($object->email && $_POST["send_mail"]) @@ -548,7 +548,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' & $result=$object->resiliate($user); - if ($result >= 0 && ! sizeof($object->errors)) + if ($result >= 0 && ! count($object->errors)) { if ($object->email && $_POST["send_mail"]) { @@ -576,7 +576,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' & if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == 'yes') { - if (! sizeof($object->errors)) + if (! count($object->errors)) { if(!$object->del_to_spip()){ $errmsg.="Echec de la suppression de l'utilisateur dans spip: ".$object->error."
\n"; @@ -586,7 +586,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_del_spip' if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == 'yes') { - if (! sizeof($object->errors)) + if (! count($object->errors)) { if (!$object->add_to_spip()) { @@ -683,7 +683,7 @@ if ($action == 'create') // Type print ''.$langs->trans("MemberType").''; $listetype=$adht->liste_array(); - if (sizeof($listetype)) + if (count($listetype)) { print $html->selectarray("typeid", $listetype, isset($_POST["typeid"])?$_POST["typeid"]:$typeid, 1); } else { diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index f654a381c72..58a19fdf0e7 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -91,7 +91,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update //print 'datef='.$subscription->datef.' '.$_POST['datesubendday']; $result=$subscription->update($user); - if ($result >= 0 && ! sizeof($subscription->errors)) + if ($result >= 0 && ! count($subscription->errors)) { $db->commit(); diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 295328c5ee8..5bfcf87acdf 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -199,7 +199,7 @@ if ($result > 0) //print_r($records); // Affichage arbre - if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) + if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index 896c3876f37..39445983bcb 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -75,7 +75,7 @@ class Auth { $authmode=explode(',',$dolibarr_main_authentication); // No authentication mode - if (! sizeof($authmode) && empty($conf->login_method_modules)) + if (! count($authmode) && empty($conf->login_method_modules)) { $langs->load('main'); dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication')); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 4ae874dee76..b77efc01822 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -661,7 +661,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".sizeof($filters), LOG_DEBUG); + dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index aa1d9da7441..96185f80627 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -208,7 +208,7 @@ if ($objectid > 0) } - print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print ''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f53ea613b4a..9357dab4cd3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -502,7 +502,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0 } } -if (sizeof($listofextcals)) +if (count($listofextcals)) { require_once(DOL_DOCUMENT_ROOT."/comm/action/class/ical.class.php"); foreach($listofextcals as $extcal) @@ -994,7 +994,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ($status?'&status='.$status:'').($filter?'&filter='.$filter:''); print ($filtera?'&filtera='.$filtera:'').($filtert?'&filtert='.$filtert:'').($filterd?'&filterd='.$filterd:''); print '">'.img_picto("all","1downarrow_selected.png").' ...'; - print ' +'.(sizeof($eventarray[$daykey])-$maxPrint); + print ' +'.(count($eventarray[$daykey])-$maxPrint); print ''; break; //$ok=false; // To avoid to show twice the link diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 2f3450f1d43..777729e97a2 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -199,7 +199,7 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes') $arr_css = array(); $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); - if (sizeof($listofpaths)) + if (count($listofpaths)) { foreach($listofpaths as $key => $val) { @@ -333,7 +333,7 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"])) // Attached files $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); - if (sizeof($listofpaths)) + if (count($listofpaths)) { foreach($listofpaths as $key => $val) { @@ -909,7 +909,7 @@ else print ''.$langs->trans("MailFile").' '.$i.''; // List of files $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); - if (sizeof($listofpaths)) + if (count($listofpaths)) { foreach($listofpaths as $key => $val) { @@ -1001,7 +1001,7 @@ else print ''; // List of files $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); - if (sizeof($listofpaths)) + if (count($listofpaths)) { foreach($listofpaths as $key => $val) { diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5b2d1522d62..a76f151447c 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1531,7 +1531,7 @@ if ($id > 0 || ! empty($ref)) // Validate if ($object->statut == 0 && $user->rights->propale->valider) { - if (sizeof($object->lines) > 0) print ''.$langs->trans('Validate').''; + if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; else print ''.$langs->trans('Validate').''; } @@ -1574,7 +1574,7 @@ if ($id > 0 || ! empty($ref)) } $arraypropal=$object->getInvoiceArrayList(); - if (is_array($arraypropal) && sizeof($arraypropal) > 0) + if (is_array($arraypropal) && count($arraypropal) > 0) { print 'socid.'">'.$langs->trans("ClassifyBilled").''; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1ab5857648b..31c7ac3d7f4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -692,7 +692,7 @@ class Propal extends CommonObject if (! $error) { $fk_parent_line=0; - $num=sizeof($this->lines); + $num=count($this->lines); for ($i=0;$i<$num;$i++) { @@ -1651,7 +1651,7 @@ class Propal extends CommonObject $this->fetchObjectLinked($id,$this->element); foreach($this->linkedObjectsIds as $objecttype => $objectid) { - $numi=sizeof($objectid); + $numi=count($objectid); for ($i=0;$i<$numi;$i++) { // Cas des factures liees directement @@ -1665,7 +1665,7 @@ class Propal extends CommonObject $this->fetchObjectLinked($objectid[$i],$objecttype); foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid) { - $numj=sizeof($subobjectid); + $numj=count($subobjectid); for ($j=0;$j<$numj;$j++) { $linkedInvoices[] = $subobjectid[$j]; @@ -1675,7 +1675,7 @@ class Propal extends CommonObject } } - if (sizeof($linkedInvoices) > 0) + if (count($linkedInvoices) > 0) { $sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye"; $sql.= " FROM ".MAIN_DB_PREFIX."facture"; @@ -2115,7 +2115,7 @@ class Propal extends CommonObject } } // TODO Definir regle des propales a facturer en retard - // if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; + // if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; } return 1; } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index a6e818a07ac..e4dfe3299a7 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -285,7 +285,7 @@ if ($id > 0 || ! empty($ref)) foreach(array('internal','external') as $source) { $tab = $propal->liste_contact(-1,$source); - $num=sizeof($tab); + $num=count($tab); $i = 0; while ($i < $num) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index dcd41b3b8d5..3a3d41b2fcb 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -167,7 +167,7 @@ if ($id > 0 || ! empty($ref)) print "".$langs->trans("Company").""; print ''.$object->thirdparty->getNomUrl(1).''; - print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 337b0423826..01b84b9c0c4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -241,7 +241,8 @@ class Commande extends CommonObject $langs->load("agenda"); // Loop on each line - for ($i = 0 ; $i < sizeof($this->lines) ; $i++) + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->fk_product > 0) { @@ -352,7 +353,8 @@ class Commande extends CommonObject require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); $langs->load("agenda"); - for ($i = 0 ; $i < sizeof($this->lines) ; $i++) + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->fk_product > 0) { @@ -647,7 +649,7 @@ class Commande extends CommonObject if ($this->id) { $fk_parent_line=0; - $num=sizeof($this->lines); + $num=count($this->lines); /* * Insertion du detail des produits dans la base @@ -874,7 +876,8 @@ class Commande extends CommonObject $this->date_commande = dol_now(); $this->source = 0; - for ($i = 0 ; $i < sizeof($object->lines) ; $i++) + $num=count($object->lines); + for ($i = 0; $i < $num; $i++) { $line = new OrderLine($this->db); @@ -1161,7 +1164,7 @@ class Commande extends CommonObject $prod->fetch($idproduct); $prod -> get_sousproduits_arbo (); $prods_arbo = $prod->get_each_prod(); - if(sizeof($prods_arbo) > 0) + if(count($prods_arbo) > 0) { foreach($prods_arbo as $key => $value) { @@ -1582,7 +1585,7 @@ class Commande extends CommonObject // Recherche total en stock pour chaque produit - if (sizeof($array_of_product)) + if (count($array_of_product)) { $sql = "SELECT fk_product, sum(ps.reel) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 4d4d240500e..0502fea62a4 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -276,7 +276,7 @@ if ($id > 0 || ! empty($ref)) foreach(array('internal','external') as $source) { $tab = $commande->liste_contact(-1,$source); - $num=sizeof($tab); + $num=count($tab); $i = 0; while ($i < $num) diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 8e5d7a6725b..bc5feec9fc7 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -154,7 +154,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).''; - print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print "\n"; print "\n"; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0f2a2c5651d..fb627db7061 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -238,7 +238,7 @@ if ($action == 'add' && $user->rights->commande->creer) if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); $fk_parent_line=0; - $num=sizeof($lines); + $num=count($lines); for ($i=0;$i<$num;$i++) { diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index ad19a1dafe3..0ba206b8d22 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -151,7 +151,7 @@ if ($_GET["account"]) $bankaccount->fetch($id); $bankaccount->label=$bankaccount->ref; print $bankaccount->getNomUrl(1); - if ($key < (sizeof($listid)-1)) print ', '; + if ($key < (count($listid)-1)) print ', '; } } } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index d065d1be423..df4e557f6fa 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -760,7 +760,7 @@ if ($account) $bankaccount->fetch($id); $bankaccount->label=$bankaccount->ref; print $bankaccount->getNomUrl(1); - if ($key < (sizeof($listid)-1)) print ', '; + if ($key < (count($listid)-1)) print ', '; } } } diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 623c5389e12..9f500eea383 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -274,7 +274,7 @@ if ($result) print ''; // Show links of bank transactions - if (sizeof($links)) + if (count($links)) { print "".$langs->trans("Links").""; print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ce03fde199f..e3d53913b03 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2130,7 +2130,7 @@ else } $facidavoir=$object->getListIdAvoirFromInvoice(); - if (sizeof($facidavoir) > 0) + if (count($facidavoir) > 0) { print ' ('.$langs->transnoentities("InvoiceHasAvoir"); $i=0; @@ -2667,7 +2667,7 @@ else } // Validate - if ($object->statut == 0 && sizeof($object->lines) > 0 && + if ($object->statut == 0 && count($object->lines) > 0 && ( (($object->type == 0 || $object->type == 1 || $object->type == 3 || $object->type == 4) && $object->total_ttc >= 0) || ($object->type == 2 && $object->total_ttc <= 0)) diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index aebabed12d3..1a33f00cde2 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -109,7 +109,7 @@ if ($id > 0 || ! empty($ref)) } $facidavoir=$object->getListIdAvoirFromInvoice(); - if (sizeof($facidavoir) > 0) + if (count($facidavoir) > 0) { print ' ('.$langs->transnoentities("InvoiceHasAvoir"); $i=0; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2d2b2737fb6..3535470dd90 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -143,7 +143,8 @@ class FactureRec extends Facture /* * Lines */ - for ($i = 0 ; $i < sizeof($facsrc->lines) ; $i++) + $num=count($facsrc->lines); + for ($i = 0; $i < $num; $i++) { $result_insert = $this->addline($this->id, $facsrc->lines[$i]->desc, diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 01880a204ac..c6710f4a3a9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -276,11 +276,11 @@ class Facture extends CommonObject /* * Insert lines of invoices into database */ - if (sizeof($this->lines) && is_object($this->lines[0])) + if (count($this->lines) && is_object($this->lines[0])) { $fk_parent_line = 0; - dol_syslog("There is ".sizeof($this->lines)." lines that are invoice lines objects"); + dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects"); foreach ($this->lines as $i => $val) { $newinvoiceline=new FactureLigne($this->db); @@ -313,7 +313,7 @@ class Facture extends CommonObject { $fk_parent_line = 0; - dol_syslog("There is ".sizeof($this->lines)." lines that are array lines"); + dol_syslog("There is ".count($this->lines)." lines that are array lines"); foreach ($this->lines as $i => $val) { if (($this->lines[$i]->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 @@ -496,7 +496,7 @@ class Facture extends CommonObject } } - dol_syslog("Facture::createFromCurrent invertdetail=".$invertdetail." socid=".$this->socid." nboflines=".sizeof($facture->lines)); + dol_syslog("Facture::createFromCurrent invertdetail=".$invertdetail." socid=".$this->socid." nboflines=".count($facture->lines)); $facid = $facture->create($user); if ($facid <= 0) @@ -615,7 +615,8 @@ class Facture extends CommonObject $this->date = dol_now(); $this->source = 0; - for ($i = 0 ; $i < sizeof($object->lines) ; $i++) + $num=count($object->lines); + for ($i = 0; $i < $num; $i++) { $line = new FactureLigne($this->db); @@ -1209,7 +1210,7 @@ class Facture extends CommonObject } // Consumned discounts are freed - if (sizeof($list_rowid_det)) + if (count($list_rowid_det)) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except'; $sql.= ' SET fk_facture = NULL'; @@ -1634,7 +1635,8 @@ class Facture extends CommonObject $langs->load("agenda"); // Loop on each line - for ($i = 0 ; $i < sizeof($this->lines) ; $i++) + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->fk_product > 0) { @@ -1748,7 +1750,8 @@ class Facture extends CommonObject require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); $langs->load("agenda"); - for ($i = 0 ; $i < sizeof($this->lines) ; $i++) + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->fk_product > 0) { @@ -2743,7 +2746,8 @@ class Facture extends CommonObject { // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees $ventilExportCompta = 0 ; - for ($i = 0 ; $i < sizeof($this->lines) ; $i++) + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->export_compta <> 0 && $this->lines[$i]->code_ventilation <> 0) { diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 061d6ec6018..2aae1a917c2 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -271,7 +271,7 @@ if ($id > 0 || ! empty($ref)) foreach(array('internal','external') as $source) { $tab = $facture->liste_contact(-1,$source); - $num=sizeof($tab); + $num=count($tab); $i = 0; while ($i < $num) diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index a7bd5f0fe0b..a2df7ced07e 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -172,7 +172,7 @@ if ($id > 0 || ! empty($ref)) // Company print ''.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).''; - print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print "\n"; print "\n"; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 381d643fdbb..fe73d5f2bcc 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -404,7 +404,7 @@ else print ''.$langs->trans("ReductionShort").''; print ''.$langs->trans("Qty").''; - $num = sizeof($fac->lines); + $num = count($fac->lines); $i = 0; $var=True; while ($i < $num) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 1e1feb3dbe0..a67ecd2bbc9 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -181,7 +181,7 @@ if ($_REQUEST["facid"] > 0 || $_REQUEST["ref"]) } $facidavoir=$fac->getListIdAvoirFromInvoice(); - if (sizeof($facidavoir) > 0) + if (count($facidavoir) > 0) { print ' ('.$langs->transnoentities("InvoiceHasAvoir"); $i=0; diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 04e5218568e..17f4eca9085 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -586,7 +586,7 @@ else print '
'; -if ($user->societe_id == 0 && sizeof($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque) +if ($user->societe_id == 0 && count($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque) { print ''.$langs->trans('NewCheckReceipt').''; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index f629e650549..5f300710892 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -271,7 +271,7 @@ class Paiement extends CommonObject $billsarray=$this->getBillsArray('fk_statut > 1'); if (is_array($billsarray)) { - if (sizeof($billsarray)) + if (count($billsarray)) { $this->error="ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible"; $this->db->rollback(); diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 9c2106a6dfb..e3a57ea88be 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -86,7 +86,7 @@ if ($_POST["action"] == 'add_payment') } } - if (sizeof($amounts) <= 0) + if (count($amounts) <= 0) { $error++; $errmsg='ErrorNoPaymentDefined'; diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index c29a0d77d36..4e6d37969ba 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -334,8 +334,9 @@ class BonPrelevement extends CommonObject { $facs = array(); $facs = $this->_get_list_factures(); - - for ($i = 0 ; $i < sizeof($facs) ; $i++) + + $num=count($facs); + for ($i = 0; $i < $num; $i++) { /* Tag invoice as payed */ dol_syslog("BonPrelevement::set_credite set_paid fac ".$facs[$i]); @@ -423,7 +424,8 @@ class BonPrelevement extends CommonObject $facs = $this->_get_list_factures(); - for ($i = 0 ; $i < sizeof($facs) ; $i++) + $num=count($facs); + for ($i = 0; $i < $num; $i++) { $fac = new Facture($this->db); $fac->fetch($facs[$i]); @@ -781,7 +783,7 @@ class BonPrelevement extends CommonObject $i = 0; dol_syslog("Start RIB check"); - if (sizeof($factures) > 0) + if (count($factures) > 0) { foreach ($factures as $fac) { @@ -825,12 +827,12 @@ class BonPrelevement extends CommonObject $ok=0; // Withdraw invoices in factures_prev array - $out=sizeof($factures_prev)." invoices will be withdrawn."; + $out=count($factures_prev)." invoices will be withdrawn."; //print $out."\n"; dol_syslog($out); - if (sizeof($factures_prev) > 0) + if (count($factures_prev) > 0) { if ($mode=='real') { @@ -917,7 +919,7 @@ class BonPrelevement extends CommonObject */ if (!$error) { - if (sizeof($factures_prev) > 0) + if (count($factures_prev) > 0) { foreach ($factures_prev as $fac) { @@ -977,9 +979,9 @@ class BonPrelevement extends CommonObject * Withdraw receipt */ - dol_syslog("Debut prelevement - Nombre de factures ".sizeof($factures_prev)); + dol_syslog("Debut prelevement - Nombre de factures ".count($factures_prev)); - if (sizeof($factures_prev) > 0) + if (count($factures_prev) > 0) { $bonprev->date_echeance = $datetimeprev; $bonprev->reference_remise = $ref; @@ -1033,7 +1035,7 @@ class BonPrelevement extends CommonObject dol_syslog("Error",LOG_ERROR); } - return sizeof($factures_prev); + return count($factures_prev); } else { diff --git a/htdocs/compta/prelevement/class/rejet-prelevement.class.php b/htdocs/compta/prelevement/class/rejet-prelevement.class.php index dbb1328f4a5..90dd3bf8016 100644 --- a/htdocs/compta/prelevement/class/rejet-prelevement.class.php +++ b/htdocs/compta/prelevement/class/rejet-prelevement.class.php @@ -115,9 +115,9 @@ class RejetPrelevement dol_syslog("RejetPrelevement::create Erreur 5"); $error++; } - - - for ($i = 0 ; $i < sizeof($facs) ; $i++) + + $num=count($facs); + for ($i = 0; $i < $num; $i++) { $fac = new Facture($this->db); $fac->fetch($facs[$i]); diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 09f03b47c9b..7660cf99a1e 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -486,7 +486,7 @@ if ($id > 0 || ! empty($ref)) } $arraypropal=$object->getInvoiceArrayList(); - if ($object->statut == 2 && is_array($arraypropal) && sizeof($arraypropal) > 0) + if ($object->statut == 2 && is_array($arraypropal) && count($arraypropal) > 0) { print 'socid.'">'.$langs->trans("ClassifyBilled").''; } diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index b1e55ae8e21..7ad351bb118 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -223,7 +223,7 @@ print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"" print "\n"; $var=true; -if (sizeof($amount)) +if (count($amount)) { $arrayforsort=$name; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 4441909554d..7e01644b08d 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -223,7 +223,7 @@ if (empty($reshook)) $_GET["action"] = $_POST["action"] = 'edit'; } - if (! sizeof($errors)) + if (! count($errors)) { $object->fetch($_POST["contactid"]); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index efc8faabf60..0d07b69853c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -584,7 +584,7 @@ class Contrat extends CommonObject return -2; } - $this->nbofservices=sizeof($this->lines); + $this->nbofservices=count($this->lines); $this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_ht = price2num($total_ht); // TODO For the moment value is false as value is not stored in database for line linked to products diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index c095cfca195..858d531cbf6 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -271,7 +271,7 @@ if ($id > 0) foreach(array('internal','external') as $source) { $tab = $contrat->liste_contact(-1,$source); - $num=sizeof($tab); + $num=count($tab); $i = 0; while ($i < $num) diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 89a29e67c4c..b9e7686a0ec 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -147,7 +147,7 @@ if ($contrat->id) print ''.$langs->trans("Customer").''; print ''.$soc->getNomUrl(1).''; - print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print ''; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index f25b6b08bb1..58034043f59 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -584,7 +584,7 @@ else dol_htmloutput_errors($mesg,''); - $nbofservices=sizeof($object->lines); + $nbofservices=count($object->lines); $author = new User($db); $author->fetch($object->user_author_id); @@ -793,7 +793,7 @@ else } // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) print ''; - if ($user->rights->contrat->creer && sizeof($arrayothercontracts) && ($object->statut >= 0)) + if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) { print ''; print img_picto($langs->trans("MoveToAnotherContract"),'uparrow'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cf17e5dc564..276a9bc8d90 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -699,7 +699,7 @@ abstract class CommonObject { $contactAlreadySelected = array(); $tab = $this->liste_contact(-1,$source); - $num=sizeof($tab); + $num=count($tab); $i = 0; while ($i < $num) { @@ -1345,7 +1345,7 @@ abstract class CommonObject { dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); - $num=sizeof($objectids); + $num=count($objectids); for ($i=0;$i<$num;$i++) { @@ -1474,7 +1474,7 @@ abstract class CommonObject } // Request to get complementary values - if (sizeof($optionsArray) > 0) + if (count($optionsArray) > 0) { $sql = "SELECT rowid"; foreach ($optionsArray as $name => $label) @@ -1516,7 +1516,7 @@ abstract class CommonObject */ function insertExtraFields() { - if (sizeof($this->array_options) > 0) + if (count($this->array_options) > 0) { $this->db->begin(); @@ -1679,7 +1679,7 @@ abstract class CommonObject $this->fetchObjectLinked(); - $num = sizeof($this->linkedObjects); + $num = count($this->linkedObjects); foreach($this->linkedObjects as $objecttype => $objects) { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index c904bbc1411..8b9d9431ac3 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -311,8 +311,8 @@ class DolGraph $k = 0; $vals = array(); - $nblines = sizeof($this->data); - $nbvalues = sizeof($this->data[0]) - 1; + $nblines = count($this->data); + $nbvalues = count($this->data[0]) - 1; for ($j = 0 ; $j < $nblines ; $j++) { @@ -331,8 +331,8 @@ class DolGraph $k = 0; $vals = array(); - $nblines = sizeof($this->data); - $nbvalues = sizeof($this->data[0]) - 1; + $nblines = count($this->data); + $nbvalues = count($this->data[0]) - 1; for ($j = 0 ; $j < $nblines ; $j++) { @@ -397,7 +397,7 @@ class DolGraph */ function draw($file) { - if (! is_array($this->data) || sizeof($this->data) < 1) + if (! is_array($this->data) || count($this->data) < 1) { $this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters"; dol_syslog("DolGraph::draw ".$this->error, LOG_ERR); @@ -471,7 +471,7 @@ class DolGraph // On boucle sur chaque lot de donnees $legends=array(); $i=0; - $nblot=sizeof($this->data[0])-1; + $nblot=count($this->data[0])-1; while ($i < $nblot) { @@ -558,7 +558,7 @@ class DolGraph $group->legend->setTextFont(new $artichow_defaultfont(10)); // This is to force Artichow to use awFileFontDriver to // solve a bug in Artichow with UTF8 - if (sizeof($this->Legend)) + if (count($this->Legend)) { if ($this->type == 'bars') $group->legend->add($plot, $this->Legend[$i], LEGEND_BACKGROUND); if ($this->type == 'lines') $group->legend->add($plot, $this->Legend[$i], LEGEND_LINE); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 61f9ba290b2..b59cddc5764 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -143,7 +143,7 @@ class HookManager if ($method == 'doActions' && method_exists($actioninstance,$method)) { $resaction+=$actioninstance->doActions($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example) - if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && sizeof($actioninstance->errors) > 0)) + if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0)) { $this->error=$actioninstance->error; $this->errors=$actioninstance->errors; if ($action=='add') $action='create'; // TODO this change must be inside the doActions @@ -153,7 +153,7 @@ class HookManager else if ($method == 'showInputFields' && method_exists($actioninstance,$method)) { $resaction+=$actioninstance->showInputFields($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example) - if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && sizeof($actioninstance->errors) > 0)) + if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0)) { $this->error=$actioninstance->error; $this->errors=$actioninstance->errors; } @@ -161,7 +161,7 @@ class HookManager else if ($method == 'showOutputFields' && method_exists($actioninstance,$method)) { $resaction+=$actioninstance->showOutputFields($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example) - if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && sizeof($actioninstance->errors) > 0)) + if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0)) { $this->error=$actioninstance->error; $this->errors=$actioninstance->errors; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6a38310fde1..918b1d51a64 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -723,8 +723,8 @@ class Form if ($htmlname != 'none') { $disabled=0; - if (is_array($exclude) && sizeof($exclude) && in_array($obj->rowid,$exclude)) $disabled=1; - if (is_array($limitto) && sizeof($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1; + if (is_array($exclude) && count($exclude) && in_array($obj->rowid,$exclude)) $disabled=1; + if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1; if ($selected && $selected == $obj->rowid) { print ''; + if (count($this->arrayofproducts)) $s.=''; else $s.=''; foreach($this->arrayofproducts as $key => $val) { diff --git a/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php b/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php index 73c9f7031cd..07303b6ef38 100644 --- a/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php @@ -105,7 +105,7 @@ class pdf_baleine extends ModelePDFProjects if ($conf->projet->dir_output) { - $nblignes = sizeof($object->lines); + $nblignes = count($object->lines); $default_font_size = pdf_getPDFFontsize($outputlangs); @@ -139,7 +139,7 @@ class pdf_baleine extends ModelePDFProjects $tasksarray = $task->getTasksArray(0,0,$object->id); $object->lines=$tasksarray; - $nblignes=sizeof($object->lines); + $nblignes=count($object->lines); $pdf->Open(); $pagenb=0; @@ -382,7 +382,7 @@ class pdf_baleine extends ModelePDFProjects if ($objecttype == 'commande') { $outputlangs->load('orders'); - $num=sizeof($objects); + $num=count($objects); for ($i=0;$i<$num;$i++) { $posy+=4; diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 32c2ef1b9ef..853119a43fb 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -953,7 +953,7 @@ class pdf_propale_azur extends ModelePDFPropales $carac_emetteur=''; // Add internal contact of proposal if defined $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); - if (sizeof($arrayidcontact) > 0) + if (count($arrayidcontact) > 0) { $object->fetch_user($arrayidcontact[0]); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; @@ -991,7 +991,7 @@ class pdf_propale_azur extends ModelePDFPropales // If CUSTOMER contact defined, we use it $usecontact=false; $arrayidcontact=$object->getIdContact('external','CUSTOMER'); - if (sizeof($arrayidcontact) > 0) + if (count($arrayidcontact) > 0) { $usecontact=true; $result=$object->fetch_contact($arrayidcontact[0]); diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php index 97c3078f8c2..b9ff4420a80 100644 --- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -953,7 +953,7 @@ class pdf_propale_jaune extends ModelePDFPropales $carac_emetteur=''; // Add internal contact of proposal if defined $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); - if (sizeof($arrayidcontact) > 0) + if (count($arrayidcontact) > 0) { $object->fetch_user($arrayidcontact[0]); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; @@ -991,7 +991,7 @@ class pdf_propale_jaune extends ModelePDFPropales // If CUSTOMER contact defined, we use it $usecontact=false; $arrayidcontact=$object->getIdContact('external','CUSTOMER'); - if (sizeof($arrayidcontact) > 0) + if (count($arrayidcontact) > 0) { $usecontact=true; $result=$object->fetch_contact($arrayidcontact[0]); diff --git a/htdocs/includes/modules/rapport/pdf_paiement.class.php b/htdocs/includes/modules/rapport/pdf_paiement.class.php index ede63b64be5..7f9e90b7624 100644 --- a/htdocs/includes/modules/rapport/pdf_paiement.class.php +++ b/htdocs/includes/modules/rapport/pdf_paiement.class.php @@ -269,7 +269,7 @@ class pdf_paiement $oldprowid = 0; $pdf->SetFillColor(220,220,220); $yp = 0; - $numlines=sizeof($lines); + $numlines=count($lines); for ($j = 0 ; $j < $numlines ; $j++) { $i = $j; diff --git a/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php index e14aed7ff5d..db81b13b1f8 100644 --- a/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php @@ -108,7 +108,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc else { $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); - if (sizeof($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); + if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); @@ -129,7 +129,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte.= ''; // Scan directories - if (sizeof($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.sizeof($listoffiles).''; + if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; $texte.= ''; diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 747f3c50a36..b4c6d068c4b 100755 --- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -167,7 +167,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if (file_exists($dir)) { - $nblignes = sizeof($object->lines); + $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); @@ -821,7 +821,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // If BILLING contact defined on invoice, we use it $usecontact=false; $arrayidcontact=$object->getIdContact('external','BILLING'); - if (sizeof($arrayidcontact) > 0) + if (count($arrayidcontact) > 0) { $usecontact=true; $result=$object->fetch_contact($arrayidcontact[0]); diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php index 606a1bf264a..28c35c0293e 100644 --- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -170,7 +170,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (file_exists($dir)) { - $nblignes = sizeof($object->lines); + $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); @@ -752,7 +752,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // If BILLING contact defined on invoice, we use it $usecontact=false; $arrayidcontact=$object->getIdContact('external','BILLING'); - if (sizeof($arrayidcontact) > 0) + if (count($arrayidcontact) > 0) { $usecontact=true; $result=$object->fetch_contact($arrayidcontact[0]); diff --git a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php index 5ca41b94c65..d1bd3e3fffc 100644 --- a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php +++ b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php @@ -136,7 +136,7 @@ class InterfaceLdapsynchro $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; $records=$ldap->search($container,$search); - if (sizeof($records) && $records['count'] == 0) + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -167,7 +167,7 @@ class InterfaceLdapsynchro $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; $records=$ldap->search($container,$search); - if (sizeof($records) && $records['count'] == 0) + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -240,7 +240,7 @@ class InterfaceLdapsynchro $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; $records=$ldap->search($container,$search); - if (sizeof($records) && $records['count'] == 0) + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -310,7 +310,7 @@ class InterfaceLdapsynchro $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; $records=$ldap->search($container,$search); - if (sizeof($records) && $records['count'] == 0) + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -433,7 +433,7 @@ class InterfaceLdapsynchro $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; $records=$ldap->search($container,$search); - if (sizeof($records) && $records['count'] == 0) + if (count($records) && $records['count'] == 0) { $olddn = ''; } diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 44369ab7634..edb3208656d 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -400,7 +400,7 @@ else print $langs->trans("UpgradeDesc"); if ($ok) { - if (sizeof($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and a version x.y already available + if (count($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and a version x.y already available { // Now we check if this is the first qualified choice if ($allowupgrade && empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0) @@ -408,7 +408,7 @@ else print '
'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); print '
'.$langs->trans("InstallChoiceSuggested").'
'; - if ($count < sizeof($migarray)) // There is other choices after + if ($count < count($migarray)) // There is other choices after { print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION); } @@ -427,7 +427,7 @@ else if ($allowupgrade) { // If it's not last updagre script, action = upgrade_tmp, if last action = upgrade - print '
'.$langs->trans("Start").''; + print ''.$langs->trans("Start").''; } else { diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 74255c7c1f8..b613f3546af 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -331,7 +331,8 @@ if (! $error && $db->connected && $action == "set") $dir[6] = $main_data_dir."/produit"; // Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas - for ($i = 0 ; $i < sizeof($dir) ; $i++) + $num=count($dir); + for ($i = 0; $i < $num; $i++) { if (is_dir($dir[$i])) { diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 2f25a2fc261..df3e82658b9 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -296,7 +296,7 @@ if ($action == "set") $versioncommande=explode('.',$reg[1]); //print var_dump($versioncommande); //print var_dump($versionarray); - if (sizeof($versioncommande) && sizeof($versionarray) + if (count($versioncommande) && count($versionarray) && versioncompare($versioncommande,$versionarray) <= 0) { // Version qualified, delete SQL comments @@ -309,7 +309,7 @@ if ($action == "set") $versioncommande=explode('.',$reg[1]); //print var_dump($versioncommande); //print var_dump($versionarray); - if (sizeof($versioncommande) && sizeof($versionarray) + if (count($versioncommande) && count($versionarray) && versioncompare($versioncommande,$versionarray) <= 0) { // Version qualified, delete SQL comments @@ -533,7 +533,7 @@ if ($action == "set") } fclose($fp); - dolibarr_install_syslog("Found ".$linefound." records, defined ".sizeof($arrayofrequests)." groups.",LOG_DEBUG); + dolibarr_install_syslog("Found ".$linefound." records, defined ".count($arrayofrequests)." groups.",LOG_DEBUG); // We loop on each requests foreach($arrayofrequests as $buffer) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 794e2d8ca39..94d37eab946 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -385,7 +385,7 @@ function pFooter($nonext=0,$setuplang='',$jscheckfunction='') print ''."\n"; // If there is some logs in buffer to show - if (isset($conf->logbuffer) && sizeof($conf->logbuffer)) + if (isset($conf->logbuffer) && count($conf->logbuffer)) { print "\n"; print "