Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2015-06-14 01:52:59 +02:00
commit 03d1b4bac0
18 changed files with 150 additions and 213 deletions

View File

@ -1738,7 +1738,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@ -1764,7 +1764,7 @@ if ($action == 'create')
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -469,10 +470,12 @@ if ($id > 0)
}
// Categories
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'customer', 1 );
print "</td></tr>";
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'customer', 1 );
print "</td></tr>";
}
// Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');

View File

@ -2340,7 +2340,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@ -2365,7 +2365,7 @@ if ($action == 'create')
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -2358,7 +2358,7 @@ if ($action == 'create' && $user->rights->commande->creer)
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -3821,7 +3821,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@ -3846,7 +3846,7 @@ if ($action == 'create')
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
*
* 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 '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre" align="right">&nbsp;</td>';

View File

@ -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"];
}

View File

@ -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 '</td></tr>';
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
print '<tr><td>' . fieldLabel( 'Categories', 'contcats' ) . '</td><td colspan="3">';
$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 "</td></tr>";
}
// 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 '</td></tr>';
// Categories
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . fieldLabel( 'Categories', 'contcats' ) . '</td>';
print '<td colspan="3">';
$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 "</td></tr>";
}
// 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 '</td>';
print '</tr>'."\n";
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'contact', 1 );
print '</td></tr>';
}
// 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

View File

@ -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.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\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.= '</a>'."\n";
$this->numoffiles++;

View File

@ -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");

View File

@ -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")))

View File

@ -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 = '
<!-- Thermometer Begin -->
<table cellpadding="0" cellspacing="4" border="0">
<tr><td>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2"><img src="' . $imageTop . '" width="58" height="6" border="0"></td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0">';
$formSection = '
<tr><td><img src="{image}" width="26" height="{height}" border="0"></td></tr>';
$formThermbottom = '
</table>
</td>
<td><img src="' . $imageIndex . '" width="32" height="200" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="' . $imageBottom . '" width="58" height="32" border="0"></td>
</tr>
</table>
</td>
</tr></table>';
// legenda
$legendaActual = "&euro; " . round($actualValue);
$legendaPending = "&euro; " . round($pendingValue);
$legendaIntent = "&euro; " . round($intentValue);
$legendaTotal = "&euro; " . round($actualValue + $pendingValue + $intentValue);
$formLegenda = '
<table cellpadding="0" cellspacing="0" border="0">
<tr><td><img src="' . $imageColorActual . '" width="9" height="9">&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>'.$langs->trans("Paid").':<br>' . $legendaActual . '</b></font></td></tr>
<tr><td><img src="' . $imageColorPending . '" width="9" height="9">&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">'.$langs->trans("Waiting").':<br>' . $legendaPending . '</font></td></tr>
<tr><td><img src="' . $imageColorIntent . '" width="9" height="9">&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">'.$langs->trans("Promesses").':<br>' . $legendaIntent . '</font></td></tr>
<tr><td>&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total:<br>' . $legendaTotal . '</font></td></tr>
</table>
<!-- Thermometer End -->';
// 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<br>\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;
}

View File

@ -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);

View File

@ -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'];
}

View File

@ -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 '<tr><td>'.$langs->trans("TotalDuration").'</td>';
print '<td colspan="3">'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print '<td colspan="3">'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print '</tr>';
}
@ -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'];
}

View File

@ -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;
}
}

View File

@ -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'];
}

View File

@ -8,7 +8,8 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
*
* 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 '</td>';
}
print '<td class="liste_titre" colspan="1" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$syear = $year;
$formother->select_year($syear?$syear:-1,'year',1, 20, 5);
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" colspan="1" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="16" type="text" name="search_label" value="'.$search_label.'">';
print '</td>';