diff --git a/ChangeLog b/ChangeLog
index 34ac811e0b0dbf81b9b0f1bedac167541674b563..864f0930fe2b3c745814f9d9d306c09b828cb08f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
+- New: Can filter on status on interventions.
+- New: Add help info of field type into dictionary of payment types.
- New: Add proposals into referer page of thirdparty.
- New: On contact list can set filter on both active and not active (no more exclusive select).
- New: Each user can include its own external ics calendar into dolibarr agenda view.
@@ -73,6 +75,7 @@ For translators:
- New: When a translation is not available we always jump to en_US and only en_US.
For developers:
+- New: Add a css style "cursorpointer".
- New: Select list of users can return user into hierarchy.
- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet)
- New: Add hook "searchAgendaFrom".
@@ -102,12 +105,18 @@ Dolibarr better:
***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users:
- Fix: Can upload files on services.
-- Fix: sql errors on updat fichinter
-- Fix: debian script syntax error
+- Fix: sql errors on updat fichinter.
+- Fix: debian script syntax error.
- Fix: error "menu param is not inside list" into pos module.
-- Fix: Salary payments are not reflected on the reporting sheets
-- Fix: Unsubscribe emailing not working
-- Fix: Trigger on create category call failed because user is not passed on card
+- Fix: Salary payments are not reflected on the reporting sheets.
+- Fix: Unsubscribe emailing not working.
+- Fix: Trigger on create category call failed because user is not passed on card.
+- Fix: list event view lost type event filter.
+- Fix: Save also code event.
+- Fix: VAT payment - Add control on field date value.
+- Fix: Salaries payment - Field date value is now required and add control on it.
+- Fix: Iban was used instead of Bic into SEPA file.
+- Fix: Must unaccent strings into SEPA file.
***** ChangeLog for 3.6 compared to 3.5.* *****
For users:
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 11c3eb3f80b7137101fcb5f8584dbdc26b914174..d9ebddf2b22ca74eebcab172d4a20291c34a1201 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -387,17 +387,23 @@ if ($id == 11)
$langs->load("bills");
$langs->load("interventions");
$elementList = array(
- 'commande' => $langs->trans('Order'),
+ 'proposal' => $langs->trans('Proposal'),
+ 'order' => $langs->trans('Order'),
+ 'invoice' => $langs->trans('Bill'),
'invoice_supplier' => $langs->trans('SupplierBill'),
'order_supplier' => $langs->trans('SupplierOrder'),
- 'contrat' => $langs->trans('Contract'),
+ 'intervention' => $langs->trans('InterventionCard'),
+ 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'),
+ 'agenda' => $langs->trans('Agenda'),
+ // old deprecated
+ 'contrat' => $langs->trans('Contract'),
'propal' => $langs->trans('Proposal'),
+ 'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'),
'facture_fourn' => $langs->trans('SupplierBill'),
- 'fichinter' => $langs->trans('InterventionCard'),
- 'agenda' => $langs->trans('Agenda')
+ 'fichinter' => $langs->trans('InterventionCard')
);
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
$sourceList = array(
@@ -770,7 +776,10 @@ if ($id)
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";}
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
- if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
+ if ($fieldlist[$field]=='type') {
+ if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"),$langs->trans("TypePaymentDesc"),2,1,img_help(1,''));
+ else $valuetoshow=$langs->trans("Type");
+ }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 1d2325413f1363fde3cb932d205ff2bfb27cd4b7..29ad7182e5bab04b2078eccbe798c8e6449be292 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -166,7 +166,7 @@ $nowday=$nowarray['mday'];
$listofextcals=array();
// Define list of external calendars (global admin setup)
-if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
+if (empty($conf->global->AGENDA_DISABLE_EXT))
{
$i=0;
while($i < $conf->global->AGENDA_EXT_NB)
@@ -184,19 +184,22 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0
}
}
// Define list of external calendars (user setup)
-$i=0;
-while($i < $conf->global->AGENDA_EXT_NB)
+if (empty($user->conf->AGENDA_DISABLE_EXT))
{
- $i++;
- $source='AGENDA_EXT_SRC_'.$user->id.'_'.$i;
- $name='AGENDA_EXT_NAME_'.$user->id.'_'.$i;
- $color='AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
- $enabled='AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
- $buggedfile='AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
- if (! empty($user->conf->$source) && ! empty($user->conf->$name))
+ $i=0;
+ while($i < $conf->global->AGENDA_EXT_NB)
{
- // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
- $listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0));
+ $i++;
+ $source='AGENDA_EXT_SRC_'.$user->id.'_'.$i;
+ $name='AGENDA_EXT_NAME_'.$user->id.'_'.$i;
+ $color='AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
+ $enabled='AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
+ $buggedfile='AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
+ if (! empty($user->conf->$source) && ! empty($user->conf->$name))
+ {
+ // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
+ $listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0));
+ }
}
}
@@ -228,18 +231,20 @@ if ($action=='show_week')
$prev_month = $prev['prev_month'];
$prev_day = $prev['prev_day'];
$first_day = $prev['first_day'];
+ $first_month= $prev['first_month'];
+ $first_year = $prev['first_year'];
$week = $prev['week'];
$day = (int) $day;
- $next = dol_get_next_week($day, $week, $month, $year);
+ $next = dol_get_next_week($first_day, $week, $first_month, $first_year);
$next_year = $next['year'];
$next_month = $next['month'];
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow
- $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
- $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
+ $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
+ $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
@@ -296,7 +301,7 @@ if (empty($action) || $action=='show_month')
if ($action=='show_week')
{
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
- $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week;
+ $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week;
$nav.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
@@ -338,10 +343,6 @@ $showextcals=$listofextcals;
if ($conf->use_javascript_ajax)
{
$s='';
- //print '<tr><td>';
-
- //print $langs->trans("Calendars").': ';
- //print '<td align="center" valign="middle" class="nowrap">';
$s.='<script type="text/javascript">' . "\n";
$s.='jQuery(document).ready(function () {' . "\n";
$s.='jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
@@ -375,8 +376,6 @@ if ($conf->use_javascript_ajax)
}
}
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
-
- //print '</td></tr>';
}
@@ -854,8 +853,7 @@ if (count($listofextcals))
$daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
$daykeygmt=dol_mktime(0,0,0,$mois,$jour,$annee,true,0);
do
- //print 'x'.$datestart.'-'.$dateend;exit;
- {
+ {
//if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' ';
$eventarray[$daykey][]=$event;
$daykey+=60*60*24; $daykeygmt+=60*60*24; // Add one day
@@ -909,7 +907,6 @@ if (empty($action) || $action == 'show_month') // View by month
// In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
//var_dump($eventarray);
- //print $tmpday;
for ($iter_week = 0; $iter_week < 6 ; $iter_week++)
{
echo " <tr>\n";
@@ -983,39 +980,27 @@ elseif ($action == 'show_week') // View by week
}
echo " </tr>\n";
- // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
- //var_dump($eventarray);
- //print $tmpday;
-
echo " <tr>\n";
- for($iter_day = 0; $iter_day < 7; $iter_day++)
+ for ($iter_day = 0; $iter_day < 7; $iter_day++)
{
- if(($tmpday <= $max_day_in_month))
- {
- // Show days of the current week
- $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
-
- $style='cal_current_month';
- if ($iter_day == 6) $style.=' cal_other_month_right';
- $today=0;
- $todayarray=dol_getdate($now,'fast');
- if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
- if ($today) $style='cal_today';
-
- echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
- show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
- echo " </td>\n";
- }
- else
- {
- $style='cal_current_month';
- if ($iter_day == 6) $style.=' cal_other_month_right';
- echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
- show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
- echo "</td>\n";
- }
- $tmpday++;
+ // Show days of the current week
+ $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
+ $tmparray = dol_getdate($curtime,'fast');
+ $tmpday = $tmparray['mday'];
+ $tmpmonth = $tmparray['mon'];
+ $tmpyear = $tmparray['year'];
+
+ $style='cal_current_month';
+ if ($iter_day == 6) $style.=' cal_other_month_right';
+ $today=0;
+ $todayarray=dol_getdate($now,'fast');
+ if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
+ if ($today) $style='cal_today';
+
+ echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
+ show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
+ echo " </td>\n";
}
echo " </tr>\n";
@@ -1387,6 +1372,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '</div>'."\n";
}
+
/**
* Change color with a delta
*
@@ -1402,4 +1388,3 @@ function dol_color_minus($color, $minus)
$newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus));
return $newcolor;
}
-
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index ae145d4be2129a893e09beaa4f3642cf992c210c..e2391e08d89d9d7de9b43dc833c2d2b004563c53 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -263,7 +263,7 @@ if ($resql)
// Start date
print '<td align="center" class="nowrap">';
- print dol_print_date($db->jdate($obj->dp),"day");
+ print dol_print_date($db->jdate($obj->dp),"dayhour");
$late=0;
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1;
if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1;
@@ -274,7 +274,7 @@ if ($resql)
// End date
print '<td align="center" class="nowrap">';
- print dol_print_date($db->jdate($obj->dp2),"day");
+ print dol_print_date($db->jdate($obj->dp2),"dayhour");
print '</td>';
// Third party
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index e5cf2f81d98755f1efa7d877bbc8c0feba97c08f..70194a5e21e95bdb1400eb2b1c8a0df33674e343 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -4,6 +4,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
+ * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
*
* 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
@@ -27,14 +28,13 @@
*/
require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
-require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
-if (! empty($conf->projet->enabled)) {
- require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
-}
+if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
@@ -43,7 +43,9 @@ $filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("fi
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","int",3);
-$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
+//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
+//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
+$showbirthday = 0;
$sortfield = GETPOST("sortfield",'alpha');
@@ -71,23 +73,48 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
$filterd=$user->id;
}
-$action=GETPOST('action','alpha');
+//$action=GETPOST('action','alpha');
+$action='show_peruser'; //We use 'show_week' mode
//$year=GETPOST("year");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
-$day=GETPOST("day","int")?GETPOST("day","int"):0;
+$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
$status=GETPOST("status");
$type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':'');
+$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
+if ($dateselect > 0)
+{
+ $day=GETPOST('dateselectday');
+ $month=GETPOST('dateselectmonth');
+ $year=GETPOST('dateselectyear');
+}
+
+$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
+$tmparray=explode('-',$tmp);
+$begin_h = GETPOST('begin_h')?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
+$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
+if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
+if ($end_h < 1 || $end_h > 24) $end_h = 18;
+if ($end_h <= $begin_h) $end_h = $begin_h + 1;
+
+$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
+$tmparray=explode('-',$tmp);
+$begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
+$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
+if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
+if ($end_d < 1 || $end_d > 7) $end_d = 7;
+if ($end_d <= $begin_d) $end_d = $begin_d + 1;
+
if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
-if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
-if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
+if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
-if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') {
+if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
if (GETPOST('viewweek') || $action == 'show_week') {
@@ -110,7 +137,13 @@ $hookmanager->initHooks(array('agenda'));
* Actions
*/
-// None
+if ($action =='delete_action')
+{
+ $event = new ActionComm($db);
+ $event->fetch($actionid);
+ $result=$event->delete();
+}
+
/*
@@ -122,7 +155,6 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
$form=new Form($db);
$companystatic=new Societe($db);
-$contactstatic=new Contact($db);
$now=dol_now();
$nowarray=dol_getdate($now);
@@ -130,87 +162,30 @@ $nowyear=$nowarray['year'];
$nowmonth=$nowarray['mon'];
$nowday=$nowarray['mday'];
-// Define list of all external calendars
-$listofextcals=array();
-if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
-{
- $i=0;
- while($i < $conf->global->AGENDA_EXT_NB)
- {
- $i++;
- $source='AGENDA_EXT_SRC'.$i;
- $name='AGENDA_EXT_NAME'.$i;
- $color='AGENDA_EXT_COLOR'.$i;
- $buggedfile='AGENDA_EXT_BUGGEDFILE'.$i;
- if (! empty($conf->global->$source) && ! empty($conf->global->$name))
- {
- // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
- $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0));
- }
- }
-}
+// Define list of all external calendars (global setup)
+$listofextcals=array();
-if (empty($action) || $action=='show_month')
-{
- $prev = dol_get_prev_month($month, $year);
- $prev_year = $prev['year'];
- $prev_month = $prev['month'];
- $next = dol_get_next_month($month, $year);
- $next_year = $next['year'];
- $next_month = $next['month'];
-
- $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month
- $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month
- // tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday)
- $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2;
- $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
- if ($tmpday >= 1) $tmpday -= 7;
- // Define firstdaytoshow and lastdaytoshow
- $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
- $next_day=7-($max_day_in_month+1-$tmpday)%7;
- if ($next_day < 6) $next_day+=7;
- $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
-}
-if ($action=='show_week')
-{
- $prev = dol_get_first_day_week($day, $month, $year);
- $prev_year = $prev['prev_year'];
- $prev_month = $prev['prev_month'];
- $prev_day = $prev['prev_day'];
- $first_day = $prev['first_day'];
+$prev = dol_get_first_day_week($day, $month, $year);
+$first_day = $prev['first_day'];
+$first_month = $prev['first_month'];
+$first_year = $prev['first_year'];
- $week = $prev['week'];
+$week = $prev['week'];
- $day = (int) $day;
- $next = dol_get_next_week($day, $week, $month, $year);
- $next_year = $next['year'];
- $next_month = $next['month'];
- $next_day = $next['day'];
+$day = (int) $day;
+$next = dol_get_next_week($day, $week, $month, $year);
+$next_year = $next['year'];
+$next_month = $next['month'];
+$next_day = $next['day'];
- // Define firstdaytoshow and lastdaytoshow
- $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
- $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
+// Define firstdaytoshow and lastdaytoshow
+$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
+$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
- $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
+$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
- $tmpday = $first_day;
-}
-if ($action == 'show_day')
-{
- $prev = dol_get_prev_day($day, $month, $year);
- $prev_year = $prev['year'];
- $prev_month = $prev['month'];
- $prev_day = $prev['day'];
- $next = dol_get_next_day($day, $month, $year);
- $next_year = $next['year'];
- $next_month = $next['month'];
- $next_day = $next['day'];
-
- // Define firstdaytoshow and lastdaytoshow
- $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year);
- $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
-}
+$tmpday = $first_day;
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
//print dol_print_date($firstdaytoshow,'day');
@@ -221,7 +196,8 @@ if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions");
$param='';
-if ($status) $param="&status=".$status;
+if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
+if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
if ($filter) $param.="&filter=".$filter;
if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert;
@@ -229,39 +205,46 @@ if ($filterd) $param.="&filterd=".$filterd;
if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid;
-if ($actioncode != '') $param.="&actioncode=".$actioncode;
if ($type) $param.="&type=".$type;
-if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action;
+if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser') $param.='&action='.$action;
$param.="&maxprint=".$maxprint;
-// Show navigation bar
-if (empty($action) || $action=='show_month')
-{
- $nav ="<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
- $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y");
- $nav.=" </span>\n";
- $nav.="<a href=\"?year=".$next_year."&month=".$next_month.$param."\">".img_next($langs->trans("Next"))."</a>\n";
- $nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a>)";
- $picto='calendar';
-}
-if ($action=='show_week')
-{
- $nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
- $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week;
- $nav.=" </span>\n";
- $nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
- $nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
- $picto='calendarweek';
-}
-if ($action=='show_day')
-{
- $nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
- $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort");
- $nav.=" </span>\n";
- $nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
- $nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
- $picto='calendarday';
-}
+
+$prev = dol_get_first_day_week($day, $month, $year);
+$prev_year = $prev['prev_year'];
+$prev_month = $prev['prev_month'];
+$prev_day = $prev['prev_day'];
+$first_day = $prev['first_day'];
+$first_month= $prev['first_month'];
+$first_year = $prev['first_year'];
+
+$week = $prev['week'];
+
+$day = (int) $day;
+$next = dol_get_next_week($first_day, $week, $first_month, $first_year);
+$next_year = $next['year'];
+$next_month = $next['month'];
+$next_day = $next['day'];
+
+// Define firstdaytoshow and lastdaytoshow
+$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
+$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
+
+$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
+
+$tmpday = $first_day;
+
+$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
+$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week;
+$nav.=" </span>\n";
+$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
+$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
+$picto='calendarweek';
+
+$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
+$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
+$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
+$nav.='</form>';
// Must be after the nav definition
$param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
@@ -270,16 +253,64 @@ $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
-$tabactive='cardperuser';
+$tabactive='';
+if ($action == 'show_month') $tabactive='cardmonth';
+if ($action == 'show_week') $tabactive='cardweek';
+if ($action == 'show_day') $tabactive='cardday';
+if ($action == 'show_list') $tabactive='cardlist';
+if ($action == 'show_peruser') $tabactive='cardperuser';
$paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
$head = calendars_prepare_head($paramnoaction);
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
-print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
+print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
dol_fiche_end();
+$showextcals=$listofextcals;
+// Legend
+if ($conf->use_javascript_ajax)
+{
+ $s='';
+ $s.='<script type="text/javascript">' . "\n";
+ $s.='jQuery(document).ready(function () {' . "\n";
+ $s.='jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
+ $s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
+ $s.='jQuery(".family_birthday").toggle();' . "\n";
+ if ($action=="show_week" || $action=="show_month" || empty($action))
+ {
+ $s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
+ $s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
+ }
+ $s.='});' . "\n";
+ $s.='</script>' . "\n";
+ if (! empty($conf->use_javascript_ajax))
+ {
+ $s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
+ if (is_array($showextcals) && count($showextcals) > 0)
+ {
+ foreach ($showextcals as $val)
+ {
+ $htmlname = dol_string_nospecial($val['name']);
+ $s.='<script type="text/javascript">' . "\n";
+ $s.='jQuery(document).ready(function () {' . "\n";
+ $s.=' jQuery("#check_' . $htmlname . '").click(function() {';
+ $s.=' /* alert("'.$htmlname.'"); */';
+ $s.=' jQuery(".family_' . $htmlname . '").toggle();';
+ $s.=' });' . "\n";
+ $s.='});' . "\n";
+ $s.='</script>' . "\n";
+ $s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
+ }
+ }
+ }
+ //$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
+}
+
+
+
+$link='';
print_fiche_titre($s,$link.' '.$nav, '');
@@ -336,7 +367,7 @@ else
if ($type) $sql.= " AND ca.id = ".$type;
if ($status == '0') { $sql.= " AND a.percent = 0"; }
if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
-if ($status == '50') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // Running
+if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
@@ -349,7 +380,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
$sql.= ")";
}
// Sort on date
-$sql.= ' ORDER BY datep';
+$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
//print $sql;
dol_syslog("comm/action/index.php", LOG_DEBUG);
@@ -446,6 +477,7 @@ else
dol_print_error($db);
}
+
$maxnbofchar=18;
$cachethirdparties=array();
$cachecontacts=array();
@@ -459,22 +491,359 @@ if (is_readable($color_file))
if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220));
+$newparam=$param; // newparam is for birthday links
+$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done
+$newparam=preg_replace('/action=show_month&?/i','',$newparam);
+$newparam=preg_replace('/action=show_week&?/i','',$newparam);
+$newparam=preg_replace('/day=[0-9]+&?/i','',$newparam);
+$newparam=preg_replace('/month=[0-9]+&?/i','',$newparam);
+$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
+$newparam=preg_replace('/viewweek=[0-9]+&?/i','',$newparam);
+$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter
+$newparam.='&viewweek=1';
+echo '<form id="move_event" action="" method="POST"><input type="hidden" name="action" value="mupdate">';
+echo '<input type="hidden" name="backtopage" value="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'">';
+echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+echo '<input type="hidden" name="newdate" id="newdate">' ;
+echo '</form>';
+
+
+// Table :
+echo '<table width="100%" class="nocellnopadd cal_month">';
+
+echo '<tr class="liste_titre">';
+echo '<td></td>';
+$i=0;
+while ($i < 7)
+{
+ if (($i + 1) < $begin_d || ($i + 1) > $end_d)
+ {
+ $i++;
+ continue;
+ }
+ echo '<td align="center" colspan="'.($end_h - $begin_h).'">';
+ echo $langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7));
+ print "<br>";
+ if ($i) print dol_print_date(dol_time_plus_duree($firstdaytoshow, $i, 'd'),'day');
+ else print dol_print_date($firstdaytoshow,'day');
+ echo "</td>\n";
+ $i++;
+}
+echo "</tr>\n";
+
+echo '<tr class="liste_titre">';
+echo '<td></td>';
+$i=0;
+while ($i < 7)
+{
+ if (($i + 1) < $begin_d || ($i + 1) > $end_d)
+ {
+ $i++;
+ continue;
+ }
+ for ($h = $begin_h; $h < $end_h; $h++)
+ {
+ echo '<td align="center">';
+ print '<small style="font-family: courier">'.sprintf("%02d",$h).'</small>';
+ print "</td>";
+ }
+ echo "</td>\n";
+ $i++;
+}
+echo "</tr>\n";
+
+// Define $usernames
+$usernames = array(); //init
+/* Use this to have list of users only if users have events
+foreach ($eventarray as $daykey => $notused)
+{
+ $annee = date('Y',$daykey);
+ $mois = date('m',$daykey);
+ $jour = date('d',$daykey);
+ //if ($day==$jour && $month==$mois && $year==$annee)
+ //{
+ //Tout les events à la même date :
+ foreach ($eventarray[$daykey] as $index => $event)
+ {
+ $myuser = new User($db);
+ $user_id = $event->usertodo->id;
+ $myuser->fetch($user_id);
+ $username = $myuser->getFullName($langs);
+ if (! in_array($username, $usernames))
+ {
+ $usernames[] = $username;
+ }
+ }
+ //}
+}*/
+if ($filtert > 0)
+{
+ var_dump($filtert);
+ $tmpuser = new User($db);
+ $tmpuser->fetch($filtert);
+ $usernames[] = $tmpuser;
+}
+else if ($usergroup)
+{
+ $tmpgroup = new UserGroup($db);
+ $tmpgroup->fetch($usergroup);
+ $usernames = $tmpgroup->listUsersForGroup();
+}
+else
+{
+ $tmpgroup = new UserGroup($db);
+ //$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups
+ $usernames = $tmpgroup->listUsersForGroup();
+}
+
+
+// Loop on each user to show calendar
+$sav = $tmpday;
+$showheader = true;
+foreach ($usernames as $username)
+{
+ echo "<tr>";
+ echo '<td class="cal_current_month">' . $username->getNomUrl(1). '</td>';
+ $tmpday = $sav;
+
+ $i = 0;
+ for ($iter_day = 0; $iter_day < 7; $iter_day++)
+ {
+ if (($i + 1) < $begin_d || ($i + 1) > $end_d)
+ {
+ $i++;
+ continue;
+ }
+
+ // Show days of the current week
+ $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
+ $tmparray = dol_getdate($curtime,'fast');
+ $tmpday = $tmparray['mday'];
+ $tmpmonth = $tmparray['mon'];
+ $tmpyear = $tmparray['year'];
+
+ $style='cal_current_month';
+ if ($iter_day == 6) $style.=' cal_other_month';
+ $today=0;
+ $todayarray=dol_getdate($now,'fast');
+ if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
+ if ($today) $style='cal_today_peruser';
+
+ show_day_events2($username, $tmpday, $month, $year, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader);
+
+ $i++;
+ }
+ echo "</tr>\n";
+ $showheader = false;
+}
+
+echo "</table>\n";
+
+
+// Add js code to manage click on a box
+print '<script type="text/javascript" language="javascript">
+jQuery(document).ready(function() {
+ jQuery(".onclickopenref").click(function() {
+
+ alert(\'ee\');
+ });
+});
+</script>';
-/* TODO Export
- print '
-<a href="" id="actionagenda_ical_link"><img src="'.DOL_URL_ROOT.'/theme/common/ical.gif" border="0"/></a>
-<a href="" id="actionagenda_vcal_link"><img src="'.DOL_URL_ROOT.'/theme/common/vcal.gif" border="0"/></a>
-<a href="" id="actionagenda_rss_link"><img src="'.DOL_URL_ROOT.'/theme/common/rss.gif" border="0"/></a>
-<script>
-$("#actionagenda_rss_link").attr("href","/public/agenda/agendaexport.php?format=rss&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
-$("#actionagenda_ical_link").attr("href","/public/agenda/agendaexport.php?format=ical&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
-$("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format=vcal&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
-</script>
-';
-*/
llxFooter();
$db->close();
+
+
+
+
+
+/**
+ * Show event of a particular day
+ *
+ * @param int $day Day
+ * @param int $month Month
+ * @param int $year Year
+ * @param int $monthshown Current month shown in calendar view
+ * @param string $style Style to use for this day
+ * @param array &$eventarray Array of events
+ * @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
+ * @param int $maxnbofchar Nb of characters to show for event line
+ * @param string $newparam Parameters on current URL
+ * @param int $showinfo Add extended information (used by day view)
+ * @param int $minheight Minimum height for each event. 60px by default.
+ * @return void
+ */
+function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false)
+{
+ global $db;
+ global $user, $conf, $langs;
+ global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
+ global $theme_datacolor;
+ global $cachethirdparties, $cachecontacts, $colorindexused;
+ global $begin_h, $end_h;
+
+ $cases1 = array(); // Color first half hour
+ $cases2 = array(); // Color second half hour
+
+ $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
+
+ $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
+ $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
+
+ $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ...
+
+ foreach ($eventarray as $daykey => $notused)
+ {
+ $annee = date('Y',$daykey);
+ $mois = date('m',$daykey);
+ $jour = date('d',$daykey);
+ if ($day==$jour && $month==$mois && $year==$annee)
+ {
+ //Tout les events à la même date :
+ foreach ($eventarray[$daykey] as $index => $event)
+ {
+ if ($username->id != $event->usertodo->id) continue; // We discard record if event is from another user than user we want to show
+
+ $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
+
+ // Define $color and $cssclass of event
+ $color=-1; $cssclass=''; $colorindex=-1;
+ if ((! empty($event->author->id) && $event->author->id == $user->id)
+ || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id)
+ || (! empty($event->userdone->id) && $event->userdone->id == $user->id))
+ {
+ $nummytasks++; $cssclass='family_mytasks';
+ }
+ else if ($event->type_code == 'ICALEVENT')
+ {
+ $numical++;
+ if (! empty($event->icalname)) {
+ if (! isset($numicals[dol_string_nospecial($event->icalname)])) {
+ $numicals[dol_string_nospecial($event->icalname)] = 0;
+ }
+ $numicals[dol_string_nospecial($event->icalname)]++;
+ }
+ $color=$event->icalcolor;
+ $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
+ }
+ else if ($event->type_code == 'BIRTHDAY') {
+ $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
+ }
+ else { $numother++; $cssclass='family_other';
+ }
+ if ($color == -1) // Color was not forced. Set color according to color index.
+ {
+ // Define color index if not yet defined
+ $idusertouse=($event->usertodo->id?$event->usertodo->id:0);
+ if (isset($colorindexused[$idusertouse]))
+ {
+ $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user
+ }
+ else
+ {
+ $colorindex=$nextindextouse;
+ $colorindexused[$idusertouse]=$colorindex;
+ if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
+ }
+ // Define color
+ $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
+ }
+ //$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
+
+ // Show rect of event
+ for ($h = $begin_h; $h < $end_h; $h++)
+ {
+ $color = ''; //init
+ if (empty($event->fulldayevent))
+ {
+ $a = dol_mktime((int) $h,0,0,$month,$day,$year);
+ $b = dol_mktime((int) $h,30,0,$month,$day,$year);
+ $c = dol_mktime((int) $h+1,0,0,$month,$day,$year);
+
+ if ($event->date_start_in_calendar < $b && $event->date_end_in_calendar > $a)
+ {
+ $cases1[$h][$event->id]++;
+ }
+ if ($event->date_start_in_calendar < $c && $event->date_end_in_calendar > $b)
+ {
+ $cases2[$h][$event->id]++;
+ }
+ }
+ else
+ {
+ $cases1[$h][$event->id]=1;
+ $cases2[$h][$event->id]=1;
+ break;
+ }
+ }
+ $i++;
+ }
+
+ break;
+ }
+ }
+
+ for ($h = $begin_h; $h < $end_h; $h++)
+ {
+ $style1='';$style2='';
+ $string1=' ';$string2=' ';
+ $title1='';$title2='';
+ if (isset($cases1[$h]))
+ {
+ if ($cases1[$h] != '')
+ {
+ $title = (int) $cases1[$h];
+ $title .= 'h';
+ if ((int) $cases1[$h] != $cases1[$h])
+ $title .= '30';
+ else
+ $title .= '00';
+ $string1=' ';
+ $style1='peruser_busy';
+ $url='<a href="" title="'.$title.'">';
+ }
+ }
+ if (isset($cases2[$h]))
+ {
+ if ($cases2[$h] != '')
+ {
+ $title = (int) $cases2[$h];
+ $title .= 'h';
+ if ((int) $cases2[$h] != $cases2[$h]) $title .= '30';
+ else $title .= '00';
+ $string2=' ';
+ $style2='peruser_busy';
+ $url='<a href="" title="'.$title.'">';
+ }
+ }
+
+
+ if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser">';
+ else echo '<td class="'.$style.' cal_peruser">';
+ if (count($cases1[$h]) == 1) // 1 seul evenement
+ {
+ $ids=array_keys($cases1[$h]);
+ $id=$ids[0];
+ $title1='zzz';
+ }
+ if (count($cases2[$h]) == 1) // 1 seul evenement
+ {
+ $ids=array_keys($cases2[$h]);
+ $id=$ids[0];
+ $title2='bbb';
+ }
+ print '<table class="nobordernopadding" width="100%">';
+ print '<tr><td class="'.$style1.' onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.$id.'"'.($title1?' title="'.$title1.'"':'').'>';
+ //var_dump($cases1[$h]);
+ print $string1;
+ print '</td><td class="'.$style2.' onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.$id.'"'.($title2?' title="'.$title2.'"':'').'>';
+ print $string2;
+ print '</td></tr>';
+ print '</table>';
+ print '</td>';
+ }
+}
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 35ab381a35f29508d1d954c67f603551c5ae0022..2cfa97549b1296ef67be563e93b5b96c3322e20b 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -365,7 +365,11 @@ else if ($action == 'add' && $user->rights->propal->creer) {
if ($result > 0)
{
$lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines();
+ if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
$fk_parent_line=0;
$num=count($lines);
@@ -1283,7 +1287,9 @@ if ($action == 'create') {
$objectsrc = new $classname($db);
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))
+ {
$objectsrc->fetch_lines();
+ }
$objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
@@ -1951,7 +1957,8 @@ if ($action == 'create') {
print '</tr>';
}
- if ($soc->outstanding_limit) {
+ if ($soc->outstanding_limit)
+ {
// Outstanding Bill
print '<tr><td>';
print $langs->trans('OutstandingBill');
@@ -1962,6 +1969,26 @@ if ($action == 'create') {
print '</tr>';
}
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL))
+ {
+ // Bank Account
+ print '<tr><td>';
+ print '<table width="100%" class="nobordernopadding"><tr><td>';
+ print $langs->trans('BankAccount');
+ print '</td>';
+ if ($action != 'editbankaccount' && $user->rights->propal->creer)
+ print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
+ print '</tr></table>';
+ print '</td><td colspan="3">';
+ if ($action == 'editbankaccount') {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
+ } else {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
+ }
+ print '</td>';
+ print '</tr>';
+ }
+
// Other attributes (TODO Move this into an include)
$res = $object->fetch_optionals($object->id, $extralabels);
$parameters = array('colspan' => ' colspan="3"');
@@ -2009,23 +2036,6 @@ if ($action == 'create') {
}
}
- // Bank Account
- print '<tr><td>';
- print '<table width="100%" class="nobordernopadding"><tr><td>';
- print $langs->trans('BankAccount');
- print '</td>';
- if ($action != 'editbankaccount' && $user->rights->propal->creer)
- print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
- print '</tr></table>';
- print '</td><td colspan="3">';
- if ($action == 'editbankaccount') {
- $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
- } else {
- $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
- }
- print '</td>';
- print '</tr>';
-
// Amount HT
print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 1d59311404eeafe547703496b4afc6a1ecca1b03..2fda0277bec085aac58218eb2083d897d9fe261d 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -271,10 +271,12 @@ else if ($action == 'add' && $user->rights->commande->creer) {
if ($ret < 0)
$error ++;
- if (! $error) {
+ if (! $error)
+ {
$object_id = $object->create($user);
- if ($object_id > 0) {
+ if ($object_id > 0)
+ {
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement);
@@ -282,15 +284,20 @@ else if ($action == 'add' && $user->rights->commande->creer) {
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id);
- if ($result > 0) {
+ if ($result > 0)
+ {
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
- $lines = $srcobject->fetch_lines();
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
$fk_parent_line = 0;
$num = count($lines);
- for($i = 0; $i < $num; $i ++) {
+ for($i = 0; $i < $num; $i ++)
+ {
$label = (! empty($lines [$i]->label) ? $lines [$i]->label : '');
$desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle);
$product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0);
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 8b16428b23f122920c35636607c9dec711256b28..814e52884ab5b0dd7b457260e0324681e2896a18 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -100,7 +100,7 @@ if (($action == 'create' || $action == 'add') && !$error)
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
-
+
$langs->load('bills');
$langs->load('products');
$langs->load('main');
@@ -216,13 +216,17 @@ if (($action == 'create' || $action == 'add') && !$error)
$result=$objectsrc->fetch($orders_id[$ii]);
if ($result > 0)
{
- if ($closeOrders)
+ if ($closeOrders)
{
$objectsrc->classifyBilled();
$objectsrc->setStatut(3);
}
$lines = $objectsrc->lines;
- if (empty($lines) && method_exists($objectsrc,'fetch_lines')) $lines = $objectsrc->fetch_lines();
+ if (empty($lines) && method_exists($objectsrc, 'fetch_lines'))
+ {
+ $objectsrc->fetch_lines();
+ $lines = $objectsrc->lines;
+ }
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php
index 27acf7eba59ba0e113568fa0bd89ac717e1bfb7f..c118186df272e5b42e7b06ef7d5d60cce61f335a 100644
--- a/htdocs/compta/bank/fiche.php
+++ b/htdocs/compta/bank/fiche.php
@@ -240,7 +240,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Ref
- print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Ref").'</td>';
+ print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
// Label
@@ -306,11 +306,15 @@ if ($action == 'create')
$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
$doleditor->Create();
print '</td></tr>';
+
+ print '</table>';
- // Sold
- print '<tr><td colspan="4"><b>'.$langs->trans("InitialBankBalance").'...</b></td></tr>';
+ print '<br>';
- print '<tr><td valign="top">'.$langs->trans("InitialBankBalance").'</td>';
+ print '<table class="border" width="100%">';
+
+ // Sold
+ print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.($_POST["solde"]?$_POST["solde"]:price2num($account->solde)).'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
@@ -332,12 +336,12 @@ if ($action == 'create')
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
- print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
+ print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
}
else
{
- print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
+ print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
}
@@ -506,8 +510,7 @@ else
$account->fetch(GETPOST('id','int'));
print_fiche_titre($langs->trans("EditFinancialAccount"));
- print "<br>";
-
+
if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
@@ -528,7 +531,7 @@ else
print '<table class="border" width="100%">';
// Ref
- print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Ref").'</td>';
+ print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
// Label
@@ -611,29 +614,34 @@ else
$doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
$doleditor->Create();
print '</td></tr>';
+
+ print '</table>';
+
+ print '<br>';
+ print '<table class="border" width="100%">';
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
- print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
+ print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
else
{
- print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
+ print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
// Accountancy journal
- print '<tr><td valign="top">'.$langs->trans("AccountancyJournalCode").'</td>';
+ print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?$_POST["accountancy_journal"]:$account->accountancy_journal).'"></td></tr>';
+
+ print '</table>';
- print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
- print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
- print '</td></tr>';
- print '</table>';
+ print '<center><br><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
+ print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button"></center>';
- print '</form>';
+ print '</form>';
}
}
diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php
index 9eeacee312ca248a5d7f7f24ea025e82b37548cf..4d24aac9a835cafaa92584f0915c63f1ffa35452 100644
--- a/htdocs/compta/deplacement/class/deplacement.class.php
+++ b/htdocs/compta/deplacement/class/deplacement.class.php
@@ -64,8 +64,8 @@ class Deplacement extends CommonObject
{
$this->db = $db;
- $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
- $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
+ $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded');
+ $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded');
return 1;
}
@@ -132,9 +132,9 @@ class Deplacement extends CommonObject
{
$this->db->rollback();
return -2;
- }
+ }
// End call triggers
-
+
$result=$this->update($user);
if ($result > 0)
{
@@ -321,21 +321,25 @@ class Deplacement extends CommonObject
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
+ if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
if ($mode == 3)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
+ if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
}
if ($mode == 4)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
+ if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 5)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
+ if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
}
}
diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php
index 9df4bb90652574385458c9ad8f54b14eb2c5dc03..b6bb980c462326727fa6256fc183059b3e957899 100644
--- a/htdocs/compta/deplacement/fiche.php
+++ b/htdocs/compta/deplacement/fiche.php
@@ -76,6 +76,24 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
}
}
+else if ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
+{
+ $object->fetch($id);
+ if ($object->statut == 1)
+ {
+ $result = $object->setStatut(2);
+ if ($result > 0)
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
+ }
+ }
+}
+
else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
{
$result=$object->delete($id);
@@ -491,11 +509,23 @@ else if ($id)
/*
* Barre d'actions
- */
+ */
print '<div class="tabsAction">';
- if ($object->statut == 0) // if blocked...
+ if ($object->statut < 2) // if not refunded
+ {
+ if ($user->rights->deplacement->creer)
+ {
+ print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
+ }
+ else
+ {
+ print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
+ }
+ }
+
+ if ($object->statut == 0) // if draft
{
if ($user->rights->deplacement->creer)
{
@@ -507,14 +537,18 @@ else if ($id)
}
}
- if ($user->rights->deplacement->creer)
- {
- print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
- }
- else
+ if ($object->statut == 1) // if validated
{
- print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
+ if ($user->rights->deplacement->creer)
+ {
+ print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
+ }
+ else
+ {
+ print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
+ }
}
+
if ($user->rights->deplacement->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index 195bf9023b4add5ced3210ad395ea87890e1b34d..89df2428ca9a93579a0ad8f8aad0741530de6f66 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -56,6 +56,7 @@ $search_ref=GETPOST('search_ref','alpha');
*/
$tripandexpense_static=new Deplacement($db);
+$userstatic = new User($db);
llxHeader();
@@ -132,12 +133,23 @@ if ($resql)
$var=!$var;
print '<tr '.$bc[$var].'>';
+ // Id
print '<td><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.'</a></td>';
+ // Type
print '<td>'.$langs->trans($obj->type).'</td>';
+ // Date
print '<td>'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
- print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->firstname.' '.$obj->name.'</a></td>';
+ // User
+ print '<td align="left">';
+ $userstatic->id = $obj->rowid;
+ $userstatic->lastname = $obj->lastname;
+ $userstatic->firstname = $obj->firstname;
+ print $userstatic->getNomUrl(1);
+ print '</td>';
+
if ($obj->socid) print '<td>'.$soc->getNomUrl(1).'</td>';
else print '<td> </td>';
+
print '<td align="right">'.$obj->km.'</td>';
$tripandexpense_static->statut=$obj->fk_statut;
diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php
index 476b0b12790fd932bf46f0bf195a9217fe521f3c..6e7020025057c11bb35c832825b8517e655c745a 100644
--- a/htdocs/compta/deplacement/stats/index.php
+++ b/htdocs/compta/deplacement/stats/index.php
@@ -219,7 +219,7 @@ $filter='';
print $form->select_company($socid,'socid',$filter,1,1);
print '</td></tr>';
// User
-print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
+print '<tr><td>'.$langs->trans("User").'</td><td>';
print $form->select_dolusers($userid,'userid',1);
print '</td></tr>';
// Year
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 67a93eadc443555143ae9edc2e3024531f96ba76..50af9c5ec1069a7b0be3ad02bccbdff970458e4c 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -933,7 +933,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($result > 0)
{
$lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines();
+ if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
$fk_parent_line=0;
$num=count($lines);
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 8cc3ba278a42a01ea9d0be3a4959f90dbce17e46..d86b214871570bcd6776f918430c43130b090d0f 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
- * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
*
@@ -142,7 +142,7 @@ if ($object->id > 0)
/*
* Facture
- */
+ */
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
@@ -396,7 +396,7 @@ if ($object->id > 0)
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
-
+
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
@@ -448,7 +448,7 @@ if ($object->id > 0)
/*
* Buttons
- */
+ */
print "\n<div class=\"tabsAction\">\n";
// Add a withdraw request
@@ -465,7 +465,11 @@ if ($object->id > 0)
}
else
{
- if ($num == 0) print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPayed")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
+ if ($num == 0)
+ {
+ if ($object->statut > 0) print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPayed")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
+ else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
+ }
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php
index ae74344ccf8289968059a8cb0a440775f1949ad4..c46f83dd6fbe5e2af45897ab2c66c2025fc3bec6 100644
--- a/htdocs/compta/salaries/fiche.php
+++ b/htdocs/compta/salaries/fiche.php
@@ -80,7 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$sal->num_payment=GETPOST("num_payment");
$sal->fk_user_creat=$user->id;
- if (empty($datep) || empty($datesp) || empty($dateep))
+ if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
$error++;
@@ -219,7 +219,7 @@ if ($action == 'create')
print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
print '</td></tr>';
- print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
+ print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
print '</td></tr>';
diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php
index 65c4285d7d1d3324f5c3053d05cf7b0f415c8b7d..a4a5a8831c47ffa40e035e9fc993407767580b9c 100644
--- a/htdocs/compta/tva/fiche.php
+++ b/htdocs/compta/tva/fiche.php
@@ -72,6 +72,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$tva->label=GETPOST("label");
$tva->note=GETPOST("note");
+ if (empty($tva->datev))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateValue")),'errors');
+ $error++;
+ }
+ if (empty($tva->datep))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatePayment")),'errors');
+ $error++;
+ }
if (empty($tva->type_payment) || $tva->type_payment < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 38f4ba9a8c4ab4c93a1a2748671c0b4de129f3a9..165e8ae3c69bd2ebecd29a67becf62f9b476697e 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -252,7 +252,11 @@ if ($action == 'add' && $user->rights->contrat->creer)
{
$srcobject->fetch_thirdparty();
$lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
+ if (empty($lines) && method_exists($srcobject,'fetch_lines'))
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
$fk_parent_line=0;
$num=count($lines);
@@ -339,7 +343,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
}
else
{
-
+
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
@@ -717,7 +721,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
$error ++;
if (! $error) {
-
+
$result = $object->insertExtraFields();
if ($result < 0) {
$error ++;
@@ -735,7 +739,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->errors,'errors');
}
$object->ref_customer=GETPOST('ref_customer','alpha');
-
+
$result = $object->update($user);
if ($result < 0) {
setEventMessage($object->errors,'errors');
@@ -750,7 +754,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->errors,'errors');
}
$object->ref=GETPOST('ref','alpha');
-
+
$result = $object->update($user);
if ($result < 0) {
setEventMessage($object->errors,'errors');
@@ -921,7 +925,7 @@ if ($action == 'create')
$tmpcode='<input name="ref" size="20" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
}
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$tmpcode.'</td></tr>';
-
+
// Ref Int
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td colspan="2"><input type="text" siez="5" name="ref_customer" id="ref_customer" value="'.GETPOST('ref_customer','alpha').'"></td></tr>';
@@ -999,7 +1003,7 @@ if ($action == 'create')
// Other attributes
$parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
-
+
// Other attributes
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit');
@@ -1181,7 +1185,7 @@ else
// 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
-
+
$res = $object->fetch_optionals($object->id, $extralabels);
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
foreach ($extrafields->attribute_label as $key => $label) {
@@ -1201,16 +1205,16 @@ else
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) {
$value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
}
-
+
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) {
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formcontract">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
-
+
print $extrafields->showInputField($key, $value);
-
+
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
@@ -1222,9 +1226,9 @@ else
}
}
}
-
-
-
+
+
+
print "</table>";
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index fdc4a35a58583835aca8edf4dbddcafdd9e05c84..f44efafbffa4c125634e3db286c8d5e81f0857c9 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -154,9 +154,9 @@ abstract class CommonInvoice extends CommonObject
/**
* Return label of object status
*
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
- * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
- * @return string Label
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
+ * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
+ * @return string Label
*/
function getLibStatut($mode=0,$alreadypaid=-1)
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index cec72aacacb54551d4cd3e7e3ed17c3bda2c8bf8..358c2a903041d564846e97beb5aa04911dcca570 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -595,7 +595,7 @@ class Form
$sql = "SELECT c.code, c.label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees as c";
- $sql.= " ORDER BY lower(c.libelle) ASC";
+ //$sql.= " ORDER BY c.label ASC"; // No sort here, sort must be done after translation
dol_syslog(get_class($this).'::load_cache_types_fees', LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -613,6 +613,9 @@ class Form
$this->cache_types_fees[$obj->code] = $label;
$i++;
}
+
+ asort($this->cache_types_fees);
+
return $num;
}
else
@@ -3949,7 +3952,7 @@ class Form
if ($show_empty)
{
- $out.='<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n";
+ $out.='<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n"; // Do not use here. It will show it when list is not ajaxed
}
if (is_array($array))
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 05a1e40b7563eac2a0d73c9689aefa4ed8a87db0..447f96ff61c8f843f9f45d80a84b048842d326a3 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1160,7 +1160,7 @@ class FormFile
print '</td>';
print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
print '<td align="right"></td>';
- print '<td align="right" colspan="2">';
+ print '<td align="right">';
print '<input type="submit" name="save" class="button" value="' . dol_escape_htmltag($langs->trans('Save')) . '">';
print '<input type="submit" name="cancel" class="button" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '">';
print '</td>';
@@ -1175,7 +1175,7 @@ class FormFile
print '<td align="right"></td>';
print '<td align="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>';
print '<td align="center"></td>';
- print '<td align="right" colspan="2">';
+ print '<td align="right">';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink" >' . img_edit() . '</a>'; // id= is included into $param
if ($permtodelete) {
print ' <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id . $param . '" class="deletefilelink">' . img_delete() . '</a>'; // id= is included into $param
@@ -1188,7 +1188,7 @@ class FormFile
}
if ($nboflinks == 0)
{
- print '<tr ' . $bc[$var] . '><td colspan="4">';
+ print '<tr ' . $bc[$var] . '><td colspan="5">';
print $langs->trans("NoLinkFound");
print '</td></tr>';
}
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 03e2a641828a0fdb1b7278dd69f1774726e6804e..b0be8bd1cdde9153aecff7858fcb021a38acfe02 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -147,104 +147,116 @@ class Notify
else $sql.= " AND a.code = '".$action."'"; // New usage
$sql .= " AND s.rowid = ".$socid;
- dol_syslog("Notify::send", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
- $i = 0;
- while ($i < $num) // For each notification couple defined (third party/actioncode)
+
+ if ($num > 0)
{
- $obj = $this->db->fetch_object($result);
-
- $sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">";
- $actiondefid = $obj->adid;
-
- if (dol_strlen($sendto))
- {
- include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');
-
- $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
-
- $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
- $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
- $message.= "\n";
- $message.= $texte;
- // Add link
- $link='';
- switch($objet_type)
- {
- case 'ficheinter':
- $link='/fichinter/fiche.php?id='.$objet_id;
- break;
- case 'propal':
- $link='/comm/propal.php?id='.$objet_id;
- break;
- case 'facture':
- $link='/compta/facture.php?facid='.$objet_id;
- break;
- case 'order':
- $link='/commande/fiche.php?id='.$objet_id;
- break;
- case 'order_supplier':
- $link='/fourn/commande/fiche.php?id='.$objet_id;
- break;
- }
- // Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
- //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
- if ($link) $message.="\n".$urlwithroot.$link;
-
- $filename = basename($file);
-
- $mimefile=dol_mimetype($file);
-
- $msgishtml=0;
-
- $replyto = $conf->notification->email_from;
-
- $mailfile = new CMailFile(
- $subject,
- $sendto,
- $replyto,
- $message,
- array($file),
- array($mimefile),
- array($filename[count($filename)-1]),
- '',
- '',
- 0,
- $msgishtml
- );
-
- if ($mailfile->sendfile())
- {
- $now=dol_now();
- $sendto = htmlentities($sendto);
-
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)";
- $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
- dol_syslog("Notify::send", LOG_DEBUG);
- if (! $this->db->query($sql) )
- {
- dol_print_error($this->db);
- }
- }
- else
- {
- $this->error=$mailfile->error;
- //dol_syslog("Notify::send ".$this->error, LOG_ERR);
- }
- }
- $i++;
+ $i = 0;
+ while ($i < $num) // For each notification couple defined (third party/actioncode)
+ {
+ $obj = $this->db->fetch_object($result);
+
+ $sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">";
+ $actiondefid = $obj->adid;
+
+ if (dol_strlen($obj->email))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ $application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');
+
+ $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
+
+ $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
+ $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
+ $message.= "\n";
+ $message.= $texte;
+ // Add link
+ $link='';
+ switch($objet_type)
+ {
+ case 'ficheinter':
+ $link='/fichinter/fiche.php?id='.$objet_id;
+ break;
+ case 'propal':
+ $link='/comm/propal.php?id='.$objet_id;
+ break;
+ case 'facture':
+ $link='/compta/facture.php?facid='.$objet_id;
+ break;
+ case 'order':
+ $link='/commande/fiche.php?id='.$objet_id;
+ break;
+ case 'order_supplier':
+ $link='/fourn/commande/fiche.php?id='.$objet_id;
+ break;
+ }
+ // Define $urlwithroot
+ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
+ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+ if ($link) $message.="\n".$urlwithroot.$link;
+
+ $filename = basename($file);
+
+ $mimefile=dol_mimetype($file);
+
+ $msgishtml=0;
+
+ $replyto = $conf->notification->email_from;
+
+ $mailfile = new CMailFile(
+ $subject,
+ $sendto,
+ $replyto,
+ $message,
+ array($file),
+ array($mimefile),
+ array($filename[count($filename)-1]),
+ '',
+ '',
+ 0,
+ $msgishtml
+ );
+
+ if ($mailfile->sendfile())
+ {
+ $now=dol_now();
+ $sendto = htmlentities($sendto);
+
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)";
+ $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
+ dol_syslog("Notify::send", LOG_DEBUG);
+ if (! $this->db->query($sql) )
+ {
+ dol_print_error($this->db);
+ }
+ }
+ else
+ {
+ $this->error=$mailfile->error;
+ //dol_syslog("Notify::send ".$this->error, LOG_ERR);
+ }
+ }
+ else
+ {
+ dol_syslog("No notification sent for ".$sendto." because email is empty");
+ }
+ $i++;
+ }
+ return $i;
}
- return $i;
+ else
+ {
+ dol_syslog("No notification sent, nothing into notification setup for the thirdparty socid = ".$socid);
+ return 0;
+ }
}
else
- {
- $this->error=$this->db->error();
+ {
+ $this->error=$this->db->lasterror();
return -1;
}
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 007f84747211e1721bd41d758e03c5c0b269c613..5f4f743a45d3ca0d07f89cbff4875ca3b2ac7232 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -48,6 +48,7 @@
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='')
{
global $conf, $user, $langs, $db, $hookmanager;
+ global $begin_h, $end_h, $begin_d, $end_d;
// Filters
print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
@@ -140,6 +141,26 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '</td></tr>';
}
+ if ($canedit && $action == 'show_peruser')
+ {
+ // Filter on hours
+ print '<tr>';
+ print '<td class="nowrap">'.$langs->trans("WorkingTimeRange").'</td>';
+ print "<td class='nowrap maxwidthonsmartphone'>";
+ print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23"> - ';
+ print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
+ print ' '.$langs->trans("H");
+ print '</td></tr>';
+
+ // Filter on days
+ print '<tr>';
+ print '<td class="nowrap">'.$langs->trans("WorkingDaysRange").'</td>';
+ print "<td class='nowrap maxwidthonsmartphone'>";
+ print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7"> - ';
+ print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
+ print '</td></tr>';
+ }
+
// Hooks
$parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
$reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 3c37a79b7ddf0932ee3aafeb0fd39314b717fb45..762ebf4e605279623955d37af9834ff0d3fea16a 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -132,7 +132,7 @@ function getServerTimeZoneInt($refgmtdate='now')
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
* @param int $duration_value Value of delay to add
* @param int $duration_unit Unit of added delay (d, m, y, w)
- * @return int New timestamp
+ * @return int New timestamp
*/
function dol_time_plus_duree($time,$duration_value,$duration_unit)
{
@@ -482,7 +482,7 @@ function dol_get_last_day($year,$month=12,$gm=false)
* @param int $month Month
* @param int $year Year
* @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
- * @return array year,month, week,first_day,prev_year,prev_month,prev_day
+ * @return array year,month,week,first_day,prev_year,prev_month,prev_day
*/
function dol_get_first_day_week($day,$month,$year,$gm=false)
{
@@ -505,7 +505,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
$tmpday = date($tmparray[0])-$seconds;
$tmpday = date("d",$tmpday);
- //Check first day of week is form this month or not
+ //Check first day of week is in same month than current day or not
if ($tmpday>$day)
{
$prev_month = $month-1;
@@ -522,6 +522,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
$prev_month = $month;
$prev_year = $year;
}
+ $tmpmonth = $prev_month;
+ $tmpyear = $prev_year;
//Get first day of next week
$tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0);
@@ -529,7 +531,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
$tmparray=dol_getdate($tmptime,true);
$prev_day = $tmparray['mday'];
- //Check first day of week is form this month or not
+ //Check prev day of week is in same month than first day or not
if ($prev_day>$tmpday)
{
$prev_month = $month-1;
@@ -542,9 +544,9 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
}
}
- $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm));
+ $week = date("W",dol_mktime(0,0,0,$tmpmonth,$tmpday,$tmpyear,$gm));
- return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
+ return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
}
/**
@@ -659,7 +661,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true;
//Samedi (6) et dimanche (0)
}
-
+
if ($countrycode == 'ES')
{
$countryfound=1;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 8973b54734b9ea546ed759d413de3c303e1cd98b..0f6aec27eda9a348ff315e7127222ad6d581ad56 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -12,7 +12,7 @@
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
- *
+ *
* 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
@@ -173,7 +173,7 @@ function dol_shutdown()
* @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'aZ'=check it's a-z only, 'array'=check it's array, 'san_alpha'= Use filter_var with FILTER_SANITIZE_STRING, 'custom'= custom filter specify $filter and $options)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails)
- * @param mixed $options Options to pass to filter_var when $check is set to custom
+ * @param mixed $options Options to pass to filter_var when $check is set to custom
* @return string||string[] Value found, or '' if check fails
*/
function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
@@ -4064,10 +4064,10 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @return void
* @see dol_htmloutput_events
+ * @deprecated Use setEventMessages instead
*/
function setEventMessage($mesgs, $style='mesgs')
{
- if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
if (! is_array($mesgs)) // If mesgs is a string
{
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;
@@ -4081,6 +4081,23 @@ function setEventMessage($mesgs, $style='mesgs')
}
}
+/**
+ * Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events.
+ * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
+ *
+ * @param string $mesg Message string
+ * @param array $mesgs Message array
+ * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
+ * @return void
+ * @see dol_htmloutput_events
+ */
+function setEventMessages($mesg, $mesgs, $style='mesgs')
+{
+ if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
+ if (empty($mesgs)) setEventMessage($mesg, $style);
+ else setEventMessage($mesgs, $style);
+}
+
/**
* Print formated messages to output (Used to show messages on html output).
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is
diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php
index c6a70180df66fed0380a573f4f6580c0a416b0b2..24e2e05693a2bf432bba67d1d81fcc2bd5ae28a0 100644
--- a/htdocs/core/lib/memory.lib.php
+++ b/htdocs/core/lib/memory.lib.php
@@ -28,7 +28,7 @@ $shmkeys=array('main'=>1,'admin'=>2,'dict'=>3,'companies'=>4,'suppliers'=>5,'pro
'propal'=>13,'boxes'=>14,'banks'=>15,'other'=>16,'errors'=>17,'members'=>18,'ecm'=>19,
'orders'=>20,'users'=>21,'help'=>22,'stocks'=>23,'interventions'=>24,
'donations'=>25,'contracts'=>26);
-$shmoffset=100;
+$shmoffset=1000; // Max number of entries found into a language file. If too low, some entries will be overwritten.
@@ -156,7 +156,7 @@ function dol_getcache($memoryid)
/**
* Return shared memory address used to store dataset with key memoryid
*
- * @param string $memoryid Memory id of shared area
+ * @param string $memoryid Memory id of shared area ('main', 'agenda', ...)
* @return int <0 if KO, Memoy address of shared memory for key
*/
function dol_getshmopaddress($memoryid)
@@ -187,7 +187,7 @@ function dol_listshmop()
/**
* Save data into a memory area shared by all users, all sessions on server
*
- * @param int $memoryid Memory id of shared area
+ * @param int $memoryid Memory id of shared area ('main', 'agenda', ...)
* @param string $data Data to save
* @return int <0 if KO, Nb of bytes written if OK
*/
@@ -223,7 +223,7 @@ function dol_setshmop($memoryid,$data)
/**
* Read a memory area shared by all users, all sessions on server
*
- * @param string $memoryid Memory id of shared area
+ * @param string $memoryid Memory id of shared area ('main', 'agenda', ...)
* @return int <0 if KO, data if OK
*/
function dol_getshmop($memoryid)
diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php
index 7b539f92494089cdb43c712ef50fc07c9873a878..e7d86a5d1a80cc5e28744c68e9d9852e146da003 100644
--- a/htdocs/core/modules/action/rapport.pdf.php
+++ b/htdocs/core/modules/action/rapport.pdf.php
@@ -91,7 +91,7 @@ class CommActionRapport
*/
function write_file($socid = 0, $catid = 0, $outputlangs='')
{
- global $user,$conf,$langs;
+ global $user,$conf,$langs,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@@ -117,6 +117,17 @@ class CommActionRapport
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
@@ -149,6 +160,18 @@ class CommActionRapport
$pdf->Close();
$pdf->Output($file,'F');
+
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
index ecb4abd561c54979520747870063f8172bd8d78d..1112150a0e9f875be6252472fc35cc0c39374f7c 100644
--- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
+++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
@@ -85,7 +85,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
*/
function write_file($_dir, $number, $outputlangs)
{
- global $user,$conf,$langs;
+ global $user,$conf,$langs,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@@ -113,6 +113,17 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$_file = $dir . "/bordereau-".$number.".pdf";
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
// Create PDF instance
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part
@@ -141,6 +152,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$nboflines=count($this->lines);
+
// Define nb of page
$pages = intval($nboflines / $this->line_per_page);
if (($nboflines % $this->line_per_page)>0)
@@ -166,6 +178,18 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->Close();
$pdf->Output($_file,'F');
+
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('adterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
if (! empty($conf->global->MAIN_UMASK))
@chmod($_file, octdec($conf->global->MAIN_UMASK));
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 236a4d52454b2e791d0764099a2ddbbed07321c4..2b7ee2f18a3dcdbe25b9d6409b86cbd74cb8942c 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -184,6 +184,17 @@ class pdf_einstein extends ModelePDFCommandes
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
// Create pdf instance
diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
index 38ca0a8748e482db4882bc4d758350059c6f71fa..290341e5ddbaf53c3fb78d04a42eb34004d15c02 100644
--- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
@@ -183,6 +183,17 @@ class pdf_proforma extends ModelePDFCommandes
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
// Create pdf instance
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index cee022805afb3c4d7eb5d48c81b7cacc9bc1be51..c4d8eb4a1e49a81308d83860b1f97045844de154 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -106,7 +106,7 @@ class pdf_strato extends ModelePDFContract
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
- global $user,$langs,$conf,$mysoc;
+ global $user,$langs,$conf,$hookmanager,$mysoc;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@@ -145,6 +145,17 @@ class pdf_strato extends ModelePDFContract
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
@@ -334,6 +345,18 @@ class pdf_strato extends ModelePDFContract
$pdf->Close();
$pdf->Output($file,'F');
+
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index 5385d7ad0e68816174d827946201022ddc27d016..9b088504649b48c02930318c7c48c3b535145116 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -143,6 +143,17 @@ class pdf_merou extends ModelePdfExpedition
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format,'mm','l');
@@ -329,6 +340,18 @@ class pdf_merou extends ModelePdfExpedition
$pdf->Close();
$pdf->Output($file,'F');
+
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index 177a2bb4fa78ce344d65555d94fed1fcdde6f53b..d0b503d1ee6f1c40762c23ad985dfd277ae65337 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -129,6 +129,17 @@ class pdf_rouget extends ModelePdfExpedition
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
@@ -331,6 +342,18 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->Close();
$pdf->Output($file,'F');
+
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 3c3cca1244063a7ce3eeb9bb4eb0e9088a251332..f7f9c561e013037ee97d3a96008492f9c1939fc6 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -184,6 +184,17 @@ class pdf_crabe extends ModelePDFFactures
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index 284dc62a0b7bdcd5087c688410d7d34498bfea37..4a1915b0a349c420300fdac1616d62bd5e15ddbb 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -137,6 +137,18 @@ class pdf_soleil extends ModelePDFFicheinter
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
index 75bdc06aaedca832719e1834db7388dd461a441d..569cfdff85eaee853bd9721dfda26a6a7fa1d759 100644
--- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
@@ -175,6 +175,17 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblines = count($object->lines);
// Create pdf instance
diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php
index e727f9ba90b125bf053873239e8c444e6aa6d2ed..58dd367757e39d089b2b3f97cce07161fa7b4888 100644
--- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php
@@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
- * \class pdf_baleine
- * \brief Classe permettant de generer les projets au modele Baleine
+ * Classe permettant de generer les projets au modele Baleine
*/
class pdf_baleine extends ModelePDFProjects
@@ -124,6 +123,17 @@ class pdf_baleine extends ModelePDFProjects
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 4678b5a48af6bbd98be925e4d39111d9a5311fc0..e02a6b7e27e23e9698c31439a0115c8c40d0d3df 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -212,6 +212,17 @@ class pdf_azur extends ModelePDFPropales
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php
index 78e8998f7d6b77252ef0eae7c94206400a6eba21..683034156da3c8c30ee7c3123ba8b01293a12c3f 100644
--- a/htdocs/core/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement.class.php
@@ -95,7 +95,7 @@ class pdf_paiement
$socid=0;
if ($user->societe_id) $socid=$user->societe_id;
-
+
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@@ -119,6 +119,17 @@ class pdf_paiement
$year = sprintf("%04d",$year);
$file = $dir . "/payments-".$year."-".$month.".pdf";
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
@@ -141,7 +152,7 @@ class pdf_paiement
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
- if (! $user->rights->societe->client->voir && ! $socid)
+ if (! $user->rights->societe->client->voir && ! $socid)
{
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
@@ -149,7 +160,7 @@ class pdf_paiement
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_paiement = c.id ";
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
- if (! $user->rights->societe->client->voir && ! $socid)
+ if (! $user->rights->societe->client->voir && ! $socid)
{
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
@@ -228,6 +239,18 @@ class pdf_paiement
$pdf->Close();
$pdf->Output($file,'F');
+
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index 49a46c79e2e2c0d53ef4ec3bd5853263d1c95305..f61f49cc471db2dfffae4f78e65d851871e1deda 100644
--- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -184,6 +184,17 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 1c9315a61bdde43954cfd0e4fabfd114b6382723..bb1a4233382538a88021bbbbfe57d66961deca39 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -192,6 +192,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (file_exists($dir))
{
+ // Add pdfgeneration hook
+ if (! is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('pdfgeneration'));
+ $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
+ global $action;
+ $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
@@ -490,7 +501,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->Output($file,'F');
-
// Add pdfgeneration hook
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 406ba0ebc5d512b26d401bf3456427f545c43ec0..15b0a16a13e23b3f9b48721de70b9b21c5a42fa3 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -112,7 +112,6 @@ if ($action == 'add')
$classname = ucfirst($object->origin);
$objectsrc = new $classname($db);
$objectsrc->fetch($object->origin_id);
- //$object->fetch_lines();
$object->socid = $objectsrc->socid;
$object->ref_customer = $objectsrc->ref_client;
@@ -241,7 +240,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
$object->fetch_thirdparty();
$result = $object->valid($user);
-
+
if ($result < 0)
{
$langs->load("errors");
@@ -706,7 +705,7 @@ if ($action == 'create')
print '<td colspan="3">';
$expe->fetch_delivery_methods();
print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1);
- if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
+ if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print "</td></tr>\n";
// Tracking number
@@ -725,7 +724,6 @@ if ($action == 'create')
* Lignes de commandes
*/
- //$lines = $object->fetch_lines(1);
$numAsked = count($object->lines);
print '<script type="text/javascript" language="javascript">
@@ -1270,7 +1268,7 @@ else if ($id || $ref)
print '<input type="hidden" name="action" value="setshipping_method_id">';
$object->fetch_delivery_methods();
print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1);
- if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
+ if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
@@ -1581,7 +1579,7 @@ else if ($id || $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,'/'));
$file=$fileparams['fullname'];
-
+
// Define output language
$outputlangs = $langs;
$newlang = '';
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 7e327eb896a293e544d39acd9f59fbb7f378e146..65140e726794476baad4f8ad576fb2bc9f83e5a5 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -944,9 +944,9 @@ class Fichinter extends CommonObject
}
/**
- * Load array lines
+ * Load array lines ->lines
*
- * @return int <0 if Ko, >0 if OK
+ * @return int <0 if KO, >0 if OK
*/
function fetch_lines()
{
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index a31f04a0c9198459bbe97f4f7408aca198dfa291..0ffca1d2742b6f2474432a8e3a88e34652419abe 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -63,6 +63,7 @@ $confirm = GETPOST('confirm','alpha');
$mesg = GETPOST('msg','alpha');
$origin=GETPOST('origin','alpha');
$originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility
+$note_public = GETPOST('note_public');
//PDF
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
@@ -218,7 +219,11 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
{
$srcobject->fetch_thirdparty();
$lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
+ if (empty($lines) && method_exists($srcobject,'fetch_lines'))
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
$fk_parent_line=0;
$num=count($lines);
@@ -328,7 +333,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
else
{
$langs->load("errors");
- $mesg='<div class="error">'.$langs->trans($object->error).'</div>';
+ setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
}
@@ -963,15 +968,19 @@ if ($action == 'create')
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid'));
- if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
+ if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines'))
+ {
+ $objectsrc->fetch_lines();
+ $lines = $objectsrc->lines;
+ }
$objectsrc->fetch_thirdparty();
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
$soc = $objectsrc->client;
- $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
- $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
+ $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private')));
+ $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public'));
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
@@ -979,8 +988,6 @@ if ($action == 'create')
}
else {
$projectid = GETPOST('projectid','int');
- $note_private = '';
- $note_public = '';
}
if (! $conf->global->FICHEINTER_ADDON)
@@ -1017,7 +1024,7 @@ if ($action == 'create')
// Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
print '<td>';
- print '<textarea name="description" cols="80" rows="'.ROWS_3.'"></textarea>';
+ print '<textarea name="description" cols="80" rows="'.ROWS_3.'">'.GETPOST('description').'</textarea>';
print '</td></tr>';
// Project
@@ -1214,10 +1221,13 @@ else if ($id > 0 || ! empty($ref))
// Third party
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
- // Duration
- print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
- print '<td>'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
- print '</tr>';
+ if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
+ {
+ // Duration
+ print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
+ print '<td>'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
+ print '</tr>';
+ }
// Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td valign="top">';
@@ -1345,7 +1355,7 @@ else if ($id > 0 || ! empty($ref))
else
{
print $extrafields->showOutputField($key,$value);
- if ($object->statut == 0 && $user->rights->ficheinter->creer) print ' <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_picto('','edit').' '.$langs->trans('Modify').'</a>';
+ if (($object->statut == 0 || $object->statut == 1) && $user->rights->ficheinter->creer) print ' <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_picto('','edit').' '.$langs->trans('Modify').'</a>';
}
print '</td></tr>'."\n";
}
@@ -1615,7 +1625,7 @@ else if ($id > 0 || ! empty($ref))
}
// Modify
- if ($object->statut == 1 && $user->rights->ficheinter->creer && empty($conf->global->FICHINTER_DISABLE_DETAILS))
+ if ($object->statut == 1 && $user->rights->ficheinter->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&action=modify"';
print '>'.$langs->trans("Modify").'</a></div>';
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 6a730dbe046e6beea2243f75b559846f1dfe7448..cb34362795954b10fedad525407e261ded1a0f1f 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("companies");
+$langs->load("bills");
$langs->load("interventions");
$socid=GETPOST('socid','int');
@@ -54,12 +55,15 @@ $limit = $conf->liste_limit;
$search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company','alpha');
$search_desc=GETPOST('search_desc','alpha');
+$search_status=GETPOST('search_status');
/*
* View
*/
+$form = new Form($db);
+
llxHeader();
@@ -83,11 +87,14 @@ if ($search_company) {
if ($search_desc) {
$sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
}
+if ($search_status != '' && $search_status >= 0) {
+ $sql .= ' AND f.fk_statut = '.$search_status;
+}
if (! $user->rights->societe->client->voir && empty($socid))
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
$sql.= " AND s.rowid = " . $socid;
-$sql.= " ORDER BY ".$sortfield." ".$sortorder;
+$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
$result=$db->query($sql);
@@ -100,7 +107,7 @@ if ($result)
$urlparam="&socid=$socid";
print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num);
- print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
+ print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@@ -130,7 +137,11 @@ if ($result)
print '<td class="liste_titre"> </td>';
print '<td class="liste_titre"> </td>';
}
- print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
+ print '<td class="liste_titre" align="right">';
+ $liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Validated"), '2'=>$langs->trans("Billed"));
+ print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1);
+ print '<input class="liste_titre" align="right" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
+ print '</td>';
print "</tr>\n";
$companystatic=new Societe($db);
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index b9c67d5a2b6fb102e803bdb68e7ab898bf85474b..97ec3d9482c2ff0453007cc22e2c76a53e9dbd51 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -431,8 +431,8 @@ class CommandeFournisseur extends CommonOrder
/**
* Return label of the status of object
*
- * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label
- * @return string Label
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
+ * @return string Label
*/
function getLibStatut($mode=0)
{
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 4f8d6700e3593f75c6ac4267ad1a56dff887cbc5..d0dbc36e803cc538fd9210bcd46306ac3dff6d28 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -364,7 +364,11 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
if ($result > 0)
{
$lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
+ if (empty($lines) && method_exists($srcobject,'fetch_lines'))
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
$num=count($lines);
for ($i = 0; $i < $num; $i++)
diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql
index 665897069cc5fdb17af1b1e46480477a4bc450c1..090dc2c47be7776f5af02d25908848b590957449 100644
--- a/htdocs/install/mysql/tables/llx_c_paiement.sql
+++ b/htdocs/install/mysql/tables/llx_c_paiement.sql
@@ -1,6 +1,6 @@
-- ========================================================================
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
+-- Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
--
-- This program is free software; you can redistribute it and/or modify
@@ -18,19 +18,12 @@
--
-- ========================================================================
-
--- Type :
---
--- 0 : entree d'argent
--- 1 : sortie d'argent
--- 2 : entree ou sortie d'argent
-
create table llx_c_paiement
(
id integer PRIMARY KEY,
code varchar(6) NOT NULL,
libelle varchar(30),
- type smallint,
+ type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other
active tinyint DEFAULT 1 NOT NULL,
accountancy_code varchar(32) NULL,
module varchar(32) NULL
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index da61d43c1ad2f9576ef7e6ffe74033a0c6109851..c9eacc5a8ebf9758a7c477f97b31b1b7fb2268e0 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1541,3 +1541,4 @@ Opened=Opened
Closed=Closed
Format=Format
+TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type
\ No newline at end of file
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index d18276c362eaf3740b0eed13832c293d03b218c8..73f169609e394535bbe54521ae8c6b1478af6ea8 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -80,8 +80,10 @@ DefaultWorkingHours=Default working hours in day (Example: 9-18)
# External Sites ical
ExportCal=Export calendar
ExtSites=Import external calendars
-ExtSitesEnableThisTool=Show external calendars into agenda
+ExtSitesEnableThisTool=Show external calendars (defined into global setup) into agenda. Does not affect external calendars defined by users.
ExtSitesNbOfAgenda=Number of calendars
AgendaExtNb=Calendar nb %s
ExtSiteUrlAgenda=URL to access .ical file
ExtSiteNoLabel=No Description
+WorkingTimeRange=Working time range
+WorkingDaysRange=Working days range
\ No newline at end of file
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 5490d49622172da6c85bd144c707e2190d45562a..0af0a26fd19e1104506b96ab167c53461f799b1f 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -85,6 +85,7 @@ ClassifyPaid=Classify 'Paid'
ClassifyPaidPartially=Classify 'Paid partially'
ClassifyCanceled=Classify 'Abandoned'
ClassifyClosed=Classify 'Closed'
+ClassifyUnBilled=Classify 'Unbilled'
CreateBill=Create Invoice
AddBill=Add invoice or credit note
AddToDraftInvoices=Add to draft invoice
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 1e3027acd25398e404e23c8ec094e40094c91551..d5b1db83495679ab5545b9db3c867b6000cf3417 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -240,3 +240,5 @@ PricingRule=Pricing Rules
AddCustomerPrice=Add price by customers
ForceUpdateChildPriceSoc=Set same price on customer subsidiaries
PriceByCustomerLog=Price by customer log
+MinimumPriceLimit=Minimum price can't be lower that %s
+MinimumRecommendedPrice=Minimum recommended price is : %s
diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang
index 06d46c7ac654e0b9b1fa123800a33eab355123b6..1759ca8e174878f60cb35a63f742470fda262d6f 100644
--- a/htdocs/langs/en_US/trips.lang
+++ b/htdocs/langs/en_US/trips.lang
@@ -19,3 +19,4 @@ TF_TRIP=Trip
ListTripsAndExpenses=List of trips and expenses
ExpensesArea=Trips and expenses area
SearchATripAndExpense=Search a trip and expense
+ClassifyRefunded=Classify 'Refunded'
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index 68ff2cbefbbb20315f2b80f74f1392d15e9f34d8..877a2b55d54f8d8d7baa9898c1dce5eaa22cd4cd 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -239,3 +239,5 @@ PricingRule=Règle de prix
AddCustomerPrice=Ajouter prix par clients
ForceUpdateChildPriceSoc=Définir le même prix sur les filiales des clients
PriceByCustomerLog=Trace des prix par clients
+MinimumPriceLimit=Le prix minimum ne peut être inférieur à %s
+MinimumRecommendedPrice=Le prix minimum conseillé est de : %s
\ No newline at end of file
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 7db42b6ac44946bce71fc92f35d791736993804c..ffa178629398d08f20d1f9574ec9c0fc261c4b7f 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -148,7 +148,7 @@ class Livraison extends CommonObject
{
$commande = new Commande($this->db);
$commande->id = $this->commande_id;
- $this->lines = $commande->fetch_lines();
+ $commande->fetch_lines();
}
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index c3b7e7da1c767e19ca989e881f90d0ef6bd09991..8b91b916e0bd11fb68414537075d42cca65b5567 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -185,7 +185,7 @@ if ($action == 'builddoc') // En get ou en post
$object = new Livraison($db);
$object->fetch($id);
$object->fetch_thirdparty();
-
+
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
@@ -317,7 +317,8 @@ if ($action == 'create')
*/
print '<br><table class="noborder" width="100%">';
- $lines = $commande->fetch_lines(1);
+ $commande->fetch_lines(1);
+ $lines = $commande->lines;
// Lecture des livraisons deja effectuees
$commande->livraison_array();
@@ -515,7 +516,7 @@ else
if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0)
{
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>';
-
+
// Ref
print '<tr><td width="20%">'.$langs->trans("RefSending").'</td>';
print '<td colspan="3">';
@@ -523,8 +524,8 @@ else
//print $form->showrefnav($expedition, 'refshipment', $linkback, 1, 'ref', 'ref');
print $form->showrefnav($expedition, 'refshipment', $linkback, 0, 'ref', 'ref');
print '</td></tr>';
- }
-
+ }
+
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$delivery->ref.'</td></tr>';
diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php
index c4ca544d861a04d331476ea8cc1833528f7f416c..c1ceb4faa8ea89b687c697fa3b97748ad846e3e1 100644
--- a/htdocs/opensurvey/class/opensurveysondage.class.php
+++ b/htdocs/opensurvey/class/opensurveysondage.class.php
@@ -149,7 +149,7 @@ class Opensurveysondage extends CommonObject
// Call trigger
$result=$this->call_trigger('OPENSURVEY_CREATE',$user);
- if ($result < 0) $error++;
+ if ($result < 0) $error++;
// End call triggers
}
}
@@ -343,7 +343,7 @@ class Opensurveysondage extends CommonObject
{
// Call trigger
$result=$this->call_trigger('OPENSURVEY_DELETE',$user);
- if ($result < 0) $error++;
+ if ($result < 0) $error++;
// End call triggers
}
}
@@ -387,7 +387,7 @@ class Opensurveysondage extends CommonObject
/**
* Return array of lines
*
- * @return array Array of lines
+ * @return int <0 if KO, >0 if OK
*/
function fetch_lines()
{
@@ -413,7 +413,7 @@ class Opensurveysondage extends CommonObject
$this->lines=$ret;
- return $this->lines;
+ return count($this->lines);
}
/**
diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php
index c85a62ae61a9ca5634e7ab34d262585aa69199c5..9b9f2e9ef8cd7ca70f5675fe5ded20700c03bdc9 100644
--- a/htdocs/opensurvey/public/studs.php
+++ b/htdocs/opensurvey/public/studs.php
@@ -43,7 +43,7 @@ $object=new Opensurveysondage($db);
$result=$object->fetch(0,$numsondage);
if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
-$nblignes=count($object->fetch_lines());
+$nblignes=$object->fetch_lines();
//If the survey has not yet finished, then it can be modified
$canbemodified = ($object->date_fin > dol_now());
diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php
index 63c56f9d5e31b26550d803229fb6de1386931e6d..3bfd3209343d12209c10cc8a3032987f742c7b80 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -42,7 +42,7 @@ $object=new Opensurveysondage($db);
$result=$object->fetch(0,$numsondage);
if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
-$nblignes=count($object->fetch_lines());
+$nblignes=$object->fetch_lines();
/*
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index b83f80c9258a8e786959ee168a1fc4a997c3a425..07172e663c4ce3fb4f0a4b0165898aa27636e480 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -9,6 +9,7 @@
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
+ * Copyright (C) 2014 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@@ -3513,4 +3514,35 @@ class Product extends CommonObject
}
}
}
+
+ /**
+ * Return minimum product recommended price
+ *
+ * @return void
+ */
+ function min_recommended_price()
+ {
+ global $conf;
+ if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $product_fourn = new ProductFournisseur($this->db);
+ $product_fourn_list = $product_fourn->list_product_fournisseur_price($this->id, '', '');
+ $maxpricesupplier=0;
+
+ if (is_array($product_fourn_list) && count($product_fourn_list)>0)
+ {
+ foreach($product_fourn_list as $productfourn)
+ {
+ if ($productfourn->fourn_unitprice>$maxpricesupplier)
+ {
+ $maxpricesupplier = $productfourn->fourn_unitprice;
+ }
+ }
+
+ $maxpricesupplier*=$conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE;
+ }
+ return $maxpricesupplier;
+ }
+ }
}
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index a28fbd8370696906336f46c26e48cd94d39d0cfd..b2f0ba0993736a0714a8cc0c9b13aab5ac928c8f 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -6,6 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
+ * Copyright (C) 2014 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@@ -52,6 +53,8 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product
$object = new Product($db);
+$error=0;
+
/*
* Actions
*/
@@ -59,6 +62,9 @@ $object = new Product($db);
if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
$result = $object->fetch($id);
+ $error=0;
+ $maxpricesupplier = $object->min_recommended_price();
+
// MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
@@ -93,6 +99,13 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit-
$newpsq = empty($newpsq) ? 0 : $newpsq;
}
+ if ($newprice_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+ $error++;
+ $action='edit_price';
+ }
+
if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) {
$action = '';
setEventMessage($langs->trans("RecordSaved"));
@@ -197,6 +210,9 @@ if ($action == 'delete_all_price_by_qty') {
* ****************************************************
*/
if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
+
+ $error=0;
+ $maxpricesupplier = $object->min_recommended_price();
$update_child_soc = GETPOST('updatechildprice');
@@ -211,15 +227,24 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
- $result = $prodcustprice->create($user, 0, $update_child_soc);
+ if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+ $error++;
+ $action='add_customer_price';
+ }
- if ($result < 0) {
- setEventMessage($prodcustprice->error, 'errors');
- } else {
- setEventMessage($langs->trans('Save'), 'mesgs');
+ if (empty($error)) {
+ $result = $prodcustprice->create($user, 0, $update_child_soc);
+
+ if ($result < 0) {
+ setEventMessage($prodcustprice->error, 'errors');
+ } else {
+ setEventMessage($langs->trans('Save'), 'mesgs');
+ }
+
+ $action = '';
}
-
- $action = '';
}
if ($action == 'delete_customer_price' && ($user->rights->produit->supprimer || $user->rights->service->supprimer)) {
@@ -236,6 +261,11 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->supprimer ||
}
if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
+
+ $result = $object->fetch($id);
+
+ $error=0;
+ $maxpricesupplier = $object->min_recommended_price();
$update_child_soc = GETPOST('updatechildprice');
@@ -248,15 +278,23 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user-
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
- $result = $prodcustprice->update($user, 0, $update_child_soc);
-
- if ($result < 0) {
- setEventMessage($prodcustprice->error, 'errors');
- } else {
- setEventMessage($langs->trans('Save'), 'mesgs');
+ if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+ $error++;
+ $action='update_customer_price';
+ }
+ if (empty($error)) {
+ $result = $prodcustprice->update($user, 0, $update_child_soc);
+
+ if ($result < 0) {
+ setEventMessage($prodcustprice->error, 'errors');
+ } else {
+ setEventMessage($langs->trans('Save'), 'mesgs');
+ }
+
+ $action = '';
}
-
- $action = '';
}
/*
@@ -613,6 +651,10 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
} else {
print '<td><input name="price_min" size="10" value="' . price($object->price_min) . '">';
}
+ if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
+ }
print '</td></tr>';
print '</table>';
@@ -660,6 +702,10 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
} else {
print '<td><input name="price_min_' . $i . '" size="10" value="' . price($object->multiprices_min ["$i"]) . '">';
}
+ if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
+ }
print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"> ';
@@ -806,6 +852,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if ($action == 'add_customer_price') {
// Create mode
+ $maxpricesupplier = $object->min_recommended_price();
print_fiche_titre($langs->trans('PriceByCustomer'));
@@ -856,6 +903,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} else {
print '<td><input name="price_min" size="10" value="' . price($object->price_min) . '">';
}
+ if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
+ }
print '</td></tr>';
// Update all child soc
@@ -876,6 +927,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} elseif ($action == 'edit_customer_price') {
// Edit mode
+ $maxpricesupplier = $object->min_recommended_price();
print_fiche_titre($langs->trans('PriceByCustomer'));
@@ -893,11 +945,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<td>' . $langs->trans('ThirdParty') . '</td>';
$staticsoc = new Societe($db);
$staticsoc->fetch($prodcustprice->fk_soc);
- print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
+ print "<td colspan='2'>" . $staticsoc->getNomUrl(1) . "</td>";
print '</tr>';
// VAT
- print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
+ print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly);
print '</td></tr>';
@@ -931,6 +983,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} else {
print '<td><input name="price_min" size="10" value="' . price($prodcustprice->price_min) . '">';
}
+ if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ {
+ print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
+ }
print '</td></tr>';
// Update all child soc
diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php
index 1d81029a1e4c25e2269d022f53ec7ed091a6370e..c6340e9d19ca528acbd51d9d88df3e85928a4f1c 100644
--- a/htdocs/theme/amarok/style.css.php
+++ b/htdocs/theme/amarok/style.css.php
@@ -336,6 +336,9 @@ th .button {
.nounderline {
text-decoration: none;
}
+.cursorpointer {
+ cursor: pointer;
+}
.blockvmenubookmarks .menu_contenu {
background-color: transparent;
@@ -1690,13 +1693,19 @@ td.hidden {display:none;}
table.cal_month { border-spacing: 0px; }
.cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; }
+.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; }
+.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; }
.cal_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; }
.cal_other_month { opacity: 0.6; background: #EAEAEA; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_past_month { opacity: 0.6; background: #EEEEEE; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+
+.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_today {
background:#ffffff;
diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php
index c5d36b6d699d14b16c6377492017c3fcff9334ca..0ec5b80688087fbc74d5f88091b392290a98fa1a 100644
--- a/htdocs/theme/auguria/style.css.php
+++ b/htdocs/theme/auguria/style.css.php
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
- * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
@@ -233,7 +233,9 @@ div.inline-block
.nounderline {
text-decoration: none;
}
-
+.cursorpointer {
+ cursor: pointer;
+}
/* ============================================================================== */
/* Styles to hide objects */
@@ -1839,9 +1841,14 @@ td.hidden {
table.cal_month { border-spacing: 0px; }
.cal_other_month { background: #DDDDDD; border: solid 1px #ACBCBB; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; }
.cal_past_month { background: #EEEEEE; border: solid 1px #ACBCBB; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
-.cal_current_month { background: #FFFFFF; border: solid 1px #ACBCBB; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_current_month { background: #FFFFFF; border-left: solid 1px #ACBCBB; border-bottom: solid 1px #ACBCBB; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #ACBCBB; }
+.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
table.cal_event { border-collapse: collapse; margin-bottom: 1px; }
table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?php print $right; ?>: 2px; padding-top: 0px; padding-bottom: 0px; }
ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -webkit-padding-start: 0px; -webkit-padding-start: 0px; }
@@ -1850,6 +1857,7 @@ li.cal_event { border: none; list-style-type: none; }
.cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; }
+.cal_peruser { padding: 0px; }
/* ============================================================================== */
diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php
index 867f25e1d0d87c2abcf294e3fc451302415c947d..e9c742a24c17e22f6c5e6293a54434f0a4771f05 100644
--- a/htdocs/theme/bureau2crea/style.css.php
+++ b/htdocs/theme/bureau2crea/style.css.php
@@ -258,6 +258,9 @@ div.inline-block
.nounderline {
text-decoration: none;
}
+.cursorpointer {
+ cursor: pointer;
+}
/* ============================================================================== */
@@ -1938,13 +1941,18 @@ td.hidden {
table.cal_month { border-spacing: 0px; }
.cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; }
+.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; }
+.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; }
.cal_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; }
.cal_other_month { background: #DDDDDD; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_past_month { background: #EEEEEE; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_current_month { background: #FFFFFF; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_today { background: #FFFFFF; border: solid 2px #C0C0C0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
table.cal_event { border-collapse: collapse; margin-bottom: 1px; }
table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?php print $right; ?>: 2px; padding-top: 0px; padding-bottom: 0px; }
ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -webkit-padding-start: 0px; -webkit-padding-start: 0px; }
diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php
index 1c6e13944ca0085ed7b6f24fe93de08da39e9143..555e674fb928c17af7cb7ec2352268f18552697d 100644
--- a/htdocs/theme/cameleo/style.css.php
+++ b/htdocs/theme/cameleo/style.css.php
@@ -234,6 +234,9 @@ div.inline-block
.nounderline {
text-decoration: none;
}
+.cursorpointer {
+ cursor: pointer;
+}
/* ============================================================================== */
@@ -1963,13 +1966,18 @@ td.hidden {
table.cal_month { border-spacing: 0px; }
.cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; }
+.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; }
+.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; }
.cal_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; }
.cal_other_month { background: #DDDDDD; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_past_month { background: #EEEEEE; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_current_month { background: #FFFFFF; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_today { background: #FFFFFF; border: solid 2px #C0C0C0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
table.cal_event { border-collapse: collapse; margin-bottom: 1px; }
table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?php print $right; ?>: 2px; padding-top: 0px; padding-bottom: 0px; }
ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -webkit-padding-start: 0px; -webkit-padding-start: 0px; }
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 1a0423d2b1684b8732e19f90962e7f22d805b07c..36cbc9afb54ff25d7a92c6af141bd7feed45c1f5 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -399,7 +399,9 @@ th .button {
.nounderline {
text-decoration: none;
}
-
+.cursorpointer {
+ cursor: pointer;
+}
/* ============================================================================== */
/* Styles to hide objects */
@@ -2312,15 +2314,22 @@ td.hidden {
table.cal_month { border-spacing: 0px; }
.cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; }
+.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_current_month_oneday { border-right: solid 1px #E0E0E0; }
.cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; }
+.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; }
.cal_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; }
.cal_other_month { opacity: 0.6; background: #EAEAEA; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_past_month { opacity: 0.6; background: #EEEEEE; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
+.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_past { }
+.cal_peruser { padding: 0px; }
+.peruser_busy { background: #FF8888; }
table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
@@ -2562,7 +2571,7 @@ A.none, A.none:active, A.none:visited, A.none:hover {
/* CKEditor */
/* ============================================================================== */
-.cke_editable
+.cke_editable
{
margin: 5px !important;
}
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 5d90093b37975feb3acdf90432b5208ce7b011aa..b801c2660aad6512e11e9d8ab477fef714227937 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -174,7 +174,7 @@ class UserGroup extends CommonObject
}
/**
- * Return array of users id for group this->id (or all if this->id not defined)
+ * Return array of User objects for group this->id (or all if this->id not defined)
*
* @param string $excludefilter Filter to exclude
* @param int $mode 0=Return array of user instance, 1=Return array of users id only
@@ -546,7 +546,7 @@ class UserGroup extends CommonObject
{
// Call trigger
$result=$this->call_trigger('GROUP_DELETE',$user);
- if ($result < 0) { $error++; $this->db->rollback(); return -1; }
+ if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
$this->db->commit();
@@ -579,7 +579,7 @@ class UserGroup extends CommonObject
if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity;
$this->db->begin();
-
+
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup (";
$sql.= "datec";
$sql.= ", nom";
@@ -602,7 +602,7 @@ class UserGroup extends CommonObject
{
// Call trigger
$result=$this->call_trigger('GROUP_CREATE',$user);
- if ($result < 0) { $error++; $this->db->rollback(); return -1; }
+ if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
}
@@ -636,7 +636,7 @@ class UserGroup extends CommonObject
}
$this->db->begin();
-
+
$sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET ";
$sql.= " nom = '" . $this->db->escape($this->nom) . "'";
$sql.= ", entity = " . $this->db->escape($entity);
@@ -651,11 +651,11 @@ class UserGroup extends CommonObject
{
// Call trigger
$result=$this->call_trigger('GROUP_MODIFY',$user);
- if ($result < 0) { $error++; }
+ if ($result < 0) { $error++; }
// End call triggers
}
- if (! $error)
+ if (! $error)
{
$this->db->commit();
return 1;