From b43c7e1b35c2bdc5d8a2479e2c775ca9b79abc6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jul 2012 14:23:33 +0200 Subject: [PATCH 1/2] Qual: Removed warning --- htdocs/core/menus/standard/eldy.lib.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 017589331f2..eca8486afeb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -784,7 +784,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $langs->load("suppliers"); $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); } @@ -808,7 +808,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $langs->load("categories"); // Categories prospects/customers $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } @@ -816,7 +816,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) if ($conf->fournisseur->enabled) { $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } @@ -913,7 +913,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) { $langs->load("bills"); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/compta/clients.php?action=facturer&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); } @@ -939,7 +939,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) { $langs->load("bills"); $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - if (! isset($user->societe_id) || $user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); } @@ -1126,7 +1126,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) if (! empty($conf->product->enabled)) { $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product'); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); @@ -1145,7 +1145,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) if (! empty($conf->service->enabled)) { $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); } @@ -1161,7 +1161,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } @@ -1204,7 +1204,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); // Security check - if ($user->societe_id == 0) + if (empty($user->societe_id)) { $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire); } @@ -1367,7 +1367,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $tabMenu=array(); $menuArbo = new Menubase($db,'eldy','left'); - $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'eldy',$tabMenu); + $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu); } From e8b2489c1ce935094bda228e9f21ee2302ca577a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jul 2012 15:28:39 +0200 Subject: [PATCH 2/2] Checkstyle --- htdocs/commande/fiche.php | 42 +++++++++---------- .../cheque/class/remisecheque.class.php | 4 +- .../filemanagerdol/connectors/php/basexml.php | 23 ++++++---- .../connectors/php/connector.php | 21 +++++----- .../connectors/php/phpcompat.php | 16 ------- .../filemanagerdol/connectors/php/upload.php | 13 +++--- .../filemanagerdol/connectors/php/util.php | 27 ++++++++---- htdocs/install/etape1.php | 4 +- 8 files changed, 74 insertions(+), 76 deletions(-) delete mode 100755 htdocs/core/filemanagerdol/connectors/php/phpcompat.php diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 3470eeeee1d..c44bccdbaa8 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -632,27 +632,27 @@ else if ($action == 'addline' && $user->rights->commande->creer) { // Insert line $result = $object->addline( - $object->id, - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, - $localtax2_tx, - GETPOST('idprod'), - GETPOST('remise_percent'), - $info_bits, - 0, - $price_base_type, - $pu_ttc, - $date_start, - $date_end, - $type, - -1, - '', - GETPOST('fk_parent_line'), - GETPOST('np_fournprice'), - GETPOST('np_buying_price') + $object->id, + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, + $localtax2_tx, + GETPOST('idprod'), + GETPOST('remise_percent'), + $info_bits, + 0, + $price_base_type, + $pu_ttc, + $date_start, + $date_end, + $type, + -1, + '', + GETPOST('fk_parent_line'), + GETPOST('np_fournprice'), + GETPOST('np_buying_price') ); if ($result > 0) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 3901d3efc90..2cfede23c7c 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -43,9 +43,9 @@ class RemiseCheque extends CommonObject /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function RemiseCheque($DB) + function RemiseCheque($db) { $this->db = $DB; $this->next_id = 0; diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index 4098375a255..84d2e04666a 100755 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -44,7 +44,7 @@ function SetXmlHeaders() header('Pragma: no-cache'); // Set the response format. - header( 'Content-Type: text/xml; charset=utf-8' ); + header('Content-Type: text/xml; charset=utf-8'); } function CreateXmlHeader( $command, $resourceType, $currentFolder ) @@ -58,7 +58,7 @@ function CreateXmlHeader( $command, $resourceType, $currentFolder ) echo '' ; // Add the current folder node. - echo '' ; + echo '' ; $GLOBALS['HeaderSent'] = true ; } @@ -68,14 +68,21 @@ function CreateXmlFooter() echo '' ; } -function SendError( $number, $text ) +/** + * SendError + * + * @param unknown_type $number Number + * @param unknown_type $text Text + * @return void + */ +function SendError($number, $text) { if ( $_GET['Command'] == 'FileUpload' ) - SendUploadResults( $number, "", "", $text ); + SendUploadResults($number, "", "", $text); if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) { - SendErrorNode( $number, $text ); + SendErrorNode($number, $text); CreateXmlFooter(); } else @@ -87,17 +94,17 @@ function SendError( $number, $text ) echo '' ; - SendErrorNode( $number, $text ); + SendErrorNode($number, $text); echo '' ; } exit ; } -function SendErrorNode( $number, $text ) +function SendErrorNode($number, $text) { if ($text) - echo '' ; + echo '' ; else echo '' ; } diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.php b/htdocs/core/filemanagerdol/connectors/php/connector.php index af720849a79..656c38c1c3a 100755 --- a/htdocs/core/filemanagerdol/connectors/php/connector.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.php @@ -29,10 +29,9 @@ require('./util.php'); require('./io.php'); require('./basexml.php'); require('./commands.php'); -require('./phpcompat.php'); if ( !$Config['Enabled'] ) - SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ); + SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file'); DoResponse(); @@ -50,33 +49,33 @@ function DoResponse() $sCurrentFolder = GetCurrentFolder(); // Check if it is an allowed command - if ( ! IsAllowedCommand( $sCommand ) ) - SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ); + if (! IsAllowedCommand($sCommand)) + SendError(1, 'The "' . $sCommand . '" command isn\'t allowed'); // Check if it is an allowed type. - if ( !IsAllowedType( $sResourceType ) ) - SendError( 1, 'Invalid type specified' ); + if (! IsAllowedType($sResourceType)) + SendError(1, 'Invalid type specified'); // File Upload doesn't have to Return XML, so it must be intercepted before anything. if ( $sCommand == 'FileUpload' ) { - FileUpload( $sResourceType, $sCurrentFolder, $sCommand ); + FileUpload($sResourceType, $sCurrentFolder, $sCommand); return ; } - CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ); + CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder); // Execute the required command. switch ( $sCommand ) { case 'GetFolders' : - GetFolders( $sResourceType, $sCurrentFolder ); + GetFolders($sResourceType, $sCurrentFolder); break ; case 'GetFoldersAndFiles' : - GetFoldersAndFiles( $sResourceType, $sCurrentFolder ); + GetFoldersAndFiles($sResourceType, $sCurrentFolder); break ; case 'CreateFolder' : - CreateFolder( $sResourceType, $sCurrentFolder ); + CreateFolder($sResourceType, $sCurrentFolder); break ; } diff --git a/htdocs/core/filemanagerdol/connectors/php/phpcompat.php b/htdocs/core/filemanagerdol/connectors/php/phpcompat.php deleted file mode 100755 index 518d533e260..00000000000 --- a/htdocs/core/filemanagerdol/connectors/php/phpcompat.php +++ /dev/null @@ -1,16 +0,0 @@ -'); fclose($fp); @@ -722,7 +722,7 @@ function write_master_file($masterfile,$main_dir) { clearstatcache(); fputs($fp, ''); fclose($fp);