diff --git a/ChangeLog b/ChangeLog
index f980c7fa7cf..2e86e0f7279 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
@@ -13,7 +14,11 @@ 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 #1174 ] Product translated description not good into PDF
-
+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.
+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
@@ -44,7 +49,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.
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";
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
{
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
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;
}
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)
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
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 '