From 3050facb967ca7c64f7551f6645df5ee849f3f0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2013 18:29:34 +0200 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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')); } }