*
* 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
@@ -88,6 +89,9 @@ $search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
+$day_lim = GETPOST('day_lim','int');
+$month_lim = GETPOST('month_lim','int');
+$year_lim = GETPOST('year_lim','int');
$filtre = GETPOST('filtre');
// Security check
@@ -213,6 +217,19 @@ else if ($year > 0)
{
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
+if ($month_lim > 0)
+{
+ if ($year_lim > 0 && empty($day_lim))
+ $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,$month_lim,false))."' AND '".$db->idate(dol_get_last_day($year_lim,$month_lim,false))."'";
+ else if ($year_lim > 0 && ! empty($day_lim))
+ $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'";
+ else
+ $sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$month_lim."'";
+}
+else if ($year_lim > 0)
+{
+ $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
+}
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0)
{
@@ -322,7 +339,11 @@ if ($resql)
print '';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '';
- print '| | ';
+ print '';
+ if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '';
+ print '';
+ $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
+ print ' | ';
print ' | ';
print ' | ';
print ' | ';
diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php
index ff1bde24466..146ee53736c 100644
--- a/htdocs/compta/facture/mergepdftool.php
+++ b/htdocs/compta/facture/mergepdftool.php
@@ -275,7 +275,7 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
{
$arrayofinclusion=array();
foreach($_POST['toGenerate'] as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
- $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC);
+ $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
// liste les fichiers
$files = array();
@@ -284,7 +284,7 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
{
foreach($factures as $facture)
{
- if(strstr($facture["name"],$basename))
+ if (strstr($facture["name"],$basename))
{
$files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"];
}
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 742378a2db3..e39c5502b4d 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
+require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$langs->load("companies");
$langs->load("users");
$langs->load("other");
@@ -220,7 +221,17 @@ if (empty($reshook))
{
$error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors));
$action = 'create';
- }
+ } else {
+ // Categories association
+ $contcats = GETPOST( 'contcats', 'array' );
+ if (!empty( $contcats )) {
+ $cat = new Categorie( $db );
+ foreach ($contcats as $id_category) {
+ $cat->fetch( $id_category );
+ $cat->add_type( $object, 'contact' );
+ }
+ }
+ }
}
if (! $error && $id > 0)
@@ -313,8 +324,22 @@ if (empty($reshook))
$result = $object->update($contactid, $user);
- if ($result > 0)
- {
+ if ($result > 0) {
+ // Categories association
+ // First we delete all categories association
+ $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_contact';
+ $sql .= ' WHERE fk_socpeople = ' . $object->id;
+ $db->query( $sql );
+
+ // Then we add the associated categories
+ $categories = GETPOST( 'contcats', 'array' );
+ if (!empty( $categories )) {
+ $cat = new Categorie( $db );
+ foreach ($categories as $id_category) {
+ $cat->fetch( $id_category );
+ $cat->add_type( $object, 'contact' );
+ }
+ }
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
@@ -580,6 +605,15 @@ else
print $form->selectarray('priv',$selectarray,(GETPOST("priv",'alpha')?GETPOST("priv",'alpha'):$object->priv),0);
print '';
+ // Categories
+ if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
+ print '| ' . fieldLabel( 'Categories', 'contcats' ) . ' | ';
+ $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, 'parent', null, null, 1 );
+ print $form->multiselectarray( 'contcats', $cate_arbo, GETPOST( 'contcats', 'array' ), null, null, null,
+ null, '90%' );
+ print " |
";
+ }
+
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@@ -819,6 +853,20 @@ else
print $object->getLibStatut(4);
print '';
+ // Categories
+ if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
+ print '| ' . fieldLabel( 'Categories', 'contcats' ) . ' | ';
+ print '';
+ $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 );
+ $c = new Categorie( $db );
+ $cats = $c->containing( $object->id, Categorie::TYPE_CONTACT );
+ foreach ($cats as $cat) {
+ $arrayselected[] = $cat->id;
+ }
+ print $form->multiselectarray( 'contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' );
+ print " |
";
+ }
+
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@@ -1043,6 +1091,15 @@ else
print $object->getLibStatut(4);
print '';
print ''."\n";
+
+ // Categories
+ if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
+ print '| ' . $langs->trans( "Categories" ) . ' | ';
+ print '';
+ print $form->showCategories( $object->id, 'contact', 1 );
+ print ' |
';
+ }
+
// Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 2fea621626e..699060afcfc 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -689,7 +689,7 @@ class FormFile
$out='';
$this->numoffiles=0;
- $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir).'.pdf','/'), '\.meta$|\.png$');
+ $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$');
// For ajax treatment
$out.= ''.img_picto('', 'refresh').'
'."\n";
@@ -718,7 +718,7 @@ class FormFile
$mime=dol_mimetype($relativepath,'',0);
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
$out.= '>';
- $out.= img_pdf($file["name"],2);
+ $out.= img_mime($relativepath, $file["name"]);
$out.= ''."\n";
$this->numoffiles++;
diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php
index 3a50b79edd7..40dab648de1 100644
--- a/htdocs/core/lib/contact.lib.php
+++ b/htdocs/core/lib/contact.lib.php
@@ -87,16 +87,6 @@ function contact_prepare_head(Contact $object)
$head[$tab][2] = 'documents';
$tab++;
- if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
- {
- require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
- $type = Categorie::TYPE_CONTACT;
- $head[$tab][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type;
- $head[$tab][1] = $langs->trans('Categories');
- $head[$tab][2] = 'category';
- $tab++;
- }
-
// Info
$head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Info");
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 05fdcc96624..a8eeb8d3214 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -152,7 +152,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// if we're in a directory and we want recursive behavior, call this function again
if ($recursive)
{
- $file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode));
+ $file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook));
}
}
else if (! $isdir && (($types == "files") || ($types == "all")))
diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php
index f7592c69c08..7e47f755a7e 100644
--- a/htdocs/core/lib/images.lib.php
+++ b/htdocs/core/lib/images.lib.php
@@ -547,161 +547,3 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
return $imgThumbName;
}
-
-
-/**
- * This function returns the html for the moneymeter.
- *
- * @param int $actualValue amount of actual money
- * @param int $pendingValue amount of money of pending memberships
- * @param int $intentValue amount of intended money (that's without the amount of actual money)
- * @return string thermometer htmlLegenda
- */
-function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
-{
- global $langs;
-
- // variables
- $height="200";
- $maximumValue=125000;
-
- $imageDir = "http://eucd.info/images/therm/";
-
- $imageTop = $imageDir . "therm_top.png";
- $imageMiddleActual = $imageDir . "therm_actual.png";
- $imageMiddlePending = $imageDir . "therm_pending.png";
- $imageMiddleIntent = $imageDir . "therm_intent.png";
- $imageMiddleGoal = $imageDir . "therm_goal.png";
- $imageIndex = $imageDir . "therm_index.png";
- $imageBottom = $imageDir . "therm_bottom.png";
- $imageColorActual = $imageDir . "therm_color_actual.png";
- $imageColorPending = $imageDir . "therm_color_pending.png";
- $imageColorIntent = $imageDir . "therm_color_intent.png";
-
- $formThermTop = '
-
-
-
-
-
-  |
-
-
-
- ';
-
- $formSection = '
-  | ';
-
- $formThermbottom = '
-
- |
-  |
-
-
-  |
-
-
- |
-
';
-
- // legenda
-
- $legendaActual = "€ " . round($actualValue);
- $legendaPending = "€ " . round($pendingValue);
- $legendaIntent = "€ " . round($intentValue);
- $legendaTotal = "€ " . round($actualValue + $pendingValue + $intentValue);
- $formLegenda = '
-
-
- | '.$langs->trans("Paid").': ' . $legendaActual . ' |
- | '.$langs->trans("Waiting").': ' . $legendaPending . ' |
- | '.$langs->trans("Promesses").': ' . $legendaIntent . ' |
- | | Total: ' . $legendaTotal . ' |
-
-
- ';
-
- // check and edit some values
-
- $error = 0;
- if ( $maximumValue <= 0 || $height <= 0 || $actualValue < 0 || $pendingValue < 0 || $intentValue < 0)
- {
- return "The money meter could not be processed
\n";
- }
- if ( $actualValue > $maximumValue )
- {
- $actualValue = $maximumValue;
- $pendingValue = 0;
- $intentValue = 0;
- }
- else
- {
- if ( ($actualValue + $pendingValue) > $maximumValue )
- {
- $pendingValue = $maximumValue - $actualValue;
- $intentValue = 0;
- }
- else
- {
- if ( ($actualValue + $pendingValue + $intentValue) > $maximumValue )
- {
- $intentValue = $maximumValue - $actualValue - $pendingValue;
- }
- }
- }
-
- // start writing the html (from bottom to top)
-
- // bottom
- $thermometer = $formThermbottom;
-
- // actual
- $sectionHeight = round(($actualValue / $maximumValue) * $height);
- $totalHeight = $sectionHeight;
- if ( $sectionHeight > 0 )
- {
- $section = $formSection;
- $section = str_replace("{image}", $imageMiddleActual, $section);
- $section = str_replace("{height}", $sectionHeight, $section);
- $thermometer = $section . $thermometer;
- }
-
- // pending
- $sectionHeight = round(($pendingValue / $maximumValue) * $height);
- $totalHeight += $sectionHeight;
- if ( $sectionHeight > 0 )
- {
- $section = $formSection;
- $section = str_replace("{image}", $imageMiddlePending, $section);
- $section = str_replace("{height}", $sectionHeight, $section);
- $thermometer = $section . $thermometer;
- }
-
- // intent
- $sectionHeight = round(($intentValue / $maximumValue) * $height);
- $totalHeight += $sectionHeight;
- if ( $sectionHeight > 0 )
- {
- $section = $formSection;
- $section = str_replace("{image}", $imageMiddleIntent, $section);
- $section = str_replace("{height}", $sectionHeight, $section);
- $thermometer = $section . $thermometer;
- }
-
- // goal
- $sectionHeight = $height- $totalHeight;
- if ( $sectionHeight > 0 )
- {
- $section = $formSection;
- $section = str_replace("{image}", $imageMiddleGoal, $section);
- $section = str_replace("{height}", $sectionHeight, $section);
- $thermometer = $section . $thermometer;
- }
-
- // top
- $thermometer = $formThermTop . $thermometer;
-
- return $thermometer . $formLegenda;
-}
-
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index c10c24508e8..9fe2eaf7488 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -241,7 +241,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetXY($this->marge_gauche, $tab_top + 5);
$text=$object->description;
- if ($object->duree > 0)
+ if ($object->duration > 0)
{
$totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
$text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime;
@@ -436,9 +436,9 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetXY($this->marge_gauche, $tab_top + 8);
$text=$object->description;
- if ($object->duree > 0)
+ if ($object->duration > 0)
{
- $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
+ $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
$text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime;
}
$desc=dol_htmlentitiesbr($text,1);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 06395c89526..47878c7e75f 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1530,7 +1530,7 @@ else if ($id || $ref)
{
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname'];
// Define output language
@@ -1557,7 +1557,7 @@ else if ($id || $ref)
dol_print_error($db,$result);
exit;
}
- $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname'];
}
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index e6c9c4d00d6..523b826ee90 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -160,7 +160,7 @@ else if ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->fich
else if ($action == 'add' && $user->rights->ficheinter->creer)
{
$object->socid = $socid;
- $object->duree = GETPOST('duree','int');
+ $object->duration = GETPOST('duration','int');
$object->fk_project = GETPOST('projectid','int');
$object->fk_contrat = GETPOST('contratid','int');
$object->author = $user->id;
@@ -1256,7 +1256,7 @@ else if ($id > 0 || ! empty($ref))
{
// Duration
print '| '.$langs->trans("TotalDuration").' | ';
- print ''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).' | ';
+ print ''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).' | ';
print '
';
}
@@ -1755,7 +1755,7 @@ else if ($id > 0 || ! empty($ref))
{
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname'];
// Define output language
@@ -1782,7 +1782,7 @@ else if ($id > 0 || ! empty($ref))
dol_print_error($db,$result);
exit;
}
- $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname'];
}
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index b72dec1f6fa..5e88cc94243 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -53,7 +53,7 @@ class Fichinter extends CommonObject
var $datec;
var $datev;
var $datem;
- var $duree;
+ var $duration;
var $statut; // 0=draft, 1=validated, 2=invoiced
var $description;
var $note_private;
@@ -116,7 +116,7 @@ class Fichinter extends CommonObject
return -1;
}
}
- if (! is_numeric($this->duree)) $this->duree = 0;
+ if (! is_numeric($this->duration)) $this->duration = 0;
if ($this->socid <= 0)
{
@@ -234,8 +234,8 @@ class Fichinter extends CommonObject
*/
function update($user, $notrigger=0)
{
- if (! is_numeric($this->duree)) {
- $this->duree = 0;
+ if (! is_numeric($this->duration)) {
+ $this->duration = 0;
}
if (! dol_strlen($this->fk_project)) {
$this->fk_project = 0;
@@ -245,7 +245,7 @@ class Fichinter extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
$sql.= "description = '".$this->db->escape($this->description)."'";
- $sql.= ", duree = ".$this->duree;
+ $sql.= ", duree = ".$this->duration;
$sql.= ", fk_projet = ".$this->fk_project;
$sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
$sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
@@ -306,7 +306,7 @@ class Fichinter extends CommonObject
$this->description = $obj->description;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
- $this->duree = $obj->duree;
+ $this->duration = $obj->duree;
$this->datec = $this->db->jdate($obj->datec);
$this->datev = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem);
@@ -951,7 +951,7 @@ class Fichinter extends CommonObject
$this->datec = $now;
$this->note_private='Private note';
$this->note_public='SPECIMEN';
- $this->duree = 0;
+ $this->duration = 0;
$nbp = 25;
$xnbp = 0;
while ($xnbp < $nbp)
@@ -964,7 +964,7 @@ class Fichinter extends CommonObject
$this->lines[$xnbp]=$line;
$xnbp++;
- $this->duree+=$line->duration;
+ $this->duration+=$line->duration;
}
}
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 8ae5b6da1ee..b79663445ed 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2265,7 +2265,7 @@ elseif (! empty($object->id))
{
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname'];
// Define output language
@@ -2292,7 +2292,7 @@ elseif (! empty($object->id))
dol_print_error($db,$result);
exit;
}
- $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname'];
}
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 010e9b95ae6..88a82573d7a 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -8,7 +8,8 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 juanjo Menent
* Copyright (C) 2015 Abbes Bahfir
-
+ * Copyright (C) 2015 Ferran Marcet
+ *
* 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
* the Free Software Foundation; either version 3 of the License, or
@@ -74,8 +75,12 @@ $search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
$search_status=GETPOST('search_status','alpha');
+$day = GETPOST("day","int");
$month = GETPOST("month","int");
$year = GETPOST("year","int");
+$day_lim = GETPOST('day_lim','int');
+$month_lim = GETPOST('month_lim','int');
+$year_lim = GETPOST('year_lim','int');
$filter = GETPOST("filtre");
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers
@@ -163,15 +168,30 @@ if ($search_ref_supplier)
}
if ($month > 0)
{
- if ($year > 0)
+ if ($year > 0 && empty($day))
$sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
+ else if ($year > 0 && ! empty($day))
+ $sql.= " AND fac.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
else
- $sql.= " AND date_format(fac.datef, '%m') = '$month'";
+ $sql.= " AND date_format(fac.datef, '%m') = '".$month."'";
}
else if ($year > 0)
{
$sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
+if ($month_lim > 0)
+{
+ if ($year_lim > 0 && empty($day_lim))
+ $sql.= " AND fac.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,$month_lim,false))."' AND '".$db->idate(dol_get_last_day($year_lim,$month_lim,false))."'";
+ else if ($year_lim > 0 && ! empty($day_lim))
+ $sql.= " AND fac.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'";
+ else
+ $sql.= " AND date_format(fac.date_lim_reglement, '%m') = '".$month_lim."'";
+}
+else if ($year_lim > 0)
+{
+ $sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
+}
if ($search_label)
{
$sql .= natural_search('fac.libelle', $search_label);
@@ -260,11 +280,15 @@ if ($resql)
print '';
}
print '';
+ if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '';
print '';
- $syear = $year;
- $formother->select_year($syear?$syear:-1,'year',1, 20, 5);
+ $formother->select_year($year?$year:-1,'year',1, 20, 5);
+ print ' | ';
+ print '';
+ if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '';
+ print '';
+ $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print ' | ';
- print ' | ';
print '';
print '';
print ' | ';