From ba93a4bfe286ca814084d5482dd7a9a3c91dbf8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 12:20:45 +0200 Subject: [PATCH 01/17] Fix: Codesniffer --- dev/phpcheckstyle/README | 21 -- dev/phpcheckstyle/phpstandard.cfg.xml | 316 ------------------ dev/phpcheckstyle/phpstandard.dtd | 13 - htdocs/commande/class/commande.class.php | 1 - .../thirdparties_services_expired.modules.php | 5 +- .../fourn/class/fournisseur.product.class.php | 1 + htdocs/opensurvey/adminstuds_preview.php | 6 +- .../class/opensurveysondage.class.php | 2 +- htdocs/opensurvey/fonctions.php | 17 +- htdocs/opensurvey/public/choix_date.php | 8 +- htdocs/opensurvey/public/create_survey.php | 2 +- htdocs/opensurvey/public/exportcsv.php | 11 +- htdocs/public/paybox/paymentko.php | 6 +- htdocs/public/paybox/paymentok.php | 2 +- htdocs/public/paypal/paymentko.php | 2 +- htdocs/public/paypal/paymentok.php | 2 +- test/phpunit/WebservicesInvoicesTest.php | 4 +- test/phpunit/WebservicesOrdersTest.php | 8 +- test/phpunit/WebservicesOtherTest.php | 4 +- test/phpunit/WebservicesThirdpartyTest.php | 4 +- test/phpunit/WebservicesUserTest.php | 4 +- 21 files changed, 45 insertions(+), 394 deletions(-) delete mode 100644 dev/phpcheckstyle/README delete mode 100644 dev/phpcheckstyle/phpstandard.cfg.xml delete mode 100644 dev/phpcheckstyle/phpstandard.dtd diff --git a/dev/phpcheckstyle/README b/dev/phpcheckstyle/README deleted file mode 100644 index 84c6b1bbdc8..00000000000 --- a/dev/phpcheckstyle/README +++ /dev/null @@ -1,21 +0,0 @@ -README (English) --------------------------------- - -This directory contains example of PHPCheckStyle configuration -to use for quality assurance on PHP developpement. - -To run PHPCheckstyle in eclipse, you must: -- install plugin PHP Tools integration http://www.phpsrc.org/eclipse/pti/ -- Unzip PHPCheckStyle archive into a directory. -- Go in Eclipse - Window - Preferences - Dynamic Languages - Validator -Choose External PHP Script, -Set path ro run.php file for localhost -Choose a PHP version, -Set parameter string with - --src %f --config "phpstandard.cfg.xml" --format console -Choose php as Filename extension -Check Print PHP output to console -Then add patern - * %f INFO Line:%n - %m Warning - * %f WARNING Line:%n - %m Warning - * %f ERROR Line:%n - %m Error \ No newline at end of file diff --git a/dev/phpcheckstyle/phpstandard.cfg.xml b/dev/phpcheckstyle/phpstandard.cfg.xml deleted file mode 100644 index 3dd3b314660..00000000000 --- a/dev/phpcheckstyle/phpstandard.cfg.xml +++ /dev/null @@ -1,316 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dev/phpcheckstyle/phpstandard.dtd b/dev/phpcheckstyle/phpstandard.dtd deleted file mode 100644 index bde6e6b2b52..00000000000 --- a/dev/phpcheckstyle/phpstandard.dtd +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0270b0327dd..b6e11a64065 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2783,7 +2783,6 @@ class Commande extends CommonOrder * Update value of extrafields on the proposal * * @param User $user Object user that modify - * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ function update_extrafields($user) diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 4b621b705a2..b9d8feccd5c 100755 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -175,11 +175,10 @@ class mailing_thirdparties_services_expired extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param int $filter Filter - * @param string $option Option + * @param string $sql Request * @return int Number of recipients */ - function getNbOfRecipients($sql,$filter=1,$option='') + function getNbOfRecipients($sql='') { $now=dol_now(); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 09843191692..9a86f0e9ee3 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -146,6 +146,7 @@ class ProductFournisseur extends Product * @param string $charges costs affering to product * @param float $remise_percent Discount regarding qty (percent) * @param float $remise Discount regarding qty (amount) + * @param int $newnpr Set NPR or not * @return int <0 if KO, >=0 if OK */ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0) diff --git a/htdocs/opensurvey/adminstuds_preview.php b/htdocs/opensurvey/adminstuds_preview.php index 7e7bb6a6967..54a44d40abb 100755 --- a/htdocs/opensurvey/adminstuds_preview.php +++ b/htdocs/opensurvey/adminstuds_preview.php @@ -202,7 +202,7 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma //on rajoute la valeur dans les valeurs $datesbase = explode(",",$object->sujet); - $taillebase = sizeof($datesbase); + $taillebase = count($datesbase); //recherche de l'endroit de l'insertion de la nouvelle date dans les dates deja entrées dans le tableau if ($nouvelledate < $datesbase[0]) { @@ -210,7 +210,9 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma } elseif ($nouvelledate > $datesbase[$taillebase-1]) { $cleinsertion = count($datesbase); } else { - for ($i = 0; $i < count($datesbase); $i++) { + $nbdatesbase=count($datesbase); + for ($i = 0; $i < $nbdatesbase; $i++) + { $j = $i + 1; if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) { $cleinsertion = $j; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 7cdfd1e4c7e..0a3f2c571df 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -340,7 +340,7 @@ class Opensurveysondage extends CommonObject * @param string $numsondageadmin Num sondage to delete * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0, $numsondageadmin) + function delete($user, $notrigger, $numsondageadmin) { global $conf, $langs; $error=0; diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 6068ca965f1..fc30da7498b 100755 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -120,8 +120,8 @@ function get_server_name() /** * is_error * - * @param unknown_type $cerr - * @return boolean + * @param string $cerr Error value + * @return boolean Error key found or not */ function is_error($cerr) { @@ -147,7 +147,7 @@ function validateEmail($email) { $pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD'; - return (bool)preg_match($pattern, $email); + return (bool) preg_match($pattern, $email); } @@ -188,15 +188,16 @@ function getUrlSondage($id, $admin = false) /** - * Generate a random id - * - * @return void + * Generate a random id + * + * @param string $car Char to generate key + * @return void */ function dol_survey_random($car) { $string = ""; $chaine = "abcdefghijklmnopqrstuvwxyz123456789"; - srand((double)microtime()*1000000); + srand((double) microtime()*1000000); for($i=0; $i<$car; $i++) { $string .= $chaine[rand()%strlen($chaine)]; } @@ -229,7 +230,7 @@ function ajouter_sondage($origin) if ($_SESSION["formatsondage"]=="D"||$_SESSION["formatsondage"]=="D+") { //Calcul de la date de fin du sondage - $taille_tableau=sizeof($_SESSION["totalchoixjour"])-1; + $taille_tableau=count($_SESSION["totalchoixjour"])-1; $date_fin=$_SESSION["totalchoixjour"][$taille_tableau]+200000; } diff --git a/htdocs/opensurvey/public/choix_date.php b/htdocs/opensurvey/public/choix_date.php index 72a24357436..59536f1f8e6 100755 --- a/htdocs/opensurvey/public/choix_date.php +++ b/htdocs/opensurvey/public/choix_date.php @@ -257,9 +257,9 @@ if (issetAndNoEmpty('choixjourajout')) { // Si le test est passé, alors on insere la valeur dans la variable de session qui contient les dates if ($journeuf && issetAndNoEmpty('choixjourajout') === true) { - array_push ($_SESSION["totalchoixjour"],mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])); - sort ($_SESSION["totalchoixjour"]); - $cle=array_search (mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); + array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])); + sort($_SESSION["totalchoixjour"]); + $cle=array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); //On sauvegarde les heures deja entrées for ($i = 0; $i < $cle; $i++) { @@ -540,7 +540,7 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) && (!issetAndNoEmpty('choixheur //s'il n'y a pas d'erreur et que le bouton de creation est activé, on demande confirmation if (!$erreur && (GETPOST('choixheures') || GETPOST('choixheures_x'))) { - $taille_tableau=sizeof($_SESSION["totalchoixjour"])-1; + $taille_tableau=count($_SESSION["totalchoixjour"])-1; $jour_arret = $_SESSION["totalchoixjour"][$taille_tableau]+200000; $date_fin=dol_print_date($jour_arret, 'dayhourtext'); diff --git a/htdocs/opensurvey/public/create_survey.php b/htdocs/opensurvey/public/create_survey.php index c5af8db0cab..729255a6ca1 100755 --- a/htdocs/opensurvey/public/create_survey.php +++ b/htdocs/opensurvey/public/create_survey.php @@ -162,7 +162,7 @@ print ''."\n"; print '
'."\n"; -#affichage du cochage par défaut +// Check or not $cocheplus=''; if ($_SESSION["canedit"]) $cocheplus="checked"; diff --git a/htdocs/opensurvey/public/exportcsv.php b/htdocs/opensurvey/public/exportcsv.php index b2ee0cc1eea..f933b37a317 100755 --- a/htdocs/opensurvey/public/exportcsv.php +++ b/htdocs/opensurvey/public/exportcsv.php @@ -64,7 +64,6 @@ $now=dol_now(); $nbcolonnes=substr_count($object->sujet,',')+1; $toutsujet=explode(",",$object->sujet); -#$toutsujet=str_replace("°","'",$toutsujet); // affichage des sujets du sondage $input.=$langs->trans("Name").";"; @@ -139,15 +138,15 @@ if ($resql) else dol_print_error($db); -$filesize = strlen( $input ); +$filesize = strlen($input); $filename=$numsondage."_".dol_print_date($now,'%Y%m%d%H%M').".csv"; -header( 'Content-Type: text/csv; charset=utf-8' ); -header( 'Content-Length: '.$filesize ); -header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); -header( 'Cache-Control: max-age=10' ); +header('Content-Type: text/csv; charset=utf-8'); +header('Content-Length: '.$filesize); +header('Content-Disposition: attachment; filename="'.$filename.'"'); +header('Cache-Control: max-age=10'); echo $input; exit; diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index 4db0684005b..19ce36b3b43 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -69,13 +69,13 @@ if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fu $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile( + $mailfile = new CMailFile( 'New subscription payed', $sendto, $from, 'New subscription payed '.$fulltag - ); - + ); + $result=$mailfile->sendfile(); if ($result) { diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index ebd3c834d09..e206556eea1 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -99,7 +99,7 @@ if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fu $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile( + $mailfile = new CMailFile( 'New subscription payed', $sendto, $from, diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index c6fe53ac7b0..a291125253f 100755 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -77,7 +77,7 @@ if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fu $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile( + $mailfile = new CMailFile( 'New subscription payed', $sendto, $from, diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index ca11bcb5422..1241e66b6c8 100755 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -136,7 +136,7 @@ if ($PAYPALTOKEN) $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile( + $mailfile = new CMailFile( 'New subscription payed', $sendto, $from, diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 65983390cfd..6f04f5320e2 100755 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -118,11 +118,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase /** - * testWSInvoices_xxx + * testWSInvoicesXxx * * @return int */ - public function testWSInvoices_xxx() + public function testWSInvoicesXxx() { global $conf,$user,$langs,$db; $conf=$this->savconf; diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index a4571557a48..750c33fa30a 100755 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -118,11 +118,11 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase /** - * testWSOrder_xxx + * testWSOrderXxx * * @return int */ - public function testWSOrder_xxx() + public function testWSOrderXxx() { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -178,11 +178,11 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase /** - * testWSOther_GetVersions + * testWSOtherGetVersions * * @return int */ - public function testWSOther_GetVersions() + public function testWSOtherGetVersions() { global $conf,$user,$langs,$db; $conf=$this->savconf; diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index e06477e7de9..e8a8a6bd19c 100755 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -118,11 +118,11 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase /** - * testWSOther_GetVersions + * testWSOtherGetVersions * * @return int */ - public function testWSOther_GetVersions() + public function testWSOtherGetVersions() { global $conf,$user,$langs,$db; $conf=$this->savconf; diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index b28ac8fa2d8..83c7c0ce14d 100755 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -118,11 +118,11 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase /** - * testWSThirdparty_xxx + * testWSThirdpartyXxx * * @return int */ - public function testWSThirdparty_xxx() + public function testWSThirdpartyXxx() { global $conf,$user,$langs,$db; $conf=$this->savconf; diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 9ef2278015b..832fd1ea4cb 100755 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -118,11 +118,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase /** - * testWSUser_xxx + * testWSUserXxx * * @return int */ - public function testWSUser_xxx() + public function testWSUserXxx() { global $conf,$user,$langs,$db; $conf=$this->savconf; From 72aec6aa6084c876d582f4edcd483adc0af0cd44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 13:30:54 +0200 Subject: [PATCH 02/17] Better translation --- htdocs/langs/en_US/mails.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index f143a7fa167..3cbce8ff4b2 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -82,16 +82,16 @@ ActivateCheckReadKey=Key use to encrypt URL use for "Read Receipt" and "Unsubcri EMailSentToNRecipients=EMail sent to %s recipients. # Libelle des modules de liste de destinataires mailing -MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...) +MailingModuleDescContactCompanies=Contacts/addresses of all third parties (customer, prospect, supplier, ...) MailingModuleDescDolibarrUsers=Dolibarr users MailingModuleDescFundationMembers=Foundation members with emails MailingModuleDescEmailsFromFile=EMails from a text file (email;lastname;firstname;other) MailingModuleDescEmailsFromUser=EMails from user input (email;lastname;firstname;other) MailingModuleDescContactsCategories=Third parties (by category) MailingModuleDescDolibarrContractsLinesExpired=Third parties with expired contract's lines -MailingModuleDescContactsByCompanyCategory=Contacts of third parties (by third parties category) +MailingModuleDescContactsByCompanyCategory=Contacts/addresses of third parties (by third parties category) MailingModuleDescMembersCategories=Foundation members (by categories) -MailingModuleDescContactsByFunction=Contacts of third parties (by position/function) +MailingModuleDescContactsByFunction=Contacts/addresses of third parties (by position/function) LineInFile=Line %s in file From b152e587930d7d5d5f6750b04af270b58bc1c1c2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 10 Apr 2013 15:42:21 +0200 Subject: [PATCH 03/17] Fix: change for experimental encyption --- .../install/mysql/migration/3.3.0-3.4.0.sql | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 42cd9a10f08..bd1bd8693ce 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -26,18 +26,18 @@ create table llx_adherent_type_extrafields ) ENGINE=innodb; ALTER TABLE llx_adherent_type_extrafields ADD INDEX idx_adherent_type_extrafields (fk_object); -UPDATE llx_const set value='eldy_menu.php' where value='eldy_backoffice.php'; -UPDATE llx_const set value='eldy_menu.php' where value='eldy_frontoffice.php'; -UPDATE llx_const set value='auguria_menu.php' where value='auguria_backoffice.php'; -UPDATE llx_const set value='auguria_menu.php' where value='auguria_frontoffice.php'; -UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_backoffice.php'; -UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_frontoffice.php'; -UPDATE llx_const set name='MAIN_INFO_SOCIETE_ADDRESS' where name='MAIN_INFO_SOCIETE_ADRESSE'; -UPDATE llx_const set name='MAIN_INFO_SOCIETE_TOWN' where name='MAIN_INFO_SOCIETE_VILLE'; -UPDATE llx_const set name='MAIN_INFO_SOCIETE_ZIP' where name='MAIN_INFO_SOCIETE_CP'; -UPDATE llx_const set name='MAIN_INFO_SOCIETE_COUNTRY' where name='MAIN_INFO_SOCIETE_PAYS'; -UPDATE llx_const set name='MAIN_INFO_SOCIETE_STATE' where name='MAIN_INFO_SOCIETE_DEPARTEMENT'; -UPDATE llx_const set name='LIVRAISON_ADDON_NUMBER' where name='LIVRAISON_ADDON'; +UPDATE llx_const set value = __ENCRYPT('eldy_menu.php')__ where __DECRYPT('value')__ = 'eldy_backoffice.php'; +UPDATE llx_const set value = __ENCRYPT('eldy_menu.php')__ where __DECRYPT('value')__ = 'eldy_frontoffice.php'; +UPDATE llx_const set value = __ENCRYPT('auguria_menu.php')__ where __DECRYPT('value')__ = 'auguria_backoffice.php'; +UPDATE llx_const set value = __ENCRYPT('auguria_menu.php')__ where __DECRYPT('value')__ = 'auguria_frontoffice.php'; +UPDATE llx_const set value = __ENCRYPT('smartphone_menu.php')__ where __DECRYPT('value')__ = 'smartphone_backoffice.php'; +UPDATE llx_const set value = __ENCRYPT('smartphone_menu.php')__ where __DECRYPT('value')__ = 'smartphone_frontoffice.php'; +UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_ADDRESS')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_ADRESSE'; +UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_TOWN')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_VILLE'; +UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_ZIP')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_CP'; +UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_COUNTRY')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_PAYS'; +UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_STATE')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_DEPARTEMENT'; +UPDATE llx_const set name = __ENCRYPT('LIVRAISON_ADDON_NUMBER')__ where __DECRYPT('name')__ = 'LIVRAISON_ADDON'; ALTER TABLE llx_user add COLUMN fk_user integer; From 6739ac4d94f8ef4fe607721c76bd9912fc004147 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 15:53:40 +0200 Subject: [PATCH 04/17] Fix: Restore backward compatibility --- htdocs/contact/class/contact.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 65c0407cb97..a41aaf6b366 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -541,6 +541,7 @@ class Contact extends CommonObject $this->mail = $obj->email; $this->birthday = $this->db->jdate($obj->birthday); + $this->note = $obj->note_private; // deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->default_lang = $obj->default_lang; From 740bc2a656ab544d28abac7f2da61f183e9726a4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 10 Apr 2013 15:59:54 +0200 Subject: [PATCH 05/17] Fix: filter on all contacts, not just those related to a company --- .../modules/mailings/contacts2.modules.php | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index e1c1d3afcfe..4b7b95ecb88 100755 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -81,13 +81,12 @@ class mailing_contacts2 extends MailingTargets $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; $sql.= " sp.lastname, sp.firstname as firstname, sp.civilite,"; $sql.= " s.nom as companyname"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.rowid = sp.fk_soc"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; + $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; //$sql.= " AND sp.poste != ''"; - $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.lastname, sp.firstname"; $resql = $this->db->query($sql); @@ -163,10 +162,9 @@ class mailing_contacts2 extends MailingTargets // Number with a filter are show in the combo list for each filter. // If we want a filter "a position is defined", we must add it into formFilter $sql = "SELECT count(distinct(sp.email)) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.rowid = sp.fk_soc"; - $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; + $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; //$sql.= " AND sp.poste != ''"; @@ -188,10 +186,9 @@ class mailing_contacts2 extends MailingTargets $langs->load("companies"); $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.rowid = sp.fk_soc"; - $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; + $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; $sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')"; From 4f645b0a53e68f7585fed7caa80061c9ee96bfa2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 16:08:38 +0200 Subject: [PATCH 06/17] Fix: Bad width --- htdocs/societe/note.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index e24fa8a8cdc..fba53282d1f 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -121,11 +121,12 @@ if ($id > 0) } print ""; - + print '
'; - + + $colwidth='20'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - + dol_fiche_end(); } From 3d8c312a30208cc661465d81e8933cae5e226d4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 16:15:35 +0200 Subject: [PATCH 07/17] Fix: Uniformize column size Fix: Use dol_prind_address for addressees --- htdocs/categories/categorie.php | 4 +++- htdocs/societe/consumption.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/societe/note.php | 4 ++-- htdocs/societe/notify/fiche.php | 4 ++-- htdocs/societe/soc.php | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index b1532f5d7d7..ddc7079c786 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -240,7 +240,9 @@ if ($socid) } // Address - print ''.$langs->trans('Address').''.nl2br($soc->address).''; + print ''.$langs->trans('Address').''; + print dol_print_address($soc->address,'gmap','thirdparty',$object->id); + print ''; // Zip / Town print ''.$langs->trans('Zip').''.$soc->zip.""; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index f3538c6e266..7c0a4c0332f 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -106,7 +106,7 @@ print ''; print ''; print ''; -print ''; +print ''; print ''; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index ca5582b4dee..f9703044257 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -133,7 +133,7 @@ if ($object->id) print '
'.$langs->trans('ThirdPartyName').'
'.$langs->trans('ThirdPartyName').''; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'; // Ref - print ''; + print ''; print ''; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index fba53282d1f..8fbd6c6187f 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -92,7 +92,7 @@ if ($id > 0) print '
'.$langs->trans("ThirdPartyName").'
'.$langs->trans("ThirdPartyName").''; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'; - print ''; + print ''; print ''; @@ -124,7 +124,7 @@ if ($id > 0) print '
'; - $colwidth='20'; + $colwidth='25'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 2499ae30a5b..a0ab078e315 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -141,7 +141,7 @@ if ($result > 0) print '
'.$langs->trans('ThirdPartyName').'
'.$langs->trans('ThirdPartyName').''; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'; - print ''; @@ -169,7 +169,7 @@ if ($result > 0) print ''; } - print ''; + print ''; print ''; + print ''; print ''; From d7c0cf3d5033710e33aa3c1e8dcffbd1a3527667 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 16:29:53 +0200 Subject: [PATCH 08/17] Fix: More complete fix for emailing contact selectors. --- .../modules/mailings/contacts1.modules.php | 25 ++++++++----------- .../modules/mailings/contacts2.modules.php | 1 - .../modules/mailings/contacts3.modules.php | 22 +++++++--------- htdocs/langs/en_US/mails.lang | 2 +- htdocs/langs/fr_FR/mails.lang | 2 +- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 3c44c5e15ce..f45969ea564 100755 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -71,11 +71,8 @@ class mailing_contacts1 extends MailingTargets $statssql=array(); $statssql[0] = "SELECT '".$langs->trans("NbOfCompaniesContacts")."' as label,"; $statssql[0].= " count(distinct(c.email)) as nb"; - $statssql[0].= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; - $statssql[0].= " ".MAIN_DB_PREFIX."societe as s"; - $statssql[0].= " WHERE s.rowid = c.fk_soc"; - $statssql[0].= " AND c.entity IN (".getEntity('societe', 1).")"; - $statssql[0].= " AND s.client IN (1, 3)"; + $statssql[0].= " FROM ".MAIN_DB_PREFIX."socpeople as c"; + $statssql[0].= " WHERE c.entity IN (".getEntity('societe', 1).")"; $statssql[0].= " AND c.email != ''"; // Note that null != '' is false $statssql[0].= " AND c.no_email = 0"; @@ -96,12 +93,11 @@ class mailing_contacts1 extends MailingTargets global $conf; $sql = "SELECT count(distinct(c.email)) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; - $sql .= " ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE s.rowid = c.fk_soc"; - $sql .= " AND c.entity IN (".getEntity('societe', 1).")"; - $sql .= " AND c.email != ''"; // Note that null != '' is false - $sql .= " AND c.no_email = 0"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; + $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; + $sql.= " AND c.email != ''"; // Note that null != '' is false + $sql.= " AND c.no_email = 0"; // La requete doit retourner un champ "nb" pour etre comprise // par parent::getNbOfRecipients @@ -203,10 +199,9 @@ class mailing_contacts1 extends MailingTargets $sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,"; $sql.= " c.lastname, c.firstname, c.civilite,"; $sql.= " s.nom as companyname"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.rowid = c.fk_soc"; - $sql.= " AND c.entity IN (".getEntity('societe', 1).")"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; + $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email != ''"; $sql.= " AND c.no_email = 0"; foreach($filtersarray as $key) diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index 4b7b95ecb88..5a25a11e590 100755 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -187,7 +187,6 @@ class mailing_contacts2 extends MailingTargets $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index b1955aa981e..600a855c975 100755 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -79,12 +79,11 @@ class mailing_contacts3 extends MailingTargets $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; $sql.= " sp.lastname, sp.firstname, sp.civilite,"; $sql.= " s.nom as companyname"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c,"; - if ($filtersarray[0] <> 'all') $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs"; - $sql.= " WHERE s.rowid = sp.fk_soc"; - $sql.= " AND sp.email != ''"; // Note that null != '' is false + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; + if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c"; + if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; + $sql.= " WHERE sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid"; @@ -168,10 +167,9 @@ class mailing_contacts3 extends MailingTargets // Number with a filter are show in the combo list for each filter. // If we want a filter "is inside at least one category", we must add it into formFilter $sql = "SELECT count(distinct(c.email)) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.rowid = c.fk_soc"; - $sql.= " AND c.entity IN (".getEntity('societe', 1).")"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; + $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.no_email = 0"; /* @@ -205,11 +203,9 @@ class mailing_contacts3 extends MailingTargets $sql = "SELECT c.label, count(distinct(sp.email)) AS nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."categorie as c,"; $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs"; - $sql.= " WHERE s.rowid = sp.fk_soc"; - $sql.= " AND sp.email != ''"; // Note that null != '' is false + $sql.= " WHERE sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND cs.fk_categorie = c.rowid"; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 3cbce8ff4b2..f52dea49651 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -100,7 +100,7 @@ MailSelectedRecipients=Selected recipients MailingArea=EMailings area LastMailings=Last %s emailings TargetsStatistics=Targets statistics -NbOfCompaniesContacts=Unique contacts of companies +NbOfCompaniesContacts=Unique contacts/addresses MailNoChangePossible=Recipients for validated emailing can't be changed SearchAMailing=Search mailing SendMailing=Send emailing diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index be08ccad7e8..a94aa8ff149 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -99,7 +99,7 @@ MailSelectedRecipients=Destinataires sélectionnés MailingArea=Espace emailings LastMailings=Les %s derniers emailings TargetsStatistics=Statistiques destinataires -NbOfCompaniesContacts=Contacts uniques des sociétés +NbOfCompaniesContacts=Contacts/adresses uniques MailNoChangePossible=Destinataires d'un mailing validé non modifiables SearchAMailing=Rechercher un mailing SendMailing=Envoi emailing From a32a02e4c194b2fc0d7f5e4587d44d9931974dc3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 16:51:13 +0200 Subject: [PATCH 09/17] Fix: Removed warnings --- htdocs/comm/mailing/cibles.php | 2 +- htdocs/core/modules/mailings/pomme.modules.php | 2 +- .../mailings/thirdparties_services_expired.modules.php | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 95bb905348f..5530d95cd06 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -307,7 +307,7 @@ if ($object->fetch($id) >= 0) print $modulename; print ""; */ - $nbofrecipient=$obj->getNbOfRecipients(); + $nbofrecipient=$obj->getNbOfRecipients(''); print '
'.$langs->trans("ThirdPartyName").''; + print '
'.$langs->trans("ThirdPartyName").''; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'.$langs->trans("NbOfActiveNotifications").'
'.$langs->trans("NbOfActiveNotifications").''; $sql = "SELECT COUNT(n.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index ceef3ec324e..0ee8d7d0f8c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1465,7 +1465,7 @@ else */ // Name - print '
'.$langs->trans('ThirdPartyName').'
'.$langs->trans('ThirdPartyName').''; print $form->showrefnav($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); print ''; if ($nbofrecipient >= 0) { diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 6e645b3581c..30c7c63da60 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -82,7 +82,7 @@ class mailing_pomme extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage + * @param string $sql SQL request to use to count * @return int Number of recipients */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 4b621b705a2..665e5f51f7b 100755 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -175,11 +175,10 @@ class mailing_thirdparties_services_expired extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param int $filter Filter - * @param string $option Option + * @param string $sql SQL request to use to count * @return int Number of recipients */ - function getNbOfRecipients($sql,$filter=1,$option='') + function getNbOfRecipients($sql) { $now=dol_now(); From 5197dedc59dda34e61909a6dc71892337dc27d0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 18:33:58 +0200 Subject: [PATCH 10/17] Fix: Missing background --- htdocs/theme/amarok/style.css.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 41f96d10d20..e1501152c2d 100755 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -174,6 +174,7 @@ select.flat { border-top:solid 1px rgba(0,0,0,.4); border-bottom:solid 1px rgba(0,0,0,.2); box-shadow:1px 1px 2px rgba(0,0,0,.2) inset; + background: #FDFDFD; } form { From f3adcc311d640e26182c85f7f7e399f8da484283 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 18:34:19 +0200 Subject: [PATCH 11/17] Qual: Removed useless table --- htdocs/comm/mailing/cibles.php | 45 +++++++++++++--------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 5530d95cd06..22c7de7c5f2 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -346,21 +346,8 @@ if ($object->fetch($id) >= 0) print '
'; print '
'; - - print '
'; - print ''; - print_titre($langs->trans("ToClearAllRecipientsClickHere")); - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'; - print '
'; } - - // List of selected targets print "\n\n"; print '
'; @@ -383,21 +370,23 @@ if ($object->fetch($id) >= 0) { $num = $db->num_rows($resql); - $parm = "&id=".$object->id; - if ($search_lastname) $parm.= "&search_lastname=".urlencode($search_lastname); - if ($search_firstname) $parm.= "&search_firstname=".urlencode($search_firstname); - if ($search_email) $parm.= "&search_email=".urlencode($search_email); + $param = "&id=".$object->id; + if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname); + if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname); + if ($search_email) $param.= "&search_email=".urlencode($search_email); - print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$parm,$sortfield,$sortorder,"",$num,$object->nbemail,''); + $cleartext='
'.$langs->trans("ToClearAllRecipientsClickHere").': '.''; - if ($page) $parm.= "&page=".$page; + print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,''); + + if ($page) $param.= "&page=".$page; print ''; print ''; - print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$parm,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$parm,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$parm,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$parm,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$parm,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder); // Date sendinf if ($object->statut < 2) @@ -406,11 +395,11 @@ if ($object->fetch($id) >= 0) } else { - print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$parm,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder); } // Statut - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$parm,'','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); print ''; @@ -496,7 +485,7 @@ if ($object->fetch($id) >= 0) print ''; print ''; } From 70b7cb1fa3497697ddfc31c734b442f49ed433d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 19:50:54 +0200 Subject: [PATCH 12/17] Fix: Restore suffix --- htdocs/core/lib/invoice2.lib.php | 67 +++++++++++++------------- scripts/invoices/rebuild_merge_pdf.php | 3 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index a73855accb4..c2c67c090b1 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -29,22 +29,23 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); /** * Function to build a compiled PDF - * - * @param DoliDB $db Database handler - * @param Translate $langs Object langs - * @param Conf $conf Object conf + * + * @param DoliDB $db Database handler + * @param Translate $langs Object langs + * @param Conf $conf Object conf * @param string $diroutputpdf Dir to output file * @param string $newlangid Lang id * @param array $filter Array with filters - * @param date $dateafterdate Invoice after date + * @param date $dateafterdate Invoice after date * @param date $datebeforedate Invoice before date * @param date $paymentdateafter Payment after date * @param date $paymentdatebefore Payment before date * @param int $usestdout Add information onto standard output - * @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template, - * @return int Error code + * @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template + * @param string $option Suffix to add into file name of generated PDF + * @return int Error code */ -function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0) +function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='') { $sql = "SELECT DISTINCT f.rowid, f.facnumber"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -104,19 +105,19 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte } if ($sqlwhere) $sql.=$sqlwhere; if ($sqlorder) $sql.=$sqlorder; - + //print $sql; exit; dol_syslog("scripts/invoices/rebuild_merge.php: sql=".$sql); - + if ($usestdout) print '--- start'."\n"; - + // Start of transaction //$db->begin(); - + $error = 0; $result = 0; $files = array() ; // liste les fichiers - + dol_syslog("scripts/invoices/rebuild_merge.php sql=".$sql); if ( $resql=$db->query($sql) ) { @@ -125,16 +126,16 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $oldemail = ''; $message = ''; $total = ''; - + if ($num) { // First loop on each resultset to build PDF // ----------------------------------------- - + while ($cpt < $num) { $obj = $db->fetch_object($resql); - + $fac = new Facture($db); $result=$fac->fetch($obj->rowid); if ($result > 0) @@ -157,35 +158,35 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte else { if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n"; } - + // Add file into files array $files[] = $filename; } - + if ($result <= 0) { $error++; if ($usestdout) print "Error: Failed to build PDF for invoice ".$fac->ref."\n"; else dol_syslog("Failed to build PDF for invoice ".$fac->ref, LOG_ERR); } - + $cpt++; } - - // Define format of output PDF + + // Define format of output PDF $formatarray=pdf_getFormat(); $page_largeur = $formatarray['width']; $page_hauteur = $formatarray['height']; $format = array($page_largeur,$page_hauteur); - + if ($usestdout) print "Using output PDF format ".join('x',$format)."\n"; else dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR); - - + + // Now, build a merged files with all files in $files array //--------------------------------------------------------- - + // Create empty PDF $pdf=pdf_getInstance($format); if (class_exists('TCPDF')) @@ -194,11 +195,11 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $pdf->setPrintFooter(false); } $pdf->SetFont(pdf_getPDFFont($outputlangs)); - + if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); //$pdf->SetCompression(false); - - + + //$pdf->Open(); //$pdf->AddPage(); //$title=$langs->trans("BillsCustomersUnpaid"); @@ -224,12 +225,12 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte // Create output dir if not exists dol_mkdir($diroutputpdf); - + // Save merged file $filename='mergedpdf'; - + if (! empty($option)) $filename.='_'.$option; - + if ($pagecount) { $file=$diroutputpdf.'/'.$filename.'.pdf'; @@ -237,7 +238,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); } - + if ($usestdout) print "Merged PDF has been built in ".$file."\n"; $result = 1; } @@ -254,7 +255,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte dol_syslog("scripts/invoices/rebuild_merge.php: Error"); $error++; } - + if ($error) return -1; else return $result; } diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index f4984331a51..6360735ab67 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -36,7 +36,6 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Include Dolibarr environment require_once($path."../../htdocs/master.inc.php"); // After this $db is an opened handler to database. We close it at end of file. -require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); @@ -179,7 +178,7 @@ if (in_array('payments',$filter) && in_array('nopayment',$filter)) // Define SQL and SQL request to select invoices // Use $filter, $dateafterdate, datebeforedate, $paymentdateafter, $paymentdatebefore -$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate); +$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate, $option); From 15e86875f37d24a6cdcc42698cc858449b43f503 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 20:45:38 +0200 Subject: [PATCH 13/17] Fix: sql syntax error --- htdocs/core/lib/admin.lib.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 978f0896f65..f70d3e846cc 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -252,18 +252,20 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) if (! $silent) print '\n"; dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); + $sqlmodified=0; // Replace for encrypt data - if (preg_match_all('/__ENCRYPT\(\'([A-Za-z0-9_\"\[\]]+)\'\)__/i',$newsql,$reg)) + if (preg_match_all('/__ENCRYPT\(\'([^\']+)\'\)__/i',$newsql,$reg)) { $num=count($reg[0]); - for($i=0;$i<$num;$i++) + for($j=0;$j<$num;$j++) { - $from = $reg[0][$i]; - $to = $db->encrypt($reg[1][$i],1); + $from = $reg[0][$j]; + $to = $db->encrypt($reg[1][$j],1); $newsql = str_replace($from,$to,$newsql); } + $sqlmodified++; } // Replace for decrypt data @@ -271,12 +273,13 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker { $num=count($reg[0]); - for($i=0;$i<$num;$i++) + for($j=0;$j<$num;$j++) { - $from = $reg[0][$i]; - $to = $db->decrypt($reg[1][$i]); + $from = $reg[0][$j]; + $to = $db->decrypt($reg[1][$j]); $newsql = str_replace($from,$to,$newsql); } + $sqlmodified++; } // Replace __x__ with rowid of insert nb x @@ -294,9 +297,11 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker $from='__'.$cursor.'__'; $to=$listofinsertedrowid[$cursor]; $newsql=str_replace($from,$to,$newsql); - dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); + $sqlmodified++; } + if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); + $result=$db->query($newsql,$usesavepoint); if ($result) { From 9dd201df10a5be596027923fa981e3c535551af3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 20:47:39 +0200 Subject: [PATCH 14/17] Fix: Log --- htdocs/core/lib/admin.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index f70d3e846cc..0d4bbcf6d7a 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -300,7 +300,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker $sqlmodified++; } - if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); + if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); $result=$db->query($newsql,$usesavepoint); if ($result) From 4d0dd0d56c29e34602989256853ebb0a27839894 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 20:50:05 +0200 Subject: [PATCH 15/17] Fix: Function to generate pdf --- htdocs/core/lib/invoice2.lib.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index c2c67c090b1..057dffd7d13 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -1,7 +1,6 @@ -#!/usr/bin/php + * Copyright (C) 2009-2013 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,8 +165,8 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte if ($result <= 0) { $error++; - if ($usestdout) print "Error: Failed to build PDF for invoice ".$fac->ref."\n"; - else dol_syslog("Failed to build PDF for invoice ".$fac->ref, LOG_ERR); + if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n"; + else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR); } $cpt++; @@ -194,7 +193,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); + $pdf->SetFont(pdf_getPDFFont($langs)); if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); //$pdf->SetCompression(false); @@ -230,16 +229,21 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $filename='mergedpdf'; if (! empty($option)) $filename.='_'.$option; + $file=$diroutputpdf.'/'.$filename.'.pdf'; - if ($pagecount) + if (! $error && $pagecount) { - $file=$diroutputpdf.'/'.$filename.'.pdf'; $pdf->Output($file,'F'); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); } - if ($usestdout) print "Merged PDF has been built in ".$file."\n"; + if ($usestdout) + { + if (! $error) print "Merged PDF has been built in ".$file."\n"; + else print "Can't build PDF ".$file."\n"; + } + $result = 1; } else From e0cb09bd651210d22ba10dbca3a0a11246b2986a Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 10 Apr 2013 22:38:45 +0300 Subject: [PATCH 16/17] Update admin_extrafields.inc.php $default_value not initialised new type : sellist --- htdocs/core/admin_extrafields.inc.php | 55 +++++++++++++++++---------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 02eab4db893..0b608a1e736 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -66,6 +66,13 @@ if ($action == 'add') $mesg[]=$langs->trans("ErrorNoValueForSelectType"); $action = 'create'; } + if (GETPOST('type')=='sellist' && !GETPOST('param')) + { + $error++; + $langs->load("errors"); + $mesg[]=$langs->trans("ErrorNoValueForSelectListType"); + $action = 'create'; + } if (GETPOST('type')=='checkbox' && !GETPOST('param')) { $error++; @@ -82,30 +89,30 @@ if ($action == 'add') } if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param')) { - // Construct array for parameter (value of select list) - $parameters = GETPOST('param'); - $parameters_array = explode("\r\n",$parameters); - foreach($parameters_array as $param_ligne) - { - if (!empty($param_ligne)) { - if (preg_match_all('/,/',$param_ligne,$matches)) - { - if (count($matches[0])>1) { - $error++; - $langs->load("errors"); - $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne); - $action = 'create'; - } - } - else - { + // Construct array for parameter (value of select list) + $parameters = GETPOST('param'); + $parameters_array = explode("\r\n",$parameters); + foreach($parameters_array as $param_ligne) + { + if (!empty($param_ligne)) { + if (preg_match_all('/,/',$param_ligne,$matches)) + { + if (count($matches[0])>1) { $error++; $langs->load("errors"); $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne); $action = 'create'; } - } - } + } + else + { + $error++; + $langs->load("errors"); + $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne); + $action = 'create'; + } + } + } } if (! $error) @@ -114,6 +121,7 @@ if ($action == 'add') if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { // Construct array for parameter (value of select list) + $default_value = GETPOST('default_value'); $parameters = GETPOST('param'); $parameters_array = explode("\r\n",$parameters); foreach($parameters_array as $param_ligne) @@ -186,6 +194,13 @@ if ($action == 'update') $mesg[]=$langs->trans("ErrorNoValueForSelectType"); $action = 'edit'; } + if (GETPOST('type')=='sellist' && !GETPOST('param')) + { + $error++; + $langs->load("errors"); + $mesg[]=$langs->trans("ErrorNoValueForSelectListType"); + $action = 'edit'; + } if (GETPOST('type')=='checkbox' && !GETPOST('param')) { $error++; @@ -291,4 +306,4 @@ if ($action == 'delete') } } -?> \ No newline at end of file +?> From 750b30863fc5e9f44eb3dbc987137a8fd9ab10a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Apr 2013 09:15:41 +0200 Subject: [PATCH 17/17] Qual: Clean code from things that should be inside external module. --- htdocs/comm/action/fiche.php | 86 +----------------------- htdocs/install/mysql/tables/llx_user.sql | 9 +-- htdocs/user/class/user.class.php | 30 ++------- htdocs/webservices/server_user.php | 4 -- 4 files changed, 11 insertions(+), 118 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 5ed00c1fd6e..37c5aaba693 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -589,8 +589,6 @@ if ($action == 'create') print ''; print ''; - add_row_for_calendar_link(); - // Description print ''; - - if (! $user->webcal_login) - { - print ''; - print ''; - $nbtr++; - } - else - { - if ($conf->global->PHPWEBCALENDAR_SYNCRO == 'always') - { - print ''; - } - else - { - print ''; - print ''; - $nbtr++; - } - } - } - } - - // TODO external module - if (! empty($conf->phenix->enabled)) - { - if ($conf->global->PHPPHENIX_SYNCRO != 'never') - { - $langs->load("other"); - - print ''; - - if (! $user->phenix_login) - { - print ''; - print ''; - $nbtr++; - } - else - { - if ($conf->global->PHPPHENIX_SYNCRO == 'always') - { - print ''; - } - else - { - print ''; - print ''; - $nbtr++; - } - } - } - } - - return $nbtr; -} - - ?> diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 6f1f44f6b2c..6042b0906ce 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -1,6 +1,6 @@ -- ============================================================================ -- Copyright (C) 2001-2003 Rodolphe Quiedeville --- Copyright (C) 2006-2011 Laurent Destailleur +-- Copyright (C) 2006-2013 Laurent Destailleur -- Copyright (C) 2007-2013 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify @@ -47,9 +47,6 @@ create table llx_user email varchar(255), signature text DEFAULT NULL, admin smallint DEFAULT 0, - webcal_login varchar(25), -- TODO move to an extra table (ex: llx_extra_fields) - phenix_login varchar(25), -- TODO move to an extra table (ex: llx_extra_fields) - phenix_pass varchar(128), -- TODO move to an extra table (ex: llx_extra_fields) module_comm smallint DEFAULT 1, module_compta smallint DEFAULT 1, fk_societe integer, @@ -64,6 +61,6 @@ create table llx_user openid varchar(255), statut tinyint DEFAULT 1, photo varchar(255), -- filename or url of photo - lang varchar(6) - + lang varchar(6), + color varchar(6) )ENGINE=innodb; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 70883769602..0d50e08e0fd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -76,11 +76,6 @@ class User extends CommonObject var $fk_member; var $fk_user; - var $webcal_login; - var $phenix_login; - var $phenix_pass; - var $phenix_pass_crypted; - var $clicktodial_url; var $clicktodial_login; var $clicktodial_password; @@ -144,7 +139,7 @@ class User extends CommonObject // Get user $sql = "SELECT u.rowid, u.lastname, u.firstname, u.email, u.job, u.signature, u.office_phone, u.office_fax, u.user_mobile,"; - $sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,"; + $sql.= " u.admin, u.login, u.note,"; $sql.= " u.pass, u.pass_crypted, u.pass_temp,"; $sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid,"; $sql.= " u.statut, u.lang, u.entity,"; @@ -220,9 +215,6 @@ class User extends CommonObject $this->datelastlogin = $this->db->jdate($obj->datel); $this->datepreviouslogin = $this->db->jdate($obj->datep); - $this->webcal_login = $obj->webcal_login; - $this->phenix_login = $obj->phenix_login; - $this->phenix_pass_crypted = $obj->phenix_pass; $this->societe_id = $obj->fk_societe; $this->contact_id = $obj->fk_socpeople; $this->fk_member = $obj->fk_member; @@ -1111,12 +1103,6 @@ class User extends CommonObject $this->signature = trim($this->signature); $this->note = trim($this->note); $this->openid = trim(empty($this->openid)?'':$this->openid); // Avoid warning - $this->webcal_login = trim($this->webcal_login); - $this->phenix_login = trim($this->phenix_login); - if ($this->phenix_pass != $this->phenix_pass_crypted) - { - $this->phenix_pass = dol_hash(trim($this->phenix_pass)); - } $this->admin = $this->admin?$this->admin:0; // Check parameters @@ -1146,9 +1132,6 @@ class User extends CommonObject $sql.= ", email = '".$this->db->escape($this->email)."'"; $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; - $sql.= ", webcal_login = '".$this->db->escape($this->webcal_login)."'"; - $sql.= ", phenix_login = '".$this->db->escape($this->phenix_login)."'"; - $sql.= ", phenix_pass = '".$this->db->escape($this->phenix_pass)."'"; $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null"); @@ -1954,6 +1937,8 @@ class User extends CommonObject { global $user,$langs; + $now=dol_now(); + // Initialise parametres $this->id=0; $this->ref = 'SPECIMEN'; @@ -1971,12 +1956,11 @@ class User extends CommonObject $this->pass='dolibspec'; //$this->pass_indatabase='dolibspec'; Set after a fetch //$this->pass_indatabase_crypted='e80ca5a88c892b0aaaf7e154853bccab'; Set after a fetch - $this->datec=time(); - $this->datem=time(); - $this->webcal_login='dolibspec'; + $this->datec=$now; + $this->datem=$now; - $this->datelastlogin=time(); - $this->datepreviouslogin=time(); + $this->datelastlogin=$now; + $this->datepreviouslogin=$now; $this->statut=1; //$this->societe_id = 1; For external users diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 7ff24220b84..5b644b150bf 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -357,10 +357,6 @@ function getUser($authentication,$id,$ref='',$ref_ext='') 'fk_thirdparty' => $user->societe_id, 'fk_contact' => $user->contact_id, 'fk_member' => $user->fk_member, - 'webcal_login' => $user->webcal_login, - 'phenix_login' => $user->phenix_login, - 'phenix_pass' => $user->phenix_pass, - 'phenix_pass_crypted' => $user->phenix_pass_crypted, 'datelastlogin' => dol_print_date($user->datelastlogin,'dayhourrfc'), 'datepreviouslogin' => dol_print_date($user->datepreviouslogin,'dayhourrfc'), 'statut' => $user->statut,
 '.$langs->trans("MailingStatusNotSent"); if ($user->rights->mailing->creer) { - print ''.img_delete($langs->trans("RemoveRecipient")); + print ''.img_delete($langs->trans("RemoveRecipient")); } print '
'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -1061,90 +1059,8 @@ if ($id > 0) print ''; } + llxFooter(); $db->close(); - - -/** - * Ajoute une ligne de tableau a 2 colonnes pour avoir l'option synchro calendrier - * - * @return int Retourne le nombre de lignes ajoutees - */ -function add_row_for_calendar_link() -{ - global $conf,$langs,$user; - $nbtr=0; - - // Lien avec calendrier si module active - // TODO external module - if (! empty($conf->webcalendar->enabled)) - { - if ($conf->global->PHPWEBCALENDAR_SYNCRO != 'never') - { - $langs->load("other"); - - print '
'.$langs->trans("AddCalendarEntry","Webcalendar").''; - print ' '.$langs->transnoentities("ErrorWebcalLoginNotDefined","id."\">".$user->login.""); - print '
global->PHPWEBCALENDAR_SYNCRO=='always' || $conf->global->PHPWEBCALENDAR_SYNCRO=='yesbydefault')?' checked':'').'>
'.$langs->trans("AddCalendarEntry","Phenix").''; - print ' '.$langs->transnoentities("ErrorPhenixLoginNotDefined","id."\">".$user->login.""); - print '
global->PHPPHENIX_SYNCRO=='always' || $conf->global->PHPPHENIX_SYNCRO=='yesbydefault')?' checked':'').'>