From 1ddf9f6ac55eac39fd789a6868429f54cd065e27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2013 19:33:22 +0100 Subject: [PATCH 01/12] Fix: Not coherent filename --- build/makepack-dolibarr.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f2826cf35b1..4537c68d7e2 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -481,11 +481,12 @@ if ($nboftargetok) { $newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev $newbuild =~ s/beta/0.2.beta1/gi; # beta $newbuild =~ s/rc./0.3.rc1/gi; # rc - if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + if ($newbuild !~ /-/) { $newbuild.='-0.3'; } # finale #$newbuild =~ s/(dev|alpha)/0/gi; # dev #$newbuild =~ s/beta/1/gi; # beta #$newbuild =~ s/rc./2/gi; # rc #if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + #print "newbuild=".$newbuild."\n";exit; $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; From a7c246cec1590d33c7e63ca69eeb9509fd3d9b0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 15:20:57 +0100 Subject: [PATCH 02/12] Check parameters of script --- build/makepack-dolibarr.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 4537c68d7e2..44c3ede1489 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -59,6 +59,14 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/; $SOURCE="$DIR/.."; $DESTI="$SOURCE/build"; +if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) +{ + print "Error: Missing environment variables.\n"; + print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} # Detect OS type # -------------- @@ -66,7 +74,7 @@ if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS=' elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } if (! $OS) { - print "$PROG.$Extension was not able to detect your OS.\n"; + print "Error: Can't detect your OS.\n"; print "Can't continue.\n"; print "$PROG.$Extension aborted.\n"; sleep 2; @@ -105,8 +113,8 @@ for (0..@ARGV-1) { $FILENAMESNAPSHOT.="-".$PREFIX; } } -if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined -if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined print "Makepack version $VERSION\n"; From 71a85464d562ed93b62cd38a71ac167c7e017042 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 15:20:57 +0100 Subject: [PATCH 03/12] Check parameters of script --- build/makepack-dolibarr.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 6390e6c81f5..85e6061a520 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -59,6 +59,14 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/; $SOURCE="$DIR/.."; $DESTI="$SOURCE/build"; +if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) +{ + print "Error: Missing environment variables.\n"; + print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} # Detect OS type # -------------- @@ -66,7 +74,7 @@ if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS=' elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } if (! $OS) { - print "$PROG.$Extension was not able to detect your OS.\n"; + print "Error: Can't detect your OS.\n"; print "Can't continue.\n"; print "$PROG.$Extension aborted.\n"; sleep 2; @@ -105,8 +113,8 @@ for (0..@ARGV-1) { $FILENAMESNAPSHOT.="-".$PREFIX; } } -if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined -if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined +if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined print "Makepack version $VERSION\n"; From 395066519b5c7f3d6dafa8dcdd45583509f612d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 16:18:18 +0100 Subject: [PATCH 04/12] Fix: [ bug #1163 ] SQL Error when searching for supplier orders --- ChangeLog | 2 ++ htdocs/fourn/commande/liste.php | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f18248c35fc..1ea35d60a0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ -------------------------------------------------------------- English Dolibarr ChangeLog -------------------------------------------------------------- + ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** Fix: field's problem into company's page (RIB) Fix: Document cerfa doesn't contained firstname & lastname from donator @@ -12,6 +13,7 @@ Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists +Fix: [ bug #1163 ] SQL Error when searching for supplier orders ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index 76270c8ea20..b20d73f84f9 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -105,16 +105,17 @@ if ($sttc) } if ($sall) { - $sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note LIKE '%".$db->escape($sall)."%')"; + $sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note_private LIKE '%".$db->escape($sall)."%' OR cf.note_public LIKE '%".$db->escape($sall)."%')"; } if ($socid) $sql.= " AND s.rowid = ".$socid; if (GETPOST('statut')) { - $sql .= " AND fk_statut =".GETPOST('statut'); + $sql .= " AND fk_statut =".GETPOST('statut','int'); } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= " ORDER BY $sortfield $sortorder "; +$sql.= $db->plimit($conf->liste_limit+1, $offset); $resql = $db->query($sql); if ($resql) From 8f1a5533951ccd7847252fa2f3315a836ecffbd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 16:22:06 +0100 Subject: [PATCH 05/12] =?UTF-8?q?Fix:=20[=20bug=20#1162=20]=20Traduction?= =?UTF-8?q?=20des=20mi-journ=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 1 + htdocs/langs/en_US/main.lang | 2 ++ htdocs/langs/fr_FR/main.lang | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1ea35d60a0a..375bd99b338 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1163 ] SQL Error when searching for supplier orders +Fix: [ bug #1162 ] Traduction des mi-journées ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6876d0c6b2b..2bc80f696bd 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -256,6 +256,8 @@ Seconds=Seconds Today=Today Yesterday=Yesterday Tomorrow=Tomorrow +Morning=Morning +Afternoon=Afternoon Quadri=Quadri MonthOfDay=Month of the day HourShort=H diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index f642fe4c9b5..9ad1a71b1a8 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -252,6 +252,8 @@ Seconds=Secondes Today=Aujourd'hui Yesterday=Hier Tomorrow=Demain +Morning=Matin +Afternoon=Après-midi Quadri=Trimestre MonthOfDay=Mois du jour HourShort=H From 84e345702378c617d6ce1ff9df6cdbe022ae5f7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 16:30:35 +0100 Subject: [PATCH 06/12] Fix: [ bug #1161 ] Search on product label --- ChangeLog | 3 ++- htdocs/societe/consumption.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 375bd99b338..6227e174763 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,8 @@ Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1163 ] SQL Error when searching for supplier orders -Fix: [ bug #1162 ] Traduction des mi-journées +Fix: [ bug #1162 ] Translaction for morning and afternoon +Fix: [ bug #1161 ] Search on product label ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 21d98fbd64c..16d2c4fea7d 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -214,6 +214,7 @@ if ($month > 0) { $sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; } if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; +if ($sprod_fulldescr) $sql.= " AND (d.description LIKE '%".$sprod_fulldescr."%' OR p.label LIKE '%".$sprod_fulldescr."%')"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -249,7 +250,7 @@ print $formother->select_month($month?$month:-1,'month',1); $formother->select_year($year?$year:-1,'year',1, 20, 1); print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; From eaa6d987b6012e7d45f924fa8146b9096d5e7172 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 17:32:05 +0100 Subject: [PATCH 07/12] Fix: When database is not synchronized with dir, we clean database. --- htdocs/ecm/ajax/ecmdatabase.php | 17 ++++++++++++++++- htdocs/ecm/class/ecmdirectory.class.php | 19 ++++++++++++------- htdocs/ecm/index.php | 21 ++++++++++++++++++--- htdocs/ecm/tpl/builddatabase.tpl.php | 21 +++++++++------------ 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php index cfdfb7fe26d..7a1a667d332 100644 --- a/htdocs/ecm/ajax/ecmdatabase.php +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -51,7 +51,9 @@ if (isset($action) && ! empty($action)) require DOL_DOCUMENT_ROOT . '/ecm/class/ecmdirectory.class.php'; $ecmdirstatic = new EcmDirectory($db); + $ecmdirtmp = new EcmDirectory($db); + // This part of code is same than into file index.php for action refreshmanual TODO Remove duplicate clearstatcache(); $diroutputslash=str_replace('\\', '/', $conf->$element->dir_output); @@ -129,7 +131,6 @@ if (isset($action) && ! empty($action)) if ($fk_parent >= 0) { - $ecmdirtmp=new EcmDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->description = ''; @@ -163,7 +164,21 @@ if (isset($action) && ! empty($action)) } } + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + dol_syslog("sql = ".$sql); $db->query($sql); } } diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 3c12fe066e9..ff914772b2f 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -143,7 +143,7 @@ class EcmDirectory // extends CommonObject $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath(); $result=dol_mkdir($dir); if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; } - + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); @@ -317,21 +317,23 @@ class EcmDirectory // extends CommonObject /** - * Delete object on database and on disk + * Delete object on database and/or on disk * * @param User $user User that delete + * @param int $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented) * @return int <0 if KO, >0 if OK */ - function delete($user) + function delete($user, $mode='all') { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; + $result=0; - $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 + if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 - dol_syslog(get_class($this)."::delete remove directory ".$relativepath); + dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly')?'':' relativepath='.$relativepath)); $this->db->begin(); @@ -348,8 +350,11 @@ class EcmDirectory // extends CommonObject return -2; } - $file = $conf->ecm->dir_output . "/" . $relativepath; - $result=@dol_delete_dir($file); + if ($mode != 'databaseonly') + { + $file = $conf->ecm->dir_output . "/" . $relativepath; + $result=@dol_delete_dir($file); + } if ($result || ! @is_dir(dol_osencode($file))) { diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index bb8844eafc6..0939dc9a77d 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -201,7 +201,10 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') // Refresh directory view if ($action == 'refreshmanual') { - clearstatcache(); + $ecmdirtmp = new EcmDirectory($db); + + // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate + clearstatcache(); $diroutputslash=str_replace('\\','/',$conf->ecm->dir_output); $diroutputslash.='/'; @@ -264,7 +267,7 @@ if ($action == 'refreshmanual') //break; // We found parent, we can stop the while loop } else - { + { dol_syslog("No"); //print "No
\n"; } @@ -277,7 +280,6 @@ if ($action == 'refreshmanual') if ($fk_parent >= 0) { - $ecmdirtmp=new EcmDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->description = ''; @@ -311,6 +313,19 @@ if ($action == 'refreshmanual') } } + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" dol_syslog("sql = ".$sql); $db->query($sql); diff --git a/htdocs/ecm/tpl/builddatabase.tpl.php b/htdocs/ecm/tpl/builddatabase.tpl.php index 7f997ed6209..38137fa4997 100644 --- a/htdocs/ecm/tpl/builddatabase.tpl.php +++ b/htdocs/ecm/tpl/builddatabase.tpl.php @@ -39,7 +39,15 @@ $(document).ready( function() { ); $('#refreshbutton').click( function() { - ecmBuildDatabase(); + $.pleaseBePatient("trans('PleaseBePatient'); ?>"); + $.getJSON( "", { + action: "build", + element: "ecm" + }, + function(response) { + $.unblockUI(); + location.href=""; + }); }); }); @@ -67,16 +75,5 @@ function loadandshowpreview(filedirname,section) }); } -ecmBuildDatabase = function() { - $.pleaseBePatient("trans('PleaseBePatient'); ?>"); - $.getJSON( "", { - action: "build", - element: "ecm" - }, - function(response) { - $.unblockUI(); - location.href=""; - }); -}; \ No newline at end of file From fdc12099860f65e258b29207704d0be353fc4289 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 18:12:15 +0100 Subject: [PATCH 08/12] Fix: [ bug #1163 ] SQL Error when searching for supplier orders Conflicts: ChangeLog --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6227e174763..46c847acadd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,6 @@ Fix: there was no escaping on filter fields in supplier product list Fix: bugs on margin reports and better margin calculation on credit notes Qual: Add travis-ci integration - ***** ChangeLog for 3.4 compared to 3.3.* ***** For users: - New: Can use ODS templates as document templates. From 2f88406677c94686040c8c607d5f4cb45d477ebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 20:12:47 +0100 Subject: [PATCH 09/12] Fix: [ bug #1075 ] POS module doesn't decrement stock of products in Delayed payment mode. --- htdocs/cashdesk/validation_verif.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 893768a9aec..3cd7784d59d 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -212,7 +212,7 @@ switch ($action) $resultcreate=$invoice->create($user,0,dol_stringtotime($obj_facturation->paiementLe())); if ($resultcreate > 0) { - $resultvalid=$invoice->validate($user,$obj_facturation->numInvoice()); + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), (isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0)); } else { From 131bbce6f3c60854368ee2b98214929e2e73fad1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 20:17:22 +0100 Subject: [PATCH 10/12] Update changelog --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 46c847acadd..016dde9b28a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,9 @@ Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1163 ] SQL Error when searching for supplier orders Fix: [ bug #1162 ] Translaction for morning and afternoon Fix: [ bug #1161 ] Search on product label - +Fix: [ bug #1075 ] POS module doesn't decrement stock of products in + delayed payment mode. + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined Fix: Retrieving of margin info when invoice created automatically from order From c54c06e8d320bf6859aa4fe40397ae9b79c85924 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 21:03:12 +0100 Subject: [PATCH 11/12] Fix: [ bug #1171 ] Documents lost in interventions after validating --- htdocs/fichinter/class/fichinter.class.php | 68 +++++++++++++++++----- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 6e3079c6d7d..d2c379563c4 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -368,6 +368,7 @@ class Fichinter extends CommonObject function setValid($user) { global $langs, $conf; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; @@ -390,7 +391,7 @@ class Fichinter extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql.= " SET fk_statut = 1"; $sql.= ", ref = '".$num."'"; - $sql.= ", date_valid = ".$this->db->idate($now); + $sql.= ", date_valid = '".$this->db->idate($now)."'"; $sql.= ", fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; @@ -398,7 +399,52 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::setValid sql=".$sql); $resql=$this->db->query($sql); - if ($resql) + if (! $resql) + { + dol_syslog(get_class($this)."::setValid Echec update - 10 - sql=".$sql, LOG_ERR); + dol_print_error($this->db); + $error++; + } + + if (! $error) + { + $this->oldref = ''; + + // Rename directory if dir was a temporary ref + if (preg_match('/^[\(]?PROV/i', $this->ref)) + { + // Rename of object directory ($this->ref = old ref, $num = new ref) + // to not lose the linked files + $oldref = dol_sanitizeFileName($this->ref); + $snum = dol_sanitizeFileName($num); + $dirsource = $conf->ficheinter->dir_output.'/'.$oldref; + $dirdest = $conf->ficheinter->dir_output.'/'.$snum; + if (file_exists($dirsource)) + { + dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); + + if (@rename($dirsource, $dirdest)) + { + $this->oldref = $oldref; + + dol_syslog("Rename ok"); + // Suppression ancien fichier PDF dans nouveau rep + dol_delete_file($conf->ficheinter->dir_output.'/'.$snum.'/'.$oldref.'*.*'); + } + } + } + } + + // Set new ref and define current statut + if (! $error) + { + $this->ref = $num; + $this->statut=1; + $this->brouillon=0; + $this->date_validation=$now; + } + + if (! $error) { // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -408,24 +454,16 @@ class Fichinter extends CommonObject $error++; $this->errors=$interface->errors; } // Fin appel triggers + } - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - $this->error=join(',',$this->errors); - dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR); - return -1; - } + if (! $error) + { + $this->db->commit(); + return 1; } else { $this->db->rollback(); - $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR); return -1; } From 4aea74d6fd7807a6154e1eb3dc9eac3897074489 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2013 21:05:22 +0100 Subject: [PATCH 12/12] Fix: [ bug #1171 ] Documents lost in interventions after validating --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 016dde9b28a..d2cad1045fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,8 @@ Fix: [ bug #1162 ] Translaction for morning and afternoon Fix: [ bug #1161 ] Search on product label Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. - +Fix: [ bug #1171 ] Documents lost in interventions after validating + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined Fix: Retrieving of margin info when invoice created automatically from order