From 686f5add8263bbdda073a0ff5cf1681682c7e772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= <rdoursenaud@gpcsolutions.fr> Date: Wed, 5 Jun 2013 16:12:07 +0200 Subject: [PATCH] Normalized line endings to LF --- htdocs/theme/bureau2crea/style.css.php | 8 +- htdocs/theme/cameleo/style.css.php | 8 +- htdocs/theme/eldy/style.css.php | 12 +- htdocs/user/class/user.class.php | 6 +- htdocs/user/clicktodial.php | 10 +- htdocs/user/logout.php | 10 +- htdocs/user/param_ihm.php | 8 +- htdocs/user/passwordforgotten.php | 10 +- htdocs/user/perms.php | 4 +- htdocs/viewimage.php | 18 +- htdocs/webservices/README | 28 +- .../webservices/server_supplier_invoice.php | 2 +- scripts/bank/export-bank-receipts.php | 438 +++++++++--------- .../company/export-contacts-xls-example.php | 8 +- .../email_expire_services_to_customers.php | 34 +- ...ail_expire_services_to_representatives.php | 32 +- scripts/cron/cron_run_jobs.php | 20 +- scripts/emailings/mailing-send.php | 26 +- .../email_unpaid_invoices_to_customers.php | 66 +-- ...ail_unpaid_invoices_to_representatives.php | 12 +- scripts/invoices/rebuild_merge_pdf.php | 28 +- .../members/sync_members_ldap2dolibarr.php | 24 +- scripts/user/sync_groups_ldap2dolibarr.php | 44 +- scripts/user/sync_users_ldap2dolibarr.php | 16 +- test/phpunit/AdherentTest.php | 2 +- test/phpunit/CategorieTest.php | 8 +- test/phpunit/NumberingModulesTest.php | 24 +- test/phpunit/UserTest.php | 94 ++-- 28 files changed, 500 insertions(+), 500 deletions(-) diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 46abe55ecae..d1789ddef07 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -60,10 +60,10 @@ $fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -$dol_hide_topmenu=$conf->dol_hide_topmenu; -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; +$dol_hide_topmenu=$conf->dol_hide_topmenu; +$dol_hide_leftmenu=$conf->dol_hide_leftmenu; +$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; +$dol_no_mouse_hover=$conf->dol_no_mouse_hover; $dol_use_jmobile=$conf->dol_use_jmobile; $path=''; // This value may be used in future for external module to overwrite theme diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index be7c6532f44..2f58829b422 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -60,10 +60,10 @@ $fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -$dol_hide_topmenu=$conf->dol_hide_topmenu; -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; +$dol_hide_topmenu=$conf->dol_hide_topmenu; +$dol_hide_leftmenu=$conf->dol_hide_leftmenu; +$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; +$dol_no_mouse_hover=$conf->dol_no_mouse_hover; $dol_use_jmobile=$conf->dol_use_jmobile; $path=''; // This value may be used in future for external module to overwrite theme diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index a311080a73d..a98b2f72df2 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -58,8 +58,8 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; +$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; +$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='eldy'; // Value of theme @@ -70,10 +70,10 @@ $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Ar $img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; -$dol_use_jmobile=$conf->dol_use_jmobile; +$dol_hide_leftmenu=$conf->dol_hide_leftmenu; +$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; +$dol_no_mouse_hover=$conf->dol_no_mouse_hover; +$dol_use_jmobile=$conf->dol_use_jmobile; // Define reference colors diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7e884a5c10a..aa6fb883a1d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1113,9 +1113,9 @@ class User extends CommonObject $this->note = trim($this->note); $this->openid = trim(empty($this->openid)?'':$this->openid); // Avoid warning $this->admin = $this->admin?$this->admin:0; - $this->address = empty($this->address)?'':$this->address; - $this->zip = empty($this->zip)?'':$this->zip; - $this->town = empty($this->town)?'':$this->town; + $this->address = empty($this->address)?'':$this->address; + $this->zip = empty($this->zip)?'':$this->zip; + $this->town = empty($this->town)?'':$this->town; // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 48f02ca5603..b95374d800b 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -54,7 +54,7 @@ if ($action == 'update' && ! $_POST['cancel']) $edituser->clicktodial_url = GETPOST("url"); $edituser->clicktodial_login = GETPOST("login"); $edituser->clicktodial_password = GETPOST("password"); - $edituser->clicktodial_poste = GETPOST("poste"); + $edituser->clicktodial_poste = GETPOST("poste"); $result=$edituser->update_clicktodial(); if ($result < 0) setEventMessage($edituser->error,'errors'); @@ -155,10 +155,10 @@ if ($id > 0) print '</table>'; - print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'">'; - print ' '; - print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; - print '</center>'; + print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'">'; + print ' '; + print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; + print '</center>'; print '</form>'; } diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 3dcd1eae8ff..edd860426aa 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -63,9 +63,9 @@ if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOU if (GETPOST('dol_hide_topmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1'; if (GETPOST('dol_hide_leftmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1'; -if (GETPOST('dol_optimize_smallscreen')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_optimize_smallscreen=1'; -if (GETPOST('dol_no_mouse_hover')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_no_mouse_hover=1'; -if (GETPOST('dol_use_jmobile')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_use_jmobile=1'; +if (GETPOST('dol_optimize_smallscreen')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_optimize_smallscreen=1'; +if (GETPOST('dol_no_mouse_hover')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_no_mouse_hover=1'; +if (GETPOST('dol_use_jmobile')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_use_jmobile=1'; // Destroy session $prefix=dol_getprefix(); @@ -77,8 +77,8 @@ session_destroy(); dol_syslog("End of session ".$sessionname); // TODO Not sure this is required -unset($_SESSION['dol_login']); -unset($_SESSION['dol_entity']); +unset($_SESSION['dol_login']); +unset($_SESSION['dol_entity']); header("Location: ".$url); ?> diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 568cebad27e..54a9093bd34 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -122,10 +122,10 @@ $title = $langs->trans("User"); if ($action == 'edit') { - print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="action" value="update">'; - print '<input type="hidden" name="id" value="'.$id.'">'; + print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="update">'; + print '<input type="hidden" name="id" value="'.$id.'">'; } diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 112f38caded..d1512fea9ab 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -55,11 +55,11 @@ $conf->entity = (GETPOST('entity') ? GETPOST('entity') : 1); $hookmanager->initHooks(array('passwordforgottenpage')); -if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; -if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1; -if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1; -if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1; -if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1; +if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; +if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1; +if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1; +if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1; +if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1; /** diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 616b0609f7a..0c2b17dcb1a 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -272,8 +272,8 @@ print '</tr>'."\n"; print '</table><br>'; if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'<br>'; -// Show warning about external users -if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n"; +// Show warning about external users +if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n"; // For multicompany transversal mode if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index efa2dbe576d..b12a38000a7 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -47,7 +47,7 @@ function llxHeader() { } * * @return void */ -function llxFooter() { } +function llxFooter() { } require 'main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -97,15 +97,15 @@ else $type=dol_mimetype($original_file); // Suppression de la chaine de caractere ../ dans $original_file $original_file = str_replace("../","/", $original_file); -// Find the subdirectory name as the reference -$refname=basename(dirname($original_file)."/"); - -// Security check +// Find the subdirectory name as the reference +$refname=basename(dirname($original_file)."/"); + +// Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); -$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname); -$accessallowed = $check_access['accessallowed']; -$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; -$original_file = $check_access['original_file']; +$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname); +$accessallowed = $check_access['accessallowed']; +$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; +$original_file = $check_access['original_file']; // Security: // Limit access if permissions are wrong diff --git a/htdocs/webservices/README b/htdocs/webservices/README index 14535775c52..b4c1137bf67 100644 --- a/htdocs/webservices/README +++ b/htdocs/webservices/README @@ -1,14 +1,14 @@ -README (english) ---------------------------------------------------------- -This directory contains files to make Dolibarr a server -of SOAP Web Services. - -* To see all Webservices provided by Dolibarr, just call following Url: -http://mydomain.com/dolibarr/webservices/server.php - -* WSDL file of Web services provided by Dolibarr can be obtained at: -http://mydomain.com/dolibarr/webservices/server.php?wsdl -and is also saved in file: -server.wsdl - -Note, you can test this Webservices by calling the page client.php. +README (english) +--------------------------------------------------------- +This directory contains files to make Dolibarr a server +of SOAP Web Services. + +* To see all Webservices provided by Dolibarr, just call following Url: +http://mydomain.com/dolibarr/webservices/server.php + +* WSDL file of Web services provided by Dolibarr can be obtained at: +http://mydomain.com/dolibarr/webservices/server.php?wsdl +and is also saved in file: +server.wsdl + +Note, you can test this Webservices by calling the page client.php. diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 0655b0cd729..57021f5f2b2 100755 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -381,7 +381,7 @@ function getSupplierInvoicesForThirdParty($authentication,$idthirdparty) $result=$invoice->fetch($obj->facid); if ($result < 0) { - $error++; + $error++; $errorcode=$result; $errorlabel=$invoice->error; break; } diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 825d13a3afe..8ba7f665f60 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -33,33 +33,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } -require_once($path."../../htdocs/master.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; +require_once($path."../../htdocs/master.inc.php"); +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; // Global variables $version=DOL_VERSION; $error=0; - - + + /* * Main */ -@set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +@set_time_limit(0); +print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; if (! isset($argv[3]) || ! $argv[3]) { print "Usage: $script_file bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n"; @@ -68,52 +68,52 @@ if (! isset($argv[3]) || ! $argv[3]) { $bankref=$argv[1]; $num=$argv[2]; $model=$argv[3]; -$newlangid='en_EN'; // To force a new lang id +$newlangid='en_EN'; // To force a new lang id $invoicestatic=new Facture($db); $invoicesupplierstatic=new FactureFournisseur($db); -$societestatic=new Societe($db); +$societestatic=new Societe($db); $chargestatic=new ChargeSociales($db); -$memberstatic=new Adherent($db); -$paymentstatic=new Paiement($db); +$memberstatic=new Adherent($db); +$paymentstatic=new Paiement($db); $paymentsupplierstatic=new PaiementFourn($db); -$paymentsocialcontributionstatic=new PaymentSocialContribution($db); -$paymentvatstatic=new Tva($db); -$bankstatic=new Account($db); +$paymentsocialcontributionstatic=new PaymentSocialContribution($db); +$paymentvatstatic=new Tva($db); +$bankstatic=new Account($db); $banklinestatic=new AccountLine($db); // Parse parameters -foreach ($argv as $key => $value) -{ - $found=false; - - // Define options - if (preg_match('/^lang=/i',$value)) - { - $found=true; - $valarray=explode('=',$value); - $newlangid=$valarray[1]; - print 'Use language '.$newlangid.".\n"; +foreach ($argv as $key => $value) +{ + $found=false; + + // Define options + if (preg_match('/^lang=/i',$value)) + { + $found=true; + $valarray=explode('=',$value); + $newlangid=$valarray[1]; + print 'Use language '.$newlangid.".\n"; } } -$outputlangs = $langs; -if (! empty($newlangid)) -{ - if ($outputlangs->defaultlang != $newlangid) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlangid); - } +$outputlangs = $langs; +if (! empty($newlangid)) +{ + if ($outputlangs->defaultlang != $newlangid) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlangid); + } } $outputlangs->load("main"); $outputlangs->load("bills"); -$outputlangs->load("companies"); -$outputlangs->load("banks"); -$outputlangs->load("members"); -$outputlangs->load("compta"); - +$outputlangs->load("companies"); +$outputlangs->load("banks"); +$outputlangs->load("members"); +$outputlangs->load("compta"); + $acct=new Account($db); $result=$acct->fetch('',$bankref); @@ -128,22 +128,22 @@ else } -// Creation de la classe d'export du model ExportXXX -$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/"; -$file = "export_".$model.".modules.php"; -$classname = "Export".$model; +// Creation de la classe d'export du model ExportXXX +$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/"; +$file = "export_".$model.".modules.php"; +$classname = "Export".$model; if (! dol_is_file($dir.$file)) { print "No driver to export with format ".$model."\n"; exit; } -require_once $dir.$file; -$objmodel = new $classname($db); +require_once $dir.$file; +$objmodel = new $classname($db); // Define target path -$dirname = $conf->banque->dir_temp; -$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension; +$dirname = $conf->banque->dir_temp; +$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension; $array_fields=array( @@ -154,21 +154,21 @@ $array_fields=array( 'soldbefore'=>$outputlangs->transnoentitiesnoconv("BankBalanceBefore"), 'soldafter'=>$outputlangs->transnoentitiesnoconv("BankBalanceAfter"), 'comment'=>$outputlangs->transnoentitiesnoconv("Comment") ); -$array_selected=array( -'bankreceipt'=>'bankreceipt', 'bankaccount'=>'bankaccount', -'dateop'=>'dateop','dateval'=>'dateval','type'=>'type', -'description'=>'description', 'thirdparty'=>'thirdparty', 'accountelem'=>'accountelem', +$array_selected=array( +'bankreceipt'=>'bankreceipt', 'bankaccount'=>'bankaccount', +'dateop'=>'dateop','dateval'=>'dateval','type'=>'type', +'description'=>'description', 'thirdparty'=>'thirdparty', 'accountelem'=>'accountelem', 'debit'=>'debit', 'credit'=>'credit', 'soldbefore'=>'soldbefore','soldafter'=>'soldafter', -'comment'=>'comment' -); +'comment'=>'comment' +); $array_export_TypeFields=array( -'bankreceipt'=>'Text', 'bankaccount'=>'Text', -'dateop'=>'Date','dateval'=>'Date','type'=>'Text', -'description'=>'Text', 'thirdparty'=>'Text', 'accountelem'=>'Text', +'bankreceipt'=>'Text', 'bankaccount'=>'Text', +'dateop'=>'Date','dateval'=>'Date','type'=>'Text', +'description'=>'Text', 'thirdparty'=>'Text', 'accountelem'=>'Text', 'debit'=>'Number', 'credit'=>'Number', 'soldbefore'=>'Number','soldafter'=>'Number', -'comment'=>'Text' +'comment'=>'Text' ); @@ -180,69 +180,69 @@ foreach($arraynum as $val) if ($listofnum != "'") $listofnum.="','"; $listofnum.=$val; } -$listofnum.="'"; -$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; -$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; -$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; -$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; -$sql.= ", ".MAIN_DB_PREFIX."bank as b"; -$sql.= " WHERE b.num_releve IN (".$listofnum.")"; -if (!isset($num)) $sql.= " OR b.num_releve is null"; -$sql.= " AND b.fk_account = ".$acct->id; -$sql.= " AND b.fk_account = ba.rowid"; -$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day -//print $sql; +$listofnum.="'"; +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; +$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; +$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; +$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; +$sql.= ", ".MAIN_DB_PREFIX."bank as b"; +$sql.= " WHERE b.num_releve IN (".$listofnum.")"; +if (!isset($num)) $sql.= " OR b.num_releve is null"; +$sql.= " AND b.fk_account = ".$acct->id; +$sql.= " AND b.fk_account = ba.rowid"; +$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day +//print $sql; $resql=$db->query($sql); if ($resql) { - $balancebefore=array(); + $balancebefore=array(); $numrows = $db->num_rows($resql); if ($numrows > 0) { - // Open file - print 'Open file '.$filename.' into directory '.$dirname."\n"; - dol_mkdir($dirname); - $result=$objmodel->open_file($dirname."/".$filename, $outputlangs); - - if ($result < 0) + // Open file + print 'Open file '.$filename.' into directory '.$dirname."\n"; + dol_mkdir($dirname); + $result=$objmodel->open_file($dirname."/".$filename, $outputlangs); + + if ($result < 0) { - print 'Failed to create file '.$filename.' into dir '.$dirname.'.'."\n"; + print 'Failed to create file '.$filename.' into dir '.$dirname.'.'."\n"; return -1; - } - - // Genere en-tete - $objmodel->write_header($outputlangs); - - // Genere ligne de titre - $objmodel->write_title($array_fields,$array_selected,$outputlangs,$array_export_TypeFields); - } + } + + // Genere en-tete + $objmodel->write_header($outputlangs); + + // Genere ligne de titre + $objmodel->write_title($array_fields,$array_selected,$outputlangs,$array_export_TypeFields); + } $i=0; - while ($i < $numrows) + while ($i < $numrows) { - $thirdparty=''; + $thirdparty=''; $accountelem=''; - $comment=''; - - $objp = $db->fetch_object($resql); + $comment=''; + + $objp = $db->fetch_object($resql); // Calculate start balance if (! isset($balancebefore[$objp->num_releve])) - { + { print 'Calculate start balance for receipt '.$objp->num_releve."\n"; - $sql2 = "SELECT sum(b.amount) as amount"; - $sql2.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql2.= " WHERE b.num_releve < '".$db->escape($objp->num_releve)."'"; - $sql2.= " AND b.fk_account = ".$objp->bankid; - $resql2=$db->query($sql2); - if ($resql2) - { - $obj2=$db->fetch_object($resql2); - $balancebefore[$objp->num_releve] = ($obj2->amount?$obj2->amount:0); - $db->free($resql2); + $sql2 = "SELECT sum(b.amount) as amount"; + $sql2.= " FROM ".MAIN_DB_PREFIX."bank as b"; + $sql2.= " WHERE b.num_releve < '".$db->escape($objp->num_releve)."'"; + $sql2.= " AND b.fk_account = ".$objp->bankid; + $resql2=$db->query($sql2); + if ($resql2) + { + $obj2=$db->fetch_object($resql2); + $balancebefore[$objp->num_releve] = ($obj2->amount?$obj2->amount:0); + $db->free($resql2); } else { @@ -254,44 +254,44 @@ if ($resql) } $totalbefore = $total; - $total = $total + $objp->amount; - - $var=!$var; - - // Date operation - $dateop=$db->jdate($objp->do); - - // Date de valeur - $datevalue=$db->jdate($objp->dv); - - // Num cheque - $numchq=($objp->num_chq?$objp->num_chq:''); - - // Libelle - $reg=array(); - preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction - if ($reg[1] && $langs->transnoentitiesnoconv($reg[1])!=$reg[1]) $description=$langs->transnoentitiesnoconv($reg[1]); - else $description=$objp->label; - - /* - * Ajout les liens (societe, company...) - */ - $links = $acct->get_url($objp->rowid); - foreach($links as $key=>$val) - { - if ($links[$key]['type']=='payment') - { + $total = $total + $objp->amount; + + $var=!$var; + + // Date operation + $dateop=$db->jdate($objp->do); + + // Date de valeur + $datevalue=$db->jdate($objp->dv); + + // Num cheque + $numchq=($objp->num_chq?$objp->num_chq:''); + + // Libelle + $reg=array(); + preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction + if ($reg[1] && $langs->transnoentitiesnoconv($reg[1])!=$reg[1]) $description=$langs->transnoentitiesnoconv($reg[1]); + else $description=$objp->label; + + /* + * Ajout les liens (societe, company...) + */ + $links = $acct->get_url($objp->rowid); + foreach($links as $key=>$val) + { + if ($links[$key]['type']=='payment') + { $paymentstatic->fetch($links[$key]['url_id']); - $tmparray=$paymentstatic->getBillsArray(''); + $tmparray=$paymentstatic->getBillsArray(''); foreach($tmparray as $key => $val) { $invoicestatic->fetch($val); if ($accountelem) $accountelem.= ', '; $accountelem.=$invoicestatic->ref; } - } - elseif ($links[$key]['type']=='payment_supplier') - { + } + elseif ($links[$key]['type']=='payment_supplier') + { $paymentsupplierstatic->fetch($links[$key]['url_id']); $tmparray=$paymentsupplierstatic->getBillsArray(''); foreach($tmparray as $key => $val) @@ -300,94 +300,94 @@ if ($resql) if ($accountelem) $accountelem.= ', '; $accountelem.=$invoicesupplierstatic->ref; } - } - elseif ($links[$key]['type']=='payment_sc') + } + elseif ($links[$key]['type']=='payment_sc') { - $paymentsocialcontributionstatic->fetch($links[$key]['url_id']); + $paymentsocialcontributionstatic->fetch($links[$key]['url_id']); if ($accountelem) $accountelem.= ', '; $accountelem.=$langs->transnoentitiesnoconv("SocialContribution").' '.$paymentsocialcontributionstatic->ref; - } - elseif ($links[$key]['type']=='payment_vat') - { + } + elseif ($links[$key]['type']=='payment_vat') + { $paymentvatstatic->fetch($links[$key]['url_id']); - if ($accountelem) $accountelem.= ', '; + if ($accountelem) $accountelem.= ', '; $accountelem.=$langs->transnoentitiesnoconv("VATPayments").' '.$paymentvatstatic->ref; - } + } elseif ($links[$key]['type']=='banktransfert') { - $comment=$outputlangs->transnoentitiesnoconv("Transfer"); - if ($objp->amount > 0) - { + $comment=$outputlangs->transnoentitiesnoconv("Transfer"); + if ($objp->amount > 0) + { if ($comment) $comment.= ' '; - $banklinestatic->fetch($links[$key]['url_id']); - $bankstatic->id=$banklinestatic->fk_account; - $bankstatic->label=$banklinestatic->bank_account_label; - $comment.= ' ('.$langs->transnoentitiesnoconv("from").' '; - $comment.= $bankstatic->getNomUrl(1,'transactions'); - $comment.= ' '.$langs->transnoentitiesnoconv("toward").' '; - $bankstatic->id=$objp->bankid; - $bankstatic->label=$objp->bankref; - $comment.= $bankstatic->getNomUrl(1,''); - $comment.= ')'; - } - else - { + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + $comment.= ' ('.$langs->transnoentitiesnoconv("from").' '; + $comment.= $bankstatic->getNomUrl(1,'transactions'); + $comment.= ' '.$langs->transnoentitiesnoconv("toward").' '; + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + $comment.= $bankstatic->getNomUrl(1,''); + $comment.= ')'; + } + else + { if ($comment) $comment.= ' '; - $bankstatic->id=$objp->bankid; - $bankstatic->label=$objp->bankref; - $comment.= ' ('.$langs->transnoentitiesnoconv("from").' '; - $comment.= $bankstatic->getNomUrl(1,''); - $comment.= ' '.$langs->transnoentitiesnoconv("toward").' '; - $banklinestatic->fetch($links[$key]['url_id']); - $bankstatic->id=$banklinestatic->fk_account; - $bankstatic->label=$banklinestatic->bank_account_label; - $comment.= $bankstatic->getNomUrl(1,'transactions'); - $comment.= ')'; - } - } + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + $comment.= ' ('.$langs->transnoentitiesnoconv("from").' '; + $comment.= $bankstatic->getNomUrl(1,''); + $comment.= ' '.$langs->transnoentitiesnoconv("toward").' '; + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + $comment.= $bankstatic->getNomUrl(1,'transactions'); + $comment.= ')'; + } + } elseif ($links[$key]['type']=='company') - { + { if ($thirdparty) $thirdparty.= ', '; - $thirdparty.= dol_trunc($links[$key]['label'],24); - $newline=0; - } + $thirdparty.= dol_trunc($links[$key]['label'],24); + $newline=0; + } elseif ($links[$key]['type']=='member') - { + { if ($thirdparty) $accountelem.= ', '; - $thirdparty.= $links[$key]['label']; - $newline=0; - } + $thirdparty.= $links[$key]['label']; + $newline=0; + } /*elseif ($links[$key]['type']=='sc') - { + { if ($accountelem) $accountelem.= ', '; - //$accountelem.= '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">'; - //$accountelem.= img_object($langs->transnoentitiesnoconv('ShowBill'),'bill').' '; - $accountelem.= $langs->transnoentitiesnoconv("SocialContribution"); - //$accountelem.= '</a>'; - $newline=0; - } + //$accountelem.= '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">'; + //$accountelem.= img_object($langs->transnoentitiesnoconv('ShowBill'),'bill').' '; + $accountelem.= $langs->transnoentitiesnoconv("SocialContribution"); + //$accountelem.= '</a>'; + $newline=0; + } else - { + { if ($accountelem) $accountelem.= ', '; - //$accountelem.= '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; - $accountelem.= $links[$key]['label']; - //$accountelem.= '</a>'; - $newline=0; - }*/ + //$accountelem.= '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; + $accountelem.= $links[$key]['label']; + //$accountelem.= '</a>'; + $newline=0; + }*/ } $debit=$credit=''; - if ($objp->amount < 0) - { - $totald = $totald + abs($objp->amount); - $debit=price2num($objp->amount * -1); - } - else - { - $totalc = $totalc + abs($objp->amount); - $credit=price2num($objp->amount); - } - + if ($objp->amount < 0) + { + $totald = $totald + abs($objp->amount); + $debit=price2num($objp->amount * -1); + } + else + { + $totalc = $totalc + abs($objp->amount); + $credit=price2num($objp->amount); + } + $i++; $rec=new stdClass(); @@ -399,25 +399,25 @@ if ($resql) $rec->description=$description; $rec->thirdparty=$thirdparty; $rec->accountelem=$accountelem; - $rec->debit=$debit; - $rec->credit=$credit; + $rec->debit=$debit; + $rec->credit=$credit; $rec->sold=$sold; $rec->comment=$comment; $rec->soldbefore=price2num($totalbefore); - $rec->soldafter=price2num($total); + $rec->soldafter=price2num($total); - // end of special operation processing + // end of special operation processing $objmodel->write_record($array_selected,$rec,$outputlangs,$array_export_TypeFields); } if ($numrows > 0) { - print "Found ".$numrows." records for receipt ".$num."\n"; - - // Genere en-tete - $objmodel->write_footer($outputlangs); - - // Close file + print "Found ".$numrows." records for receipt ".$num."\n"; + + // Genere en-tete + $objmodel->write_footer($outputlangs); + + // Close file $objmodel->close_file(); print 'File '.$filename.' was generated into dir '.$dirname.'.'."\n"; diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 589b1eb5014..e3b4830f180 100644 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -49,8 +49,8 @@ require_once(PHPEXCEL_PATH."/PHPExcel.php"); //require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel2007.php"); require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel5.php"); -// Global variables -$version=DOL_VERSION; +// Global variables +$version=DOL_VERSION; $error=0; @@ -58,8 +58,8 @@ $error=0; * Main */ -@set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +@set_time_limit(0); +print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; $fname = DOL_DATA_ROOT.'/export-contacts.xls'; diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 946d7fac724..d60d5a86a5a 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -55,16 +55,16 @@ $langs->load('main'); $langs->load('contracts'); -// Global variables -$version=DOL_VERSION; -$error=0; - - +// Global variables +$version=DOL_VERSION; +$error=0; + + /* * Main */ -@set_time_limit(0); +@set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; $now=dol_now('tzserver'); @@ -72,7 +72,7 @@ $duration_value=isset($argv[2])?$argv[2]:'none'; print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n"; -if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; +if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; $sql = "SELECT DISTINCT s.nom as name, c.ref, cd.date_fin_validite, cd.total_ttc, p.label label, s.email, s.default_lang"; $sql .= " FROM ".MAIN_DB_PREFIX."societe AS s"; @@ -110,10 +110,10 @@ if ($resql) { envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer,$duration_value); } - else - { - if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n"; - } + else + { + if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n"; + } $oldemail = $obj->email; $oldlang = $obj->lang; $oldcustomer=$obj->name; @@ -133,9 +133,9 @@ if ($resql) print "Service to expire ".$obj->ref.", label ".$obj->label.", due date ".dol_print_date($db->jdate($obj->date_fin_validite),'day')." (linked to company ".$obj->nom.", sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname).", email ".$obj->email."): "; if (dol_strlen($obj->email)) print "qualified."; else print "disqualified (no email)."; - print "\n"; + print "\n"; - $total += $obj->total_ttc; + $total += $obj->total_ttc; $i++; } @@ -147,9 +147,9 @@ if ($resql) { envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer,$duration_value); } - else - { - if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n"; + else + { + if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n"; } } } @@ -181,7 +181,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer,$dura { global $conf,$langs; - if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO'); + if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO'); $newlangs=new Translate('',$conf); $newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang); diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 8363bbf2277..e5701458152 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -55,16 +55,16 @@ $langs->load('main'); $langs->load('contracts'); -// Global variables -$version=DOL_VERSION; -$error=0; - - +// Global variables +$version=DOL_VERSION; +$error=0; + + /* * Main */ -@set_time_limit(0); +@set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; $now=dol_now('tzserver'); @@ -72,7 +72,7 @@ $duration_value=isset($argv[2])?$argv[2]:'none'; print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n"; -if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; +if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; $sql = "SELECT DISTINCT s.nom, c.ref, cd.date_fin_validite, cd.total_ttc, p.label label, c.fk_soc,u.rowid AS uid, u.lastname, u.firstname, u.email, u.lang"; $sql .= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."contrat AS c, ".MAIN_DB_PREFIX."contratdet AS cd"; @@ -147,10 +147,10 @@ if ($resql) { envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldsalerepresentative,$duration_value); } - else - { - if ($oldemail != 'none') print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n"; - } + else + { + if ($oldemail != 'none') print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n"; + } } } else @@ -244,11 +244,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta if ($mode == 'confirm') { $result=$mail->sendfile(); - if (! $result) - { - print "Error sending email ".$mail->error."\n"; - dol_syslog("Error sending email ".$mail->error."\n"); - } + if (! $result) + { + print "Error sending email ".$mail->error."\n"; + dol_syslog("Error sending email ".$mail->error."\n"); + } } else { diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 398a2d7f422..63836a979f4 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -59,16 +59,16 @@ require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php'); require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); -// Global variables -$version=DOL_VERSION; -$error=0; - - -/* - * Main - */ - -@set_time_limit(0); +// Global variables +$version=DOL_VERSION; +$error=0; + + +/* + * Main + */ + +@set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; // Check security key diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 786704299bf..33b1160ef7e 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -109,8 +109,8 @@ if ($resql) if ($resql2) { $num2 = $db->num_rows($resql2); - dol_syslog("Nb of targets = ".$num2, LOG_DEBUG); - print "Nb of targets = ".$num2."\n"; + dol_syslog("Nb of targets = ".$num2, LOG_DEBUG); + print "Nb of targets = ".$num2."\n"; if ($num2) { @@ -122,7 +122,7 @@ if ($resql) if (! $resqlstartdate) { dol_print_error($db); - $error++; + $error++; } // Look on each email and sent message @@ -210,7 +210,7 @@ if ($resql) if (! $resqlok) { dol_print_error($db); - $error++; + $error++; } else { @@ -224,7 +224,7 @@ if ($resql) if (! $resqlx) { dol_print_error($db); - $error++; + $error++; } //Update status communication of contact prospect @@ -260,11 +260,11 @@ if ($resql) $i++; } } - else - { - $mesg="Emailing id ".$id." has no recipient to target"; - print $mesg."\n"; - dol_syslog($mesg,LOG_ERR); + else + { + $mesg="Emailing id ".$id." has no recipient to target"; + print $mesg."\n"; + dol_syslog($mesg,LOG_ERR); } // Loop finished, set global statut of mail @@ -291,9 +291,9 @@ if ($resql) } else { - $mesg="No validated emailing id to send found."; - print $mesg."\n"; - dol_syslog($mesg,LOG_ERR); + $mesg="No validated emailing id to send found."; + print $mesg."\n"; + dol_syslog($mesg,LOG_ERR); $error++; } } diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 951079e57e7..9260d85cd91 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -54,18 +54,18 @@ require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"); $langs->load('main'); -// Global variables -$version=DOL_VERSION; -$error=0; - - - -/* - * Main - */ - -@set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +// Global variables +$version=DOL_VERSION; +$error=0; + + + +/* + * Main + */ + +@set_time_limit(0); +print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; $now=dol_now('tzserver'); $duration_value=isset($argv[3])?$argv[3]:'none'; @@ -73,7 +73,7 @@ $duration_value=isset($argv[3])?$argv[3]:'none'; $error = 0; print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n"; -if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; +if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; $sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date,"; $sql.= " s.rowid as sid, s.nom as name, s.email, s.default_lang"; @@ -113,8 +113,8 @@ if ($resql) // Check if this record is a break after previous one $startbreak=false; if ($newemail <> $oldemail || $oldemail == 'none') $startbreak=true; - if ($obj->sid && $obj->sid <> $oldsid) $startbreak=true; - if ($obj->cid && $obj->cid <> $oldcid) $startbreak=true; + if ($obj->sid && $obj->sid <> $oldsid) $startbreak=true; + if ($obj->cid && $obj->cid <> $oldcid) $startbreak=true; if ($startbreak) { @@ -124,14 +124,14 @@ if ($resql) envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget); $trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid; } - else + else { if ($oldemail != 'none') { if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n"; else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n"; - } - } + } + } $oldemail = $newemail; $oldsid = $obj->sid; $oldcid = $obj->cid; @@ -150,12 +150,12 @@ if ($resql) dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message); $foundtoprocess++; } - print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.",":"")." email ".$newemail.": "; - if (dol_strlen($newemail)) print "qualified."; - else print "disqualified (no email)."; - print "\n"; + print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.",":"")." email ".$newemail.": "; + if (dol_strlen($newemail)) print "qualified."; + else print "disqualified (no email)."; + print "\n"; - $total += $obj->total_ttc; + $total += $obj->total_ttc; $i++; } @@ -168,13 +168,13 @@ if ($resql) envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget); $trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid; } - else - { + else + { if ($oldemail != 'none') { if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n"; - else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n"; - } + else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n"; + } } } } @@ -205,7 +205,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget) { global $conf,$langs; - if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO'); + if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO'); $newlangs=new Translate('',$conf); $newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang); @@ -264,11 +264,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget) if ($mode == 'confirm') { $result=$mail->sendfile(); - if (! $result) - { - print "Error sending email ".$mail->error."\n"; - dol_syslog("Error sending email ".$mail->error."\n"); - } + if (! $result) + { + print "Error sending email ".$mail->error."\n"; + dol_syslog("Error sending email ".$mail->error."\n"); + } } else { diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index a88f2996b3f..2c23512cedb 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -72,7 +72,7 @@ $duration_value=isset($argv[2])?$argv[2]:'none'; print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n"; -if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; +if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; $sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -239,11 +239,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta if ($mode == 'confirm') { $result=$mail->sendfile(); - if (! $result) - { - print "Error sending email ".$mail->error."\n"; - dol_syslog("Error sending email ".$mail->error."\n"); - } + if (! $result) + { + print "Error sending email ".$mail->error."\n"; + dol_syslog("Error sending email ".$mail->error."\n"); + } } else { diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 42504bd372e..a53e8940361 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -122,10 +122,10 @@ foreach ($argv as $key => $value) $paymentdateafter=dol_stringtotime($argv[$key+1]); $paymentdatebefore=dol_stringtotime($argv[$key+2]); - if (empty($paymentdateafter) || empty($paymentdatebefore)) - { - print 'Error: Bad date format'."\n"; - exit; + if (empty($paymentdateafter) || empty($paymentdatebefore)) + { + print 'Error: Bad date format'."\n"; + exit; } print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n"; } @@ -196,16 +196,16 @@ if (empty($option) && count($filter) <= 0) exit; } // Check if there is no uncompatible choice -if (in_array('payments',$filter) && in_array('nopayment',$filter)) -{ - usage(); - exit; -} -if (in_array('bank',$filter) && in_array('nopayment',$filter)) -{ - usage(); - exit; -} +if (in_array('payments',$filter) && in_array('nopayment',$filter)) +{ + usage(); + exit; +} +if (in_array('bank',$filter) && in_array('nopayment',$filter)) +{ + usage(); + exit; +} // Define SQL and SQL request to select invoices diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 85687eca95e..1b4fc64457c 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -41,13 +41,13 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php"); $langs->load("main"); -$langs->load("errors"); +$langs->load("errors"); // Global variables $version=DOL_VERSION; $error=0; -$forcecommit=0; +$forcecommit=0; @@ -125,16 +125,16 @@ print "Mapped LDAP fields=".join(',',$required_fields)."\n"; print "\n"; // Check parameters -if (empty($conf->global->LDAP_MEMBER_DN)) -{ - print $langs->trans("Error").': '.$langs->trans("LDAP setup for members not defined inside Dolibarr")."\n"; - exit(1); -} -if ($typeid <= 0) -{ - print $langs->trans("Error").': Parameter id_member_type is not a valid ref of an existing member type'."\n"; - exit(2); -} +if (empty($conf->global->LDAP_MEMBER_DN)) +{ + print $langs->trans("Error").': '.$langs->trans("LDAP setup for members not defined inside Dolibarr")."\n"; + exit(1); +} +if ($typeid <= 0) +{ + print $langs->trans("Error").': Parameter id_member_type is not a valid ref of an existing member type'."\n"; + exit(2); +} print "Press a key to confirm..."; diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index ff9907e43ee..0a010791793 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -35,28 +35,28 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } -require_once($path."../../htdocs/master.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); -require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php"); -require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"); - -$langs->load("main"); -$langs->load("errors"); - - -// Global variables -$version=DOL_VERSION; -$error=0; -$forcecommit=0; - - -/* - * Main - */ - -@set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +require_once($path."../../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); +require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php"); +require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"); + +$langs->load("main"); +$langs->load("errors"); + + +// Global variables +$version=DOL_VERSION; +$error=0; +$forcecommit=0; + + +/* + * Main + */ + +@set_time_limit(0); +print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; // List of fields to get from LDAP diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 13fb7464cd4..89bc4613487 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -34,14 +34,14 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } -require_once($path."../../htdocs/master.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); -require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php"); - -$langs->load("main"); -$langs->load("errors"); - +require_once($path."../../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); +require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php"); + +$langs->load("main"); +$langs->load("errors"); + // Global variables $version=DOL_VERSION; diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index d61b3fc6cf2..fe7c51289cb 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -29,7 +29,7 @@ global $conf,$user,$langs,$db; require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php'; -require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php'; +require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php'; if (empty($user->id)) { diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index e48fa7739ff..de99d38eb59 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -191,11 +191,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject2->tva_npr=1; $result=$localobject2->create($user); $cat = new Categorie($this->savdb); - $cat->id = $catid; - $result=$cat->add_type($localobject2,"product"); + $cat->id = $catid; + $result=$cat->add_type($localobject2,"product"); - print __METHOD__." result=".$result."\n"; - $this->assertGreaterThan(0, $result); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThan(0, $result); // Get list of categories for product $localcateg=new Categorie($this->savdb); diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 82bb96dc0be..a4f4ad53b0e 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -160,10 +160,10 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject2->validate($user, $result); // create invoice by forcing ref print __METHOD__." result=".$result."\n"; $this->assertEquals('1916-0002', $result); // counter must not be reseted so be 2 - $result=$localobject2->is_erasable(); + $result=$localobject2->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(1, $result); // Can be deleted - $result=$localobject->is_erasable(); + $this->assertEquals(1, $result); // Can be deleted + $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; $this->assertEquals(0, $result); // Case 1 can not be deleted (case 2 is more recent) @@ -191,9 +191,9 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('192001-0001', $result); // counter must start to 1 - $result=$localobject->is_erasable(); + $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(1, $result); // Can be deleted + $this->assertEquals(1, $result); // Can be deleted $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen(); @@ -204,12 +204,12 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject2->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('192101-0001', $result); // counter must be reseted to 1 - $result=$localobject2->is_erasable(); + $result=$localobject2->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(1, $result); // Can be deleted - $result=$localobject->is_erasable(); + $this->assertEquals(1, $result); // Can be deleted + $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(1, $result); // Case 1 can be deleted (because there was a reset for case 2) + $this->assertEquals(1, $result); // Case 1 can be deleted (because there was a reset for case 2) // Now we try with a different fiscal month (forced by mask) @@ -228,9 +228,9 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('193001-0001', $result); // counter must start to 1 - $result=$numbering->getNextValue($mysoc, $localobject, 'last'); - print __METHOD__." result for last=".$result."\n"; - $this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created + $result=$numbering->getNextValue($mysoc, $localobject, 'last'); + print __METHOD__." result for last=".$result."\n"; + $this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 088115a64ec..18cbe78c468 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -269,53 +269,53 @@ class UserTest extends PHPUnit_Framework_TestCase } - /** - * Edit an object to test updates - * - * @param mixed &$localobject Object Facture - * @return void - */ - public function changeProperties(&$localobject) - { - $localobject->note='New note after update'; - } - - /** - * Compare all public properties values of 2 objects - * - * @param Object $oA Object operand 1 - * @param Object $oB Object operand 2 - * @param boolean $ignoretype False will not report diff if type of value differs - * @param array $fieldstoignorearray Array of fields to ignore in diff - * @return array Array with differences - */ - public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) - { - $retAr=array(); - - if (get_class($oA) !== get_class($oB)) - { - $retAr[]="Supplied objects are not of same class."; - } - else - { - $oVarsA=get_object_vars($oA); - $oVarsB=get_object_vars($oB); - $aKeys=array_keys($oVarsA); - foreach($aKeys as $sKey) - { - if (in_array($sKey,$fieldstoignorearray)) continue; - if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) - { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); - } - if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) - { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); - } - } - } - return $retAr; + /** + * Edit an object to test updates + * + * @param mixed &$localobject Object Facture + * @return void + */ + public function changeProperties(&$localobject) + { + $localobject->note='New note after update'; + } + + /** + * Compare all public properties values of 2 objects + * + * @param Object $oA Object operand 1 + * @param Object $oB Object operand 2 + * @param boolean $ignoretype False will not report diff if type of value differs + * @param array $fieldstoignorearray Array of fields to ignore in diff + * @return array Array with differences + */ + public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) + { + $retAr=array(); + + if (get_class($oA) !== get_class($oB)) + { + $retAr[]="Supplied objects are not of same class."; + } + else + { + $oVarsA=get_object_vars($oA); + $oVarsB=get_object_vars($oB); + $aKeys=array_keys($oVarsA); + foreach($aKeys as $sKey) + { + if (in_array($sKey,$fieldstoignorearray)) continue; + if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) + { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) + { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + } + } + return $retAr; } } ?> \ No newline at end of file -- GitLab