From ef4d3e4666073fe038cb5b519c56f9cd2f35f97c Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 15 Oct 2013 21:07:11 +0200 Subject: [PATCH 01/10] Fix : use GETPOST function into CRON module --- htdocs/public/cron/cron_run_jobs.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 7f25cfaf63c..298727ea5df 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -44,7 +44,7 @@ dol_include_once("/cron/class/cronjob.class.php"); global $langs, $conf; // Check the key, avoid that a stranger starts cron -$key = $_GET['securitykey']; +$key = GETPOST('securitykey','alpha'); if (empty($key)) { echo 'securitykey is require'; exit; @@ -55,7 +55,7 @@ if($key != $conf->global->CRON_KEY) exit; } // Check the key, avoid that a stranger starts cron -$userlogin = $_GET['userlogin']; +$userlogin = GETPOST('userlogin','alpha'); if (empty($userlogin)) { echo 'userlogin is require'; exit; @@ -74,7 +74,7 @@ if ($result<0) { exit; } } -$id = $_GET['id']; +$id = GETPOST('id','int'); // Language Management $langs->load("admin"); From c773f21c2ce82be0338376f8f7cdd382d6bc12a2 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 19 Oct 2013 12:50:18 +0200 Subject: [PATCH 02/10] fix wrong call name --- htdocs/core/lib/pdf.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e31a67a9566..5301f5daa04 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -278,7 +278,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) { // Tel - if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel); + if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->phone); // Fax if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); // EMail @@ -311,7 +311,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) { // Tel - if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel); + if ($targetcontact->phone_pro) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->phone_pro); // Fax if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); // EMail @@ -329,7 +329,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) { // Tel - if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel); + if ($targetcompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->phone); // Fax if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); // EMail From e1dbee651ef75b4d1b9254828f407bd55f06abfc Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 19 Oct 2013 22:08:42 +0200 Subject: [PATCH 03/10] restrict acces to commercialupdate if user can only see his own thirdparty --- htdocs/societe/tpl/linesalesrepresentative.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 9b2867cacff..70c9ec283c0 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -4,7 +4,7 @@ print '
'; print $langs->trans('SalesRepresentatives'); print ''; - if ($user->rights->societe->creer) + if ($user->rights->societe->creer && $user->rights->societe->client->voir) print ''.img_edit().''; else print ' '; From 3050facb967ca7c64f7551f6645df5ee849f3f0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2013 18:29:34 +0200 Subject: [PATCH 04/10] Fix: [ bug #1070 ] Accountancy code not displayed just after set Conflicts: htdocs/product/fiche.php --- htdocs/product/fiche.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 2b23ba4722b..c58c15bed5e 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -123,16 +123,16 @@ if (empty($reshook)) if ($action == 'setaccountancy_code_buy') { $result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy')); - if ($result < 0) - setEventMessage(join(',',$object->errors), 'errors'); + if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); + else $object->accountancy_code_buy=GETPOST('accountancy_code_buy'); $action=""; } if ($action == 'setaccountancy_code_sell') { $result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell')); - if ($result < 0) - setEventMessage(join(',',$object->errors), 'errors'); + if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); + else $object->accountancy_code_sell=GETPOST('accountancy_code_sell'); $action=""; } @@ -369,7 +369,7 @@ if (empty($reshook)) { $result = $object->delete($object->id); } - + if ($result > 0) { header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref)); From 82039716143d5d704613ae17a26473816d4d51d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2013 18:33:56 +0200 Subject: [PATCH 05/10] Try to fix bug [ bug #1072 ] Wrong DOL_URL_ROOT value calculated Conflicts: htdocs/filefunc.inc.php --- htdocs/filefunc.inc.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index dfaa4f78571..3be6cadc9ce 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -152,26 +152,29 @@ if (! empty($dolibarr_main_document_root_alt)) // Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT $tmp=''; $found=0; -$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Ex: C:/xxx/dolibarr/htdocs -$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Ex: C:/Program Files/wamp/www/ -$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Ex: /dolibarr/htdocs/admin/system/phpinfo.php +$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs +$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs +$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php +// Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part. $concatpath=''; foreach($paths as $tmppath) // We check to find (B+start of C)=A { - if ($tmppath) $concatpath.='/'.$tmppath; + if (empty($tmppath)) continue; + $concatpath.='/'.$tmppath; + //if ($tmppath) $concatpath.='/'.$tmppath; //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'
'; if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) // @ avoid warning when safe_mode is on. { - $tmp3=$concatpath; - //print "Found relative url = ".$tmp3; + //print "Found relative url = ".$concatpath; + $tmp3=$concatpath; $found=1; break; } //else print "Not found yet for concatpath=".$concatpath."
\n"; } -if (! $found) $tmp=$dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT. +if (! $found) $tmp=$dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT). else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]!=443))?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80||$_SERVER["SERVER_PORT"]==443)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:''); -//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp; +//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n"; if (! empty($dolibarr_main_force_https)) $tmp=preg_replace('/^http:/i','https:',$tmp); define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...) $uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* From d5d252dada6c29b43cf75282d6896da6db463ec6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2013 18:26:18 +0200 Subject: [PATCH 06/10] Fix: [ bug #1077 ] Project card does not update vinculated third when modified upon refresh --- htdocs/projet/fiche.php | 44 ++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 17e5975a272..f1e632ac587 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -211,22 +211,42 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) + { + $error++; + } + } - $result=$object->update($user); + if (! $error) + { + $result=$object->update($user); + if ($result < 0) + { + $error++; + setEventMessage($object->errors,'errors'); + } + } - if (GETPOST("reportdate") && ($object->date_start!=$old_start_date)) - { - $result=$object->shiftTaskDate($old_start_date); - if (!$result) - { - $error++; - $mesg='
'.$langs->trans("ErrorShiftTaskDate").':'.$object->error.'
'; - } - } + if (! $error) + { + if (GETPOST("reportdate") && ($object->date_start!=$old_start_date)) + { + $result=$object->shiftTaskDate($old_start_date); + if ($result < 0) + { + $error++; + $mesg='
'.$langs->trans("ErrorShiftTaskDate").':'.$object->error.'
'; + } + } + } + + if ($error) + { + $action='edit'; } else - { - $action='edit'; + { + $object->societe->fetch(GETPOST('socid','int')); } } From c2def3d0b622a6cf44aab904d980219de8589d02 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 25 Oct 2013 10:01:41 +0200 Subject: [PATCH 07/10] Fix bad display IE for checkbox extrafield readonly --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a55b76e4ce2..48a4c8020b3 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -806,7 +806,7 @@ class ExtraFields if (!empty($value)) { $checked=' checked="checked" '; } - $value=''; + $value=''; } elseif ($type == 'mail') { From ec8cee4d415d754bb5b5e7897865b7b8aff349c6 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 25 Oct 2013 11:39:14 +0200 Subject: [PATCH 08/10] Add link to contact webservice that is already available --- htdocs/webservices/admin/webservices.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/webservices/admin/webservices.php b/htdocs/webservices/admin/webservices.php index 2de3c12df2c..7b71e5a0228 100644 --- a/htdocs/webservices/admin/webservices.php +++ b/htdocs/webservices/admin/webservices.php @@ -102,6 +102,7 @@ print '

'; $webservices = array( 'user' => '', 'thirdparty' => '!empty($conf->societe->enabled)', + 'contact' => '!empty($conf->societe->enabled)', 'productorservice' => '(!empty($conf->product->enabled) || !empty($conf->service->enabled))', 'order' => '!empty($conf->commande->enabled)', 'invoice' => '!empty($conf->facture->enabled)', From 6985a4fe3b81f34376955968c1a44cb56e04f72b Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 26 Oct 2013 10:59:31 +0200 Subject: [PATCH 09/10] Fix web service_contact.php civilite_id vs civility_id --- htdocs/webservices/server_contact.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 08d21d5cba2..cfe25afbe4c 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -300,7 +300,7 @@ function getContact($authentication,$id,$ref='',$ref_ext='') 'ref_propal' => $contact->ref_propal, 'user_id' => $contact->user_id, 'user_login' => $contact->user_login, - 'civility_id' => $contact->civility_id + 'civilite_id' => $contact->civility_id ); //Retreive all extrafield for thirdsparty @@ -379,7 +379,7 @@ function createContact($authentication,$contact) $newobject=new Contact($db); $newobject->id=$contact['id']; - $newobject->civility_id=$contact['civility_id']; + $newobject->civilite_id=$contact['civility_id']; $newobject->lastname=$contact['lastname']; $newobject->firstname=$contact['firstname']; $newobject->address=$contact['address']; @@ -522,7 +522,7 @@ function getContactsForThirdParty($authentication,$idthirdparty) $linescontact[]=array( 'id' => $contact->id, 'ref' => $contact->ref, - 'civility_id' => $contact->civility_id?$contact->civility_id:'', + 'civility_id' => $contact->civilite_id?$contact->civilite_id:'', 'lastname' => $contact->lastname?$contact->lastname:'', 'firstname' => $contact->firstname?$contact->firstname:'', 'address' => $contact->address?$contact->address:'', @@ -653,6 +653,8 @@ function updateContact($authentication,$contact) $object->fax=$contact['fax']; $object->email=$contact['email']; + $object->civilite_id=$contact['civility_id']; + //Retreive all extrafield for contact // fetch optionals attributes and labels From 17df92c654dec37b55c09bac516eedb5236963a2 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 26 Oct 2013 16:01:02 +0200 Subject: [PATCH 10/10] Fix [ bug #1116 ] Silent Warning when validating a customer invoice [PostgreSQL] --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4916e7bf6ef..d7b17f3ac20 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1736,8 +1736,8 @@ class Facture extends CommonInvoice $sql.= " SET facnumber='".$num."', fk_statut = 1, fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'"; if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date { - $sql.= ', datef='.$this->db->idate($this->date); - $sql.= ', date_lim_reglement='.$this->db->idate($this->date_lim_reglement); + $sql.= ", datef='".$this->db->idate($this->date)."'"; + $sql.= ", date_lim_reglement='".$this->db->idate($this->date_lim_reglement)."'"; } $sql.= ' WHERE rowid = '.$this->id;