Merge remote-tracking branch 'Upstream/develop' into develop-accounting

This commit is contained in:
aspangaro 2014-09-07 07:32:47 +02:00
commit 02f45b7f43
67 changed files with 1391 additions and 470 deletions

View File

@ -5,6 +5,8 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* ***** ***** ChangeLog for 3.7 compared to 3.6.* *****
For users: 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: 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: 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. - 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. - New: When a translation is not available we always jump to en_US and only en_US.
For developers: For developers:
- New: Add a css style "cursorpointer".
- New: Select list of users can return user into hierarchy. - New: Select list of users can return user into hierarchy.
- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet) - New: getBrowserInfo can return type of layout of browser (classic/phone/tablet)
- New: Add hook "searchAgendaFrom". - New: Add hook "searchAgendaFrom".
@ -102,12 +105,18 @@ Dolibarr better:
***** ChangeLog for 3.6.1 compared to 3.6.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: For users:
- Fix: Can upload files on services. - Fix: Can upload files on services.
- Fix: sql errors on updat fichinter - Fix: sql errors on updat fichinter.
- Fix: debian script syntax error - Fix: debian script syntax error.
- Fix: error "menu param is not inside list" into pos module. - Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets - Fix: Salary payments are not reflected on the reporting sheets.
- Fix: Unsubscribe emailing not working - Fix: Unsubscribe emailing not working.
- Fix: Trigger on create category call failed because user is not passed on card - 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.* ***** ***** ChangeLog for 3.6 compared to 3.5.* *****
For users: For users:

View File

@ -387,17 +387,23 @@ if ($id == 11)
$langs->load("bills"); $langs->load("bills");
$langs->load("interventions"); $langs->load("interventions");
$elementList = array( $elementList = array(
'commande' => $langs->trans('Order'), 'proposal' => $langs->trans('Proposal'),
'order' => $langs->trans('Order'),
'invoice' => $langs->trans('Bill'),
'invoice_supplier' => $langs->trans('SupplierBill'), 'invoice_supplier' => $langs->trans('SupplierBill'),
'order_supplier' => $langs->trans('SupplierOrder'), 'order_supplier' => $langs->trans('SupplierOrder'),
'contrat' => $langs->trans('Contract'), 'intervention' => $langs->trans('InterventionCard'),
'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'), 'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'), 'project_task' => $langs->trans('Task'),
'agenda' => $langs->trans('Agenda'),
// old deprecated
'contrat' => $langs->trans('Contract'),
'propal' => $langs->trans('Proposal'), 'propal' => $langs->trans('Proposal'),
'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'), 'facture' => $langs->trans('Bill'),
'facture_fourn' => $langs->trans('SupplierBill'), 'facture_fourn' => $langs->trans('SupplierBill'),
'fichinter' => $langs->trans('InterventionCard'), 'fichinter' => $langs->trans('InterventionCard')
'agenda' => $langs->trans('Agenda')
); );
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
$sourceList = array( $sourceList = array(
@ -770,7 +776,10 @@ if ($id)
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";} if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";}
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } 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]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }

View File

@ -166,7 +166,7 @@ $nowday=$nowarray['mday'];
$listofextcals=array(); $listofextcals=array();
// Define list of external calendars (global admin setup) // 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; $i=0;
while($i < $conf->global->AGENDA_EXT_NB) 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) // Define list of external calendars (user setup)
$i=0; if (empty($user->conf->AGENDA_DISABLE_EXT))
while($i < $conf->global->AGENDA_EXT_NB)
{ {
$i++; $i=0;
$source='AGENDA_EXT_SRC_'.$user->id.'_'.$i; while($i < $conf->global->AGENDA_EXT_NB)
$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' $i++;
$listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0)); $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_month = $prev['prev_month'];
$prev_day = $prev['prev_day']; $prev_day = $prev['prev_day'];
$first_day = $prev['first_day']; $first_day = $prev['first_day'];
$first_month= $prev['first_month'];
$first_year = $prev['first_year'];
$week = $prev['week']; $week = $prev['week'];
$day = (int) $day; $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_year = $next['year'];
$next_month = $next['month']; $next_month = $next['month'];
$next_day = $next['day']; $next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow // Define firstdaytoshow and lastdaytoshow
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year); $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
$lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_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));
@ -296,7 +301,7 @@ if (empty($action) || $action=='show_month')
if ($action=='show_week') if ($action=='show_week')
{ {
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n"; $nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;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.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n"; $nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)"; $nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
@ -338,10 +343,6 @@ $showextcals=$listofextcals;
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
$s=''; $s='';
//print '<tr><td>';
//print $langs->trans("Calendars").': ';
//print '<td align="center" valign="middle" class="nowrap">';
$s.='<script type="text/javascript">' . "\n"; $s.='<script type="text/javascript">' . "\n";
$s.='jQuery(document).ready(function () {' . "\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_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").' &nbsp; </div>'; $s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' &nbsp; </div>';
//print '</td></tr>';
} }
@ -854,8 +853,7 @@ if (count($listofextcals))
$daykey=dol_mktime(0,0,0,$mois,$jour,$annee); $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
$daykeygmt=dol_mktime(0,0,0,$mois,$jour,$annee,true,0); $daykeygmt=dol_mktime(0,0,0,$mois,$jour,$annee,true,0);
do 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').' '; //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; $eventarray[$daykey][]=$event;
$daykey+=60*60*24; $daykeygmt+=60*60*24; // Add one day $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) // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
//var_dump($eventarray); //var_dump($eventarray);
//print $tmpday;
for ($iter_week = 0; $iter_week < 6 ; $iter_week++) for ($iter_week = 0; $iter_week < 6 ; $iter_week++)
{ {
echo " <tr>\n"; echo " <tr>\n";
@ -983,39 +980,27 @@ elseif ($action == 'show_week') // View by week
} }
echo " </tr>\n"; 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"; 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_time_plus_duree($firstdaytoshow, $iter_day, 'd');
// Show days of the current week $tmparray = dol_getdate($curtime,'fast');
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); $tmpday = $tmparray['mday'];
$tmpmonth = $tmparray['mon'];
$tmpyear = $tmparray['year'];
$style='cal_current_month'; $style='cal_current_month';
if ($iter_day == 6) $style.=' cal_other_month_right'; if ($iter_day == 6) $style.=' cal_other_month_right';
$today=0; $today=0;
$todayarray=dol_getdate($now,'fast'); $todayarray=dol_getdate($now,'fast');
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
if ($today) $style='cal_today'; if ($today) $style='cal_today';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " </td>\n"; 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++;
} }
echo " </tr>\n"; echo " </tr>\n";
@ -1387,6 +1372,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '</div>'."\n"; print '</div>'."\n";
} }
/** /**
* Change color with a delta * 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)); $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus));
return $newcolor; return $newcolor;
} }

View File

@ -263,7 +263,7 @@ if ($resql)
// Start date // Start date
print '<td align="center" class="nowrap">'; 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; $late=0;
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; 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; 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 // End date
print '<td align="center" class="nowrap">'; 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>'; print '</td>';
// Third party // Third party

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2014 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -27,14 +28,13 @@
*/ */
require '../../main.inc.php'; 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.'/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/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
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; 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); $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); $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","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'); $sortfield = GETPOST("sortfield",'alpha');
@ -71,23 +73,48 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
$filterd=$user->id; $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");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $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); $pid=GETPOST("projectid","int",3);
$status=GETPOST("status"); $status=GETPOST("status");
$type=GETPOST("type"); $type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $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':''); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':'');
if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($dateselect > 0)
if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); {
$day=GETPOST('dateselectday');
$month=GETPOST('dateselectmonth');
$year=GETPOST('dateselectyear');
}
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $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 == '' && ! 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' && $action != 'show_peruser') {
$action='show_month'; $day=''; $action='show_month'; $day='';
} // View by month } // View by month
if (GETPOST('viewweek') || $action == 'show_week') { if (GETPOST('viewweek') || $action == 'show_week') {
@ -110,7 +137,13 @@ $hookmanager->initHooks(array('agenda'));
* Actions * 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); $form=new Form($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
$contactstatic=new Contact($db);
$now=dol_now(); $now=dol_now();
$nowarray=dol_getdate($now); $nowarray=dol_getdate($now);
@ -130,87 +162,30 @@ $nowyear=$nowarray['year'];
$nowmonth=$nowarray['mon']; $nowmonth=$nowarray['mon'];
$nowday=$nowarray['mday']; $nowday=$nowarray['mday'];
// Define list of all external calendars
// Define list of all external calendars (global setup)
$listofextcals=array(); $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));
}
}
}
$prev = dol_get_first_day_week($day, $month, $year);
$first_day = $prev['first_day'];
$first_month = $prev['first_month'];
$first_year = $prev['first_year'];
if (empty($action) || $action=='show_month') $week = $prev['week'];
{
$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 $day = (int) $day;
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month $next = dol_get_next_week($day, $week, $month, $year);
// 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) $next_year = $next['year'];
$tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; $next_month = $next['month'];
$tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1); $next_day = $next['day'];
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'];
$week = $prev['week']; // Define firstdaytoshow and lastdaytoshow
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
$day = (int) $day; $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
$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 $tmpday = $first_day;
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
$lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_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);
}
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
//print dol_print_date($firstdaytoshow,'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"); if ($status == 'todo') $title=$langs->trans("ToDoActions");
$param=''; $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 ($filter) $param.="&filter=".$filter;
if ($filtera) $param.="&filtera=".$filtera; if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&filtert=".$filtert;
@ -229,39 +205,46 @@ if ($filterd) $param.="&filterd=".$filterd;
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid; if ($pid) $param.="&projectid=".$pid;
if ($actioncode != '') $param.="&actioncode=".$actioncode;
if ($type) $param.="&type=".$type; 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; $param.="&maxprint=".$maxprint;
// Show navigation bar
if (empty($action) || $action=='show_month') $prev = dol_get_first_day_week($day, $month, $year);
{ $prev_year = $prev['prev_year'];
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month.$param."\">".img_previous($langs->trans("Previous"))."</a>\n"; $prev_month = $prev['prev_month'];
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y"); $prev_day = $prev['prev_day'];
$nav.=" </span>\n"; $first_day = $prev['first_day'];
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month.$param."\">".img_next($langs->trans("Next"))."</a>\n"; $first_month= $prev['first_month'];
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth.$param."\">".$langs->trans("Today")."</a>)"; $first_year = $prev['first_year'];
$picto='calendar';
} $week = $prev['week'];
if ($action=='show_week')
{ $day = (int) $day;
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n"; $next = dol_get_next_week($first_day, $week, $first_month, $first_year);
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week; $next_year = $next['year'];
$nav.=" </span>\n"; $next_month = $next['month'];
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n"; $next_day = $next['day'];
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$picto='calendarweek'; // Define firstdaytoshow and lastdaytoshow
} $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
if ($action=='show_day') $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
{
$nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n"; $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort");
$nav.=" </span>\n"; $tmpday = $first_day;
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)"; $nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$picto='calendarday'; $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."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$picto='calendarweek';
$nav.=' &nbsp; <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 // Must be after the nav definition
$param.='&year='.$year.'&month='.$month.($day?'&day='.$day:''); $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); $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
$head = calendars_prepare_head($paramnoaction); $head = calendars_prepare_head($paramnoaction);
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); 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(); 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").' &nbsp; </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'] . ' &nbsp; </div>';
}
}
}
//$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' &nbsp; </div>';
}
$link='';
print_fiche_titre($s,$link.' &nbsp; &nbsp; '.$nav, ''); print_fiche_titre($s,$link.' &nbsp; &nbsp; '.$nav, '');
@ -336,7 +367,7 @@ else
if ($type) $sql.= " AND ca.id = ".$type; if ($type) $sql.= " AND ca.id = ".$type;
if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '0') { $sql.= " AND a.percent = 0"; }
if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable 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 == '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 ($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) if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
@ -349,7 +380,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
$sql.= ")"; $sql.= ")";
} }
// Sort on date // Sort on date
$sql.= ' ORDER BY datep'; $sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
//print $sql; //print $sql;
dol_syslog("comm/action/index.php", LOG_DEBUG); dol_syslog("comm/action/index.php", LOG_DEBUG);
@ -446,6 +477,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
$maxnbofchar=18; $maxnbofchar=18;
$cachethirdparties=array(); $cachethirdparties=array();
$cachecontacts=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)); 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>';
/* TODO Export // Table :
print ' echo '<table width="100%" class="nocellnopadd cal_month">';
<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> echo '<tr class="liste_titre">';
<a href="" id="actionagenda_rss_link"><img src="'.DOL_URL_ROOT.'/theme/common/rss.gif" border="0"/></a> 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>';
<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(); llxFooter();
$db->close(); $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='&nbsp;';$string2='&nbsp;';
$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='&nbsp;';
$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='&nbsp;';
$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>';
}
}

View File

@ -365,7 +365,11 @@ else if ($action == 'add' && $user->rights->propal->creer) {
if ($result > 0) if ($result > 0)
{ {
$lines = $srcobject->lines; $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; $fk_parent_line=0;
$num=count($lines); $num=count($lines);
@ -1283,7 +1287,9 @@ if ($action == 'create') {
$objectsrc = new $classname($db); $objectsrc = new $classname($db);
$objectsrc->fetch($originid); $objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))
{
$objectsrc->fetch_lines(); $objectsrc->fetch_lines();
}
$objectsrc->fetch_thirdparty(); $objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
@ -1951,7 +1957,8 @@ if ($action == 'create') {
print '</tr>'; print '</tr>';
} }
if ($soc->outstanding_limit) { if ($soc->outstanding_limit)
{
// Outstanding Bill // Outstanding Bill
print '<tr><td>'; print '<tr><td>';
print $langs->trans('OutstandingBill'); print $langs->trans('OutstandingBill');
@ -1962,6 +1969,26 @@ if ($action == 'create') {
print '</tr>'; 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&amp;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) // Other attributes (TODO Move this into an include)
$res = $object->fetch_optionals($object->id, $extralabels); $res = $object->fetch_optionals($object->id, $extralabels);
$parameters = array('colspan' => ' colspan="3"'); $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&amp;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 // Amount HT
print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>'; 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>'; print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';

View File

@ -271,10 +271,12 @@ else if ($action == 'add' && $user->rights->commande->creer) {
if ($ret < 0) if ($ret < 0)
$error ++; $error ++;
if (! $error) { if (! $error)
{
$object_id = $object->create($user); $object_id = $object->create($user);
if ($object_id > 0) { if ($object_id > 0)
{
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement); $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"); dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id); $result = $srcobject->fetch($object->origin_id);
if ($result > 0) { if ($result > 0)
{
$lines = $srcobject->lines; $lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines')) if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
$lines = $srcobject->fetch_lines(); {
$srcobject->fetch_lines();
$lines = $srcobject->lines;
}
$fk_parent_line = 0; $fk_parent_line = 0;
$num = count($lines); $num = count($lines);
for($i = 0; $i < $num; $i ++) { for($i = 0; $i < $num; $i ++)
{
$label = (! empty($lines [$i]->label) ? $lines [$i]->label : ''); $label = (! empty($lines [$i]->label) ? $lines [$i]->label : '');
$desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle); $desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle);
$product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0); $product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0);

View File

@ -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/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.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'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('bills'); $langs->load('bills');
$langs->load('products'); $langs->load('products');
$langs->load('main'); $langs->load('main');
@ -216,13 +216,17 @@ if (($action == 'create' || $action == 'add') && !$error)
$result=$objectsrc->fetch($orders_id[$ii]); $result=$objectsrc->fetch($orders_id[$ii]);
if ($result > 0) if ($result > 0)
{ {
if ($closeOrders) if ($closeOrders)
{ {
$objectsrc->classifyBilled(); $objectsrc->classifyBilled();
$objectsrc->setStatut(3); $objectsrc->setStatut(3);
} }
$lines = $objectsrc->lines; $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; $fk_parent_line=0;
$num=count($lines); $num=count($lines);
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)

View File

@ -240,7 +240,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // 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>'; 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 // 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=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '</table>';
print '<br>';
print '<table class="border" width="100%">';
// Sold // Sold
print '<tr><td colspan="4"><b>'.$langs->trans("InitialBankBalance").'...</b></td></tr>'; print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
print '<tr><td valign="top">'.$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 '<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>'; print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
@ -332,12 +336,12 @@ if ($action == 'create')
// Accountancy code // Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) 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>'; print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
} }
else 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>'; 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')); $account->fetch(GETPOST('id','int'));
print_fiche_titre($langs->trans("EditFinancialAccount")); print_fiche_titre($langs->trans("EditFinancialAccount"));
print "<br>";
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@ -528,7 +531,7 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // 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>'; print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
// Label // 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=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(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '</table>';
print '<br>';
print '<table class="border" width="100%">';
// Accountancy code // Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) 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>'; print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
} }
else 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>'; 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 // 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 '<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 '<center><br><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">'; print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button"></center>';
print '</td></tr>';
print '</table>';
print '</form>'; print '</form>';
} }
} }

View File

@ -64,8 +64,8 @@ class Deplacement extends CommonObject
{ {
$this->db = $db; $this->db = $db;
$this->statuts_short = 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 => 'Closed'); $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded');
return 1; return 1;
} }
@ -132,9 +132,9 @@ class Deplacement extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
// End call triggers // End call triggers
$result=$this->update($user); $result=$this->update($user);
if ($result > 0) 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==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==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 ($mode == 3)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); 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==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 ($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==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==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 ($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==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==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');
} }
} }

View File

@ -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) else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
{ {
$result=$object->delete($id); $result=$object->delete($id);
@ -491,11 +509,23 @@ else if ($id)
/* /*
* Barre d'actions * Barre d'actions
*/ */
print '<div class="tabsAction">'; 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) if ($user->rights->deplacement->creer)
{ {
@ -507,14 +537,18 @@ else if ($id)
} }
} }
if ($user->rights->deplacement->creer) if ($object->statut == 1) // if validated
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>'; if ($user->rights->deplacement->creer)
} {
else print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
{ }
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
}
} }
if ($user->rights->deplacement->supprimer) if ($user->rights->deplacement->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';

View File

@ -56,6 +56,7 @@ $search_ref=GETPOST('search_ref','alpha');
*/ */
$tripandexpense_static=new Deplacement($db); $tripandexpense_static=new Deplacement($db);
$userstatic = new User($db);
llxHeader(); llxHeader();
@ -132,12 +133,23 @@ if ($resql)
$var=!$var; $var=!$var;
print '<tr '.$bc[$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>'; 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>'; print '<td>'.$langs->trans($obj->type).'</td>';
// Date
print '<td>'.dol_print_date($db->jdate($obj->dd),'day').'</td>'; 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>'; if ($obj->socid) print '<td>'.$soc->getNomUrl(1).'</td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
print '<td align="right">'.$obj->km.'</td>'; print '<td align="right">'.$obj->km.'</td>';
$tripandexpense_static->statut=$obj->fk_statut; $tripandexpense_static->statut=$obj->fk_statut;

View File

@ -219,7 +219,7 @@ $filter='';
print $form->select_company($socid,'socid',$filter,1,1); print $form->select_company($socid,'socid',$filter,1,1);
print '</td></tr>'; print '</td></tr>';
// User // 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 $form->select_dolusers($userid,'userid',1);
print '</td></tr>'; print '</td></tr>';
// Year // Year

View File

@ -933,7 +933,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($result > 0) if ($result > 0)
{ {
$lines = $srcobject->lines; $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; $fk_parent_line=0;
$num=count($lines); $num=count($lines);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* *
@ -142,7 +142,7 @@ if ($object->id > 0)
/* /*
* Facture * Facture
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $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 align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>'; 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 '<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>'; print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
@ -448,7 +448,7 @@ if ($object->id > 0)
/* /*
* Buttons * Buttons
*/ */
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
// Add a withdraw request // Add a withdraw request
@ -465,7 +465,11 @@ if ($object->id > 0)
} }
else 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>'; else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
} }

View File

@ -80,7 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$sal->num_payment=GETPOST("num_payment"); $sal->num_payment=GETPOST("num_payment");
$sal->fk_user_creat=$user->id; $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'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
$error++; $error++;
@ -219,7 +219,7 @@ if ($action == 'create')
print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
print '</td></tr>'; 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 $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
print '</td></tr>'; print '</td></tr>';

View File

@ -72,6 +72,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$tva->label=GETPOST("label"); $tva->label=GETPOST("label");
$tva->note=GETPOST("note"); $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) if (empty($tva->type_payment) || $tva->type_payment < 0)
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');

View File

@ -252,7 +252,11 @@ if ($action == 'add' && $user->rights->contrat->creer)
{ {
$srcobject->fetch_thirdparty(); $srcobject->fetch_thirdparty();
$lines = $srcobject->lines; $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; $fk_parent_line=0;
$num=count($lines); $num=count($lines);
@ -339,7 +343,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
} }
else else
{ {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
@ -717,7 +721,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
$error ++; $error ++;
if (! $error) { if (! $error) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
@ -735,7 +739,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->errors,'errors'); setEventMessage($object->errors,'errors');
} }
$object->ref_customer=GETPOST('ref_customer','alpha'); $object->ref_customer=GETPOST('ref_customer','alpha');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors,'errors'); setEventMessage($object->errors,'errors');
@ -750,7 +754,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->errors,'errors'); setEventMessage($object->errors,'errors');
} }
$object->ref=GETPOST('ref','alpha'); $object->ref=GETPOST('ref','alpha');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors,'errors'); 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).'">'; $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>'; print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$tmpcode.'</td></tr>';
// Ref Int // Ref Int
print '<tr><td>'.$langs->trans('RefCustomer').'</td>'; 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>'; 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 // Other attributes
$parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $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 $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Other attributes // Other attributes
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
@ -1181,7 +1185,7 @@ else
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $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); $res = $object->fetch_optionals($object->id, $extralabels);
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attribute_label)) {
foreach ($extrafields->attribute_label as $key => $label) { foreach ($extrafields->attribute_label as $key => $label) {
@ -1201,16 +1205,16 @@ else
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { 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]); $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) { 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 '<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="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">'; print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">'; print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value); print $extrafields->showInputField($key, $value);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">'; print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>'; print '</form>';
} else { } else {
@ -1222,9 +1226,9 @@ else
} }
} }
} }
print "</table>"; print "</table>";

View File

@ -154,9 +154,9 @@ abstract class CommonInvoice extends CommonObject
/** /**
* Return label of object status * 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 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) * @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 * @return string Label
*/ */
function getLibStatut($mode=0,$alreadypaid=-1) function getLibStatut($mode=0,$alreadypaid=-1)
{ {

View File

@ -595,7 +595,7 @@ class Form
$sql = "SELECT c.code, c.label"; $sql = "SELECT c.code, c.label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees as c"; $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); dol_syslog(get_class($this).'::load_cache_types_fees', LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -613,6 +613,9 @@ class Form
$this->cache_types_fees[$obj->code] = $label; $this->cache_types_fees[$obj->code] = $label;
$i++; $i++;
} }
asort($this->cache_types_fees);
return $num; return $num;
} }
else else
@ -3949,7 +3952,7 @@ class Form
if ($show_empty) if ($show_empty)
{ {
$out.='<option value="-1"'.($id==-1?' selected="selected"':'').'>&nbsp;</option>'."\n"; $out.='<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n"; // Do not use &nbsp; here. It will show it when list is not ajaxed
} }
if (is_array($array)) if (is_array($array))

View File

@ -1160,7 +1160,7 @@ class FormFile
print '</td>'; print '</td>';
print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>'; print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
print '<td align="right"></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="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 '<input type="submit" name="cancel" class="button" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '">';
print '</td>'; print '</td>';
@ -1175,7 +1175,7 @@ class FormFile
print '<td align="right"></td>'; print '<td align="right"></td>';
print '<td align="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>'; print '<td align="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>';
print '<td align="center"></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 print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink" >' . img_edit() . '</a>'; // id= is included into $param
if ($permtodelete) { if ($permtodelete) {
print ' &nbsp; <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id . $param . '" class="deletefilelink">' . img_delete() . '</a>'; // id= is included into $param print ' &nbsp; <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) if ($nboflinks == 0)
{ {
print '<tr ' . $bc[$var] . '><td colspan="4">'; print '<tr ' . $bc[$var] . '><td colspan="5">';
print $langs->trans("NoLinkFound"); print $langs->trans("NoLinkFound");
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -147,104 +147,116 @@ class Notify
else $sql.= " AND a.code = '".$action."'"; // New usage else $sql.= " AND a.code = '".$action."'"; // New usage
$sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = ".$socid;
dol_syslog("Notify::send", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows($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); $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.">"; $sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">";
$actiondefid = $obj->adid; $actiondefid = $obj->adid;
if (dol_strlen($sendto)) if (dol_strlen($obj->email))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM'); $application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification"); $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n"; $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
$message.= "\n"; $message.= "\n";
$message.= $texte; $message.= $texte;
// Add link // Add link
$link=''; $link='';
switch($objet_type) switch($objet_type)
{ {
case 'ficheinter': case 'ficheinter':
$link='/fichinter/fiche.php?id='.$objet_id; $link='/fichinter/fiche.php?id='.$objet_id;
break; break;
case 'propal': case 'propal':
$link='/comm/propal.php?id='.$objet_id; $link='/comm/propal.php?id='.$objet_id;
break; break;
case 'facture': case 'facture':
$link='/compta/facture.php?facid='.$objet_id; $link='/compta/facture.php?facid='.$objet_id;
break; break;
case 'order': case 'order':
$link='/commande/fiche.php?id='.$objet_id; $link='/commande/fiche.php?id='.$objet_id;
break; break;
case 'order_supplier': case 'order_supplier':
$link='/fourn/commande/fiche.php?id='.$objet_id; $link='/fourn/commande/fiche.php?id='.$objet_id;
break; break;
} }
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $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=$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 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
if ($link) $message.="\n".$urlwithroot.$link; if ($link) $message.="\n".$urlwithroot.$link;
$filename = basename($file); $filename = basename($file);
$mimefile=dol_mimetype($file); $mimefile=dol_mimetype($file);
$msgishtml=0; $msgishtml=0;
$replyto = $conf->notification->email_from; $replyto = $conf->notification->email_from;
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $subject,
$sendto, $sendto,
$replyto, $replyto,
$message, $message,
array($file), array($file),
array($mimefile), array($mimefile),
array($filename[count($filename)-1]), array($filename[count($filename)-1]),
'', '',
'', '',
0, 0,
$msgishtml $msgishtml
); );
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
$now=dol_now(); $now=dol_now();
$sendto = htmlentities($sendto); $sendto = htmlentities($sendto);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; $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)."')"; $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
dol_syslog("Notify::send", LOG_DEBUG); dol_syslog("Notify::send", LOG_DEBUG);
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
else else
{ {
$this->error=$mailfile->error; $this->error=$mailfile->error;
//dol_syslog("Notify::send ".$this->error, LOG_ERR); //dol_syslog("Notify::send ".$this->error, LOG_ERR);
} }
} }
$i++; 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 else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }

View File

@ -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='') 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 $conf, $user, $langs, $db, $hookmanager;
global $begin_h, $end_h, $begin_d, $end_d;
// Filters // Filters
print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; 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>'; 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 // Hooks
$parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid); $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
$reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been

View File

@ -132,7 +132,7 @@ function getServerTimeZoneInt($refgmtdate='now')
* @param int $time Date timestamp (or string with format YYYY-MM-DD) * @param int $time Date timestamp (or string with format YYYY-MM-DD)
* @param int $duration_value Value of delay to add * @param int $duration_value Value of delay to add
* @param int $duration_unit Unit of added delay (d, m, y, w) * @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) 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 $month Month
* @param int $year Year * @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. * @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) 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($tmparray[0])-$seconds;
$tmpday = date("d",$tmpday); $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) if ($tmpday>$day)
{ {
$prev_month = $month-1; $prev_month = $month-1;
@ -522,6 +522,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
$prev_month = $month; $prev_month = $month;
$prev_year = $year; $prev_year = $year;
} }
$tmpmonth = $prev_month;
$tmpyear = $prev_year;
//Get first day of next week //Get first day of next week
$tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0); $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); $tmparray=dol_getdate($tmptime,true);
$prev_day = $tmparray['mday']; $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) if ($prev_day>$tmpday)
{ {
$prev_month = $month-1; $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; if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true;
//Samedi (6) et dimanche (0) //Samedi (6) et dimanche (0)
} }
if ($countrycode == 'ES') if ($countrycode == 'ES')
{ {
$countryfound=1; $countryfound=1;

View File

@ -12,7 +12,7 @@
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * 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 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 $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 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 * @return string||string[] Value found, or '' if check fails
*/ */
function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) 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') * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @return void * @return void
* @see dol_htmloutput_events * @see dol_htmloutput_events
* @deprecated Use setEventMessages instead
*/ */
function setEventMessage($mesgs, $style='mesgs') 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 (! is_array($mesgs)) // If mesgs is a string
{ {
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs; 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). * 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 * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is

View File

@ -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, 'propal'=>13,'boxes'=>14,'banks'=>15,'other'=>16,'errors'=>17,'members'=>18,'ecm'=>19,
'orders'=>20,'users'=>21,'help'=>22,'stocks'=>23,'interventions'=>24, 'orders'=>20,'users'=>21,'help'=>22,'stocks'=>23,'interventions'=>24,
'donations'=>25,'contracts'=>26); '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 * 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 * @return int <0 if KO, Memoy address of shared memory for key
*/ */
function dol_getshmopaddress($memoryid) 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 * 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 * @param string $data Data to save
* @return int <0 if KO, Nb of bytes written if OK * @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 * 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 * @return int <0 if KO, data if OK
*/ */
function dol_getshmop($memoryid) function dol_getshmop($memoryid)

View File

@ -91,7 +91,7 @@ class CommActionRapport
*/ */
function write_file($socid = 0, $catid = 0, $outputlangs='') function write_file($socid = 0, $catid = 0, $outputlangs='')
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs; 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 // 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)) 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); $pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part $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 $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->Close();
$pdf->Output($file,'F'); $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)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@ -85,7 +85,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
*/ */
function write_file($_dir, $number, $outputlangs) function write_file($_dir, $number, $outputlangs)
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs; 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 // 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"; $_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 // Create PDF instance
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part $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 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$nboflines=count($this->lines); $nboflines=count($this->lines);
// Define nb of page // Define nb of page
$pages = intval($nboflines / $this->line_per_page); $pages = intval($nboflines / $this->line_per_page);
if (($nboflines % $this->line_per_page)>0) if (($nboflines % $this->line_per_page)>0)
@ -166,6 +178,18 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->Close(); $pdf->Close();
$pdf->Output($_file,'F'); $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)) if (! empty($conf->global->MAIN_UMASK))
@chmod($_file, octdec($conf->global->MAIN_UMASK)); @chmod($_file, octdec($conf->global->MAIN_UMASK));

View File

@ -184,6 +184,17 @@ class pdf_einstein extends ModelePDFCommandes
if (file_exists($dir)) 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); $nblignes = count($object->lines);
// Create pdf instance // Create pdf instance

View File

@ -183,6 +183,17 @@ class pdf_proforma extends ModelePDFCommandes
if (file_exists($dir)) 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); $nblignes = count($object->lines);
// Create pdf instance // Create pdf instance

View File

@ -106,7 +106,7 @@ class pdf_strato extends ModelePDFContract
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) 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; 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 // 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)) 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); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part $heightforinfotot = 50; // Height reserved to output the info and total part
@ -334,6 +345,18 @@ class pdf_strato extends ModelePDFContract
$pdf->Close(); $pdf->Close();
$pdf->Output($file,'F'); $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)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@ -143,6 +143,17 @@ class pdf_merou extends ModelePdfExpedition
if (file_exists($dir)) 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); $nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format,'mm','l'); $pdf=pdf_getInstance($this->format,'mm','l');
@ -329,6 +340,18 @@ class pdf_merou extends ModelePdfExpedition
$pdf->Close(); $pdf->Close();
$pdf->Output($file,'F'); $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)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@ -129,6 +129,17 @@ class pdf_rouget extends ModelePdfExpedition
if (file_exists($dir)) 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); $nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
@ -331,6 +342,18 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->Close(); $pdf->Close();
$pdf->Output($file,'F'); $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)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@ -184,6 +184,17 @@ class pdf_crabe extends ModelePDFFactures
if (file_exists($dir)) 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); $nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);

View File

@ -137,6 +137,18 @@ class pdf_soleil extends ModelePDFFicheinter
if (file_exists($dir)) 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); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part $heightforinfotot = 50; // Height reserved to output the info and total part

View File

@ -175,6 +175,17 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (file_exists($dir)) 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); $nblines = count($object->lines);
// Create pdf instance // Create pdf instance

View File

@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/** /**
* \class pdf_baleine * Classe permettant de generer les projets au modele Baleine
* \brief Classe permettant de generer les projets au modele Baleine
*/ */
class pdf_baleine extends ModelePDFProjects class pdf_baleine extends ModelePDFProjects
@ -124,6 +123,17 @@ class pdf_baleine extends ModelePDFProjects
if (file_exists($dir)) 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); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part $heightforinfotot = 50; // Height reserved to output the info and total part

View File

@ -212,6 +212,17 @@ class pdf_azur extends ModelePDFPropales
if (file_exists($dir)) 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 // Create pdf instance
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance

View File

@ -95,7 +95,7 @@ class pdf_paiement
$socid=0; $socid=0;
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
if (! is_object($outputlangs)) $outputlangs=$langs; 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 // 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'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@ -119,6 +119,17 @@ class pdf_paiement
$year = sprintf("%04d",$year); $year = sprintf("%04d",$year);
$file = $dir . "/payments-".$year."-".$month.".pdf"; $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); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $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.= " 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."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $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"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
@ -149,7 +160,7 @@ class pdf_paiement
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_paiement = c.id "; $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))."'"; $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; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
} }
@ -228,6 +239,18 @@ class pdf_paiement
$pdf->Close(); $pdf->Close();
$pdf->Output($file,'F'); $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)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@ -184,6 +184,17 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if (file_exists($dir)) 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); $nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);

View File

@ -192,6 +192,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (file_exists($dir)) 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); $nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
@ -490,7 +501,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->Output($file,'F'); $pdf->Output($file,'F');
// Add pdfgeneration hook // Add pdfgeneration hook
$hookmanager->initHooks(array('pdfgeneration')); $hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);

View File

@ -112,7 +112,6 @@ if ($action == 'add')
$classname = ucfirst($object->origin); $classname = ucfirst($object->origin);
$objectsrc = new $classname($db); $objectsrc = new $classname($db);
$objectsrc->fetch($object->origin_id); $objectsrc->fetch($object->origin_id);
//$object->fetch_lines();
$object->socid = $objectsrc->socid; $object->socid = $objectsrc->socid;
$object->ref_customer = $objectsrc->ref_client; $object->ref_customer = $objectsrc->ref_client;
@ -241,7 +240,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$result = $object->valid($user); $result = $object->valid($user);
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
@ -706,7 +705,7 @@ if ($action == 'create')
print '<td colspan="3">'; print '<td colspan="3">';
$expe->fetch_delivery_methods(); $expe->fetch_delivery_methods();
print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1); 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"; print "</td></tr>\n";
// Tracking number // Tracking number
@ -725,7 +724,6 @@ if ($action == 'create')
* Lignes de commandes * Lignes de commandes
*/ */
//$lines = $object->fetch_lines(1);
$numAsked = count($object->lines); $numAsked = count($object->lines);
print '<script type="text/javascript" language="javascript"> 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">'; print '<input type="hidden" name="action" value="setshipping_method_id">';
$object->fetch_delivery_methods(); $object->fetch_delivery_methods();
print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1); 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 '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} }
@ -1581,7 +1579,7 @@ else if ($id || $ref)
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';

View File

@ -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() function fetch_lines()
{ {

View File

@ -63,6 +63,7 @@ $confirm = GETPOST('confirm','alpha');
$mesg = GETPOST('msg','alpha'); $mesg = GETPOST('msg','alpha');
$origin=GETPOST('origin','alpha'); $origin=GETPOST('origin','alpha');
$originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility $originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility
$note_public = GETPOST('note_public');
//PDF //PDF
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $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(); $srcobject->fetch_thirdparty();
$lines = $srcobject->lines; $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; $fk_parent_line=0;
$num=count($lines); $num=count($lines);
@ -328,7 +333,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessages($object->error, $object->errors, 'errors');
$action = 'create'; $action = 'create';
} }
} }
@ -963,15 +968,19 @@ if ($action == 'create')
$classname = ucfirst($subelement); $classname = ucfirst($subelement);
$objectsrc = new $classname($db); $objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid')); $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(); $objectsrc->fetch_thirdparty();
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
$soc = $objectsrc->client; $soc = $objectsrc->client;
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); $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 : ''); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public'));
// Object source contacts list // Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1); $srccontactslist = $objectsrc->liste_contact(-1,'external',1);
@ -979,8 +988,6 @@ if ($action == 'create')
} }
else { else {
$projectid = GETPOST('projectid','int'); $projectid = GETPOST('projectid','int');
$note_private = '';
$note_public = '';
} }
if (! $conf->global->FICHEINTER_ADDON) 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) // 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 '<tr><td valign="top">'.$langs->trans("Description").'</td>';
print '<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>'; print '</td></tr>';
// Project // Project
@ -1214,10 +1221,13 @@ else if ($id > 0 || ! empty($ref))
// Third party // Third party
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>"; print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
// Duration if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
print '<tr><td>'.$langs->trans("TotalDuration").'</td>'; {
print '<td>'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>'; // Duration
print '</tr>'; 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) // Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td valign="top">'; print '<tr><td valign="top">';
@ -1345,7 +1355,7 @@ else if ($id > 0 || ! empty($ref))
else else
{ {
print $extrafields->showOutputField($key,$value); print $extrafields->showOutputField($key,$value);
if ($object->statut == 0 && $user->rights->ficheinter->creer) print ' &nbsp; <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 ' &nbsp; <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_picto('','edit').' '.$langs->trans('Modify').'</a>';
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
@ -1615,7 +1625,7 @@ else if ($id > 0 || ! empty($ref))
} }
// Modify // 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 '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&action=modify"';
print '>'.$langs->trans("Modify").'</a></div>'; print '>'.$langs->trans("Modify").'</a></div>';

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("companies"); $langs->load("companies");
$langs->load("bills");
$langs->load("interventions"); $langs->load("interventions");
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
@ -54,12 +55,15 @@ $limit = $conf->liste_limit;
$search_ref=GETPOST('search_ref','alpha'); $search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company','alpha'); $search_company=GETPOST('search_company','alpha');
$search_desc=GETPOST('search_desc','alpha'); $search_desc=GETPOST('search_desc','alpha');
$search_status=GETPOST('search_status');
/* /*
* View * View
*/ */
$form = new Form($db);
llxHeader(); llxHeader();
@ -83,11 +87,14 @@ if ($search_company) {
if ($search_desc) { if ($search_desc) {
$sql .= natural_search(array('f.description', 'fd.description'), $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)) if (! $user->rights->societe->client->voir && empty($socid))
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) if ($socid)
$sql.= " AND s.rowid = " . $socid; $sql.= " AND s.rowid = " . $socid;
$sql.= " ORDER BY ".$sortfield." ".$sortorder; $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$result=$db->query($sql); $result=$db->query($sql);
@ -100,7 +107,7 @@ if ($result)
$urlparam="&amp;socid=$socid"; $urlparam="&amp;socid=$socid";
print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num); 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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -130,7 +137,11 @@ if ($result)
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</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"; print "</tr>\n";
$companystatic=new Societe($db); $companystatic=new Societe($db);

View File

@ -431,8 +431,8 @@ class CommandeFournisseur extends CommonOrder
/** /**
* Return label of the status of object * 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 * @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 * @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
{ {

View File

@ -364,7 +364,11 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
if ($result > 0) if ($result > 0)
{ {
$lines = $srcobject->lines; $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); $num=count($lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)

View File

@ -1,6 +1,6 @@
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- 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> -- Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 create table llx_c_paiement
( (
id integer PRIMARY KEY, id integer PRIMARY KEY,
code varchar(6) NOT NULL, code varchar(6) NOT NULL,
libelle varchar(30), 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, active tinyint DEFAULT 1 NOT NULL,
accountancy_code varchar(32) NULL, accountancy_code varchar(32) NULL,
module varchar(32) NULL module varchar(32) NULL

View File

@ -1541,3 +1541,4 @@ Opened=Opened
Closed=Closed Closed=Closed
Format=Format Format=Format
TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type

View File

@ -80,8 +80,10 @@ DefaultWorkingHours=Default working hours in day (Example: 9-18)
# External Sites ical # External Sites ical
ExportCal=Export calendar ExportCal=Export calendar
ExtSites=Import external calendars 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 ExtSitesNbOfAgenda=Number of calendars
AgendaExtNb=Calendar nb %s AgendaExtNb=Calendar nb %s
ExtSiteUrlAgenda=URL to access .ical file ExtSiteUrlAgenda=URL to access .ical file
ExtSiteNoLabel=No Description ExtSiteNoLabel=No Description
WorkingTimeRange=Working time range
WorkingDaysRange=Working days range

View File

@ -85,6 +85,7 @@ ClassifyPaid=Classify 'Paid'
ClassifyPaidPartially=Classify 'Paid partially' ClassifyPaidPartially=Classify 'Paid partially'
ClassifyCanceled=Classify 'Abandoned' ClassifyCanceled=Classify 'Abandoned'
ClassifyClosed=Classify 'Closed' ClassifyClosed=Classify 'Closed'
ClassifyUnBilled=Classify 'Unbilled'
CreateBill=Create Invoice CreateBill=Create Invoice
AddBill=Add invoice or credit note AddBill=Add invoice or credit note
AddToDraftInvoices=Add to draft invoice AddToDraftInvoices=Add to draft invoice

View File

@ -240,3 +240,5 @@ PricingRule=Pricing Rules
AddCustomerPrice=Add price by customers AddCustomerPrice=Add price by customers
ForceUpdateChildPriceSoc=Set same price on customer subsidiaries ForceUpdateChildPriceSoc=Set same price on customer subsidiaries
PriceByCustomerLog=Price by customer log PriceByCustomerLog=Price by customer log
MinimumPriceLimit=Minimum price can't be lower that %s
MinimumRecommendedPrice=Minimum recommended price is : %s

View File

@ -19,3 +19,4 @@ TF_TRIP=Trip
ListTripsAndExpenses=List of trips and expenses ListTripsAndExpenses=List of trips and expenses
ExpensesArea=Trips and expenses area ExpensesArea=Trips and expenses area
SearchATripAndExpense=Search a trip and expense SearchATripAndExpense=Search a trip and expense
ClassifyRefunded=Classify 'Refunded'

View File

@ -239,3 +239,5 @@ PricingRule=Règle de prix
AddCustomerPrice=Ajouter prix par clients AddCustomerPrice=Ajouter prix par clients
ForceUpdateChildPriceSoc=Définir le même prix sur les filiales des clients ForceUpdateChildPriceSoc=Définir le même prix sur les filiales des clients
PriceByCustomerLog=Trace des prix par 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

View File

@ -148,7 +148,7 @@ class Livraison extends CommonObject
{ {
$commande = new Commande($this->db); $commande = new Commande($this->db);
$commande->id = $this->commande_id; $commande->id = $this->commande_id;
$this->lines = $commande->fetch_lines(); $commande->fetch_lines();
} }

View File

@ -185,7 +185,7 @@ if ($action == 'builddoc') // En get ou en post
$object = new Livraison($db); $object = new Livraison($db);
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
// Save last template used to generate document // Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
@ -317,7 +317,8 @@ if ($action == 'create')
*/ */
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
$lines = $commande->fetch_lines(1); $commande->fetch_lines(1);
$lines = $commande->lines;
// Lecture des livraisons deja effectuees // Lecture des livraisons deja effectuees
$commande->livraison_array(); $commande->livraison_array();
@ -515,7 +516,7 @@ else
if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0) if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0)
{ {
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("RefSending").'</td>'; print '<tr><td width="20%">'.$langs->trans("RefSending").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
@ -523,8 +524,8 @@ else
//print $form->showrefnav($expedition, 'refshipment', $linkback, 1, 'ref', 'ref'); //print $form->showrefnav($expedition, 'refshipment', $linkback, 1, 'ref', 'ref');
print $form->showrefnav($expedition, 'refshipment', $linkback, 0, 'ref', 'ref'); print $form->showrefnav($expedition, 'refshipment', $linkback, 0, 'ref', 'ref');
print '</td></tr>'; print '</td></tr>';
} }
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$delivery->ref.'</td></tr>'; print '<td colspan="3">'.$delivery->ref.'</td></tr>';

View File

@ -149,7 +149,7 @@ class Opensurveysondage extends CommonObject
// Call trigger // Call trigger
$result=$this->call_trigger('OPENSURVEY_CREATE',$user); $result=$this->call_trigger('OPENSURVEY_CREATE',$user);
if ($result < 0) $error++; if ($result < 0) $error++;
// End call triggers // End call triggers
} }
} }
@ -343,7 +343,7 @@ class Opensurveysondage extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('OPENSURVEY_DELETE',$user); $result=$this->call_trigger('OPENSURVEY_DELETE',$user);
if ($result < 0) $error++; if ($result < 0) $error++;
// End call triggers // End call triggers
} }
} }
@ -387,7 +387,7 @@ class Opensurveysondage extends CommonObject
/** /**
* Return array of lines * Return array of lines
* *
* @return array Array of lines * @return int <0 if KO, >0 if OK
*/ */
function fetch_lines() function fetch_lines()
{ {
@ -413,7 +413,7 @@ class Opensurveysondage extends CommonObject
$this->lines=$ret; $this->lines=$ret;
return $this->lines; return count($this->lines);
} }
/** /**

View File

@ -43,7 +43,7 @@ $object=new Opensurveysondage($db);
$result=$object->fetch(0,$numsondage); $result=$object->fetch(0,$numsondage);
if ($result <= 0) dol_print_error('','Failed to get survey id '.$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 //If the survey has not yet finished, then it can be modified
$canbemodified = ($object->date_fin > dol_now()); $canbemodified = ($object->date_fin > dol_now());

View File

@ -42,7 +42,7 @@ $object=new Opensurveysondage($db);
$result=$object->fetch(0,$numsondage); $result=$object->fetch(0,$numsondage);
if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
$nblignes=count($object->fetch_lines()); $nblignes=$object->fetch_lines();
/* /*

View File

@ -9,6 +9,7 @@
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@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 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 * 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 * 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;
}
}
} }

View File

@ -6,6 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * 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 * 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 * 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); $object = new Product($db);
$error=0;
/* /*
* Actions * Actions
*/ */
@ -59,6 +62,9 @@ $object = new Product($db);
if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
$result = $object->fetch($id); $result = $object->fetch($id);
$error=0;
$maxpricesupplier = $object->min_recommended_price();
// MultiPrix // MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES))
{ {
@ -93,6 +99,13 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit-
$newpsq = empty($newpsq) ? 0 : $newpsq; $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) { if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) {
$action = ''; $action = '';
setEventMessage($langs->trans("RecordSaved")); 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)) { 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'); $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->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); $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) { if (empty($error)) {
setEventMessage($prodcustprice->error, 'errors'); $result = $prodcustprice->create($user, 0, $update_child_soc);
} else {
setEventMessage($langs->trans('Save'), 'mesgs'); 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)) { 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)) { 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'); $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->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
$result = $prodcustprice->update($user, 0, $update_child_soc); if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{
if ($result < 0) { setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
setEventMessage($prodcustprice->error, 'errors'); $error++;
} else { $action='update_customer_price';
setEventMessage($langs->trans('Save'), 'mesgs'); }
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 { } else {
print '<td><input name="price_min" size="10" value="' . price($object->price_min) . '">'; 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 '</td></tr>';
print '</table>'; print '</table>';
@ -660,6 +702,10 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
} else { } else {
print '<td><input name="price_min_' . $i . '" size="10" value="' . price($object->multiprices_min ["$i"]) . '">'; 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 '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '">&nbsp;'; print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '">&nbsp;';
@ -806,6 +852,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if ($action == 'add_customer_price') { if ($action == 'add_customer_price') {
// Create mode // Create mode
$maxpricesupplier = $object->min_recommended_price();
print_fiche_titre($langs->trans('PriceByCustomer')); print_fiche_titre($langs->trans('PriceByCustomer'));
@ -856,6 +903,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} else { } else {
print '<td><input name="price_min" size="10" value="' . price($object->price_min) . '">'; 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 '</td></tr>';
// Update all child soc // Update all child soc
@ -876,6 +927,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} elseif ($action == 'edit_customer_price') { } elseif ($action == 'edit_customer_price') {
// Edit mode // Edit mode
$maxpricesupplier = $object->min_recommended_price();
print_fiche_titre($langs->trans('PriceByCustomer')); print_fiche_titre($langs->trans('PriceByCustomer'));
@ -893,11 +945,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<td>' . $langs->trans('ThirdParty') . '</td>'; print '<td>' . $langs->trans('ThirdParty') . '</td>';
$staticsoc = new Societe($db); $staticsoc = new Societe($db);
$staticsoc->fetch($prodcustprice->fk_soc); $staticsoc->fetch($prodcustprice->fk_soc);
print "<td>" . $staticsoc->getNomUrl(1) . "</td>"; print "<td colspan='2'>" . $staticsoc->getNomUrl(1) . "</td>";
print '</tr>'; print '</tr>';
// VAT // 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 $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly);
print '</td></tr>'; print '</td></tr>';
@ -931,6 +983,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} else { } else {
print '<td><input name="price_min" size="10" value="' . price($prodcustprice->price_min) . '">'; 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>'; print '</td></tr>';
// Update all child soc // Update all child soc

View File

@ -336,6 +336,9 @@ th .button {
.nounderline { .nounderline {
text-decoration: none; text-decoration: none;
} }
.cursorpointer {
cursor: pointer;
}
.blockvmenubookmarks .menu_contenu { .blockvmenubookmarks .menu_contenu {
background-color: transparent; background-color: transparent;
@ -1690,13 +1693,19 @@ td.hidden {display:none;}
table.cal_month { border-spacing: 0px; } 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 { 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 { 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_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; } .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_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_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 { 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 { .cal_today {
background:#ffffff; background:#ffffff;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* 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) 2007-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
@ -233,7 +233,9 @@ div.inline-block
.nounderline { .nounderline {
text-decoration: none; text-decoration: none;
} }
.cursorpointer {
cursor: pointer;
}
/* ============================================================================== */ /* ============================================================================== */
/* Styles to hide objects */ /* Styles to hide objects */
@ -1839,9 +1841,14 @@ td.hidden {
table.cal_month { border-spacing: 0px; } 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 { 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_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 { 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 { 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; } 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; } 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: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:active { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event a:hover { 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; }
/* ============================================================================== */ /* ============================================================================== */

View File

@ -258,6 +258,9 @@ div.inline-block
.nounderline { .nounderline {
text-decoration: none; text-decoration: none;
} }
.cursorpointer {
cursor: pointer;
}
/* ============================================================================== */ /* ============================================================================== */
@ -1938,13 +1941,18 @@ td.hidden {
table.cal_month { border-spacing: 0px; } 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 { 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 { 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_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; } .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_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_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 { 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 { 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 { 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; } 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; } 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; }

View File

@ -234,6 +234,9 @@ div.inline-block
.nounderline { .nounderline {
text-decoration: none; text-decoration: none;
} }
.cursorpointer {
cursor: pointer;
}
/* ============================================================================== */ /* ============================================================================== */
@ -1963,13 +1966,18 @@ td.hidden {
table.cal_month { border-spacing: 0px; } 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 { 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 { 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_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; } .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_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_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 { 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 { 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 { 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; } 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; } 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; }

View File

@ -399,7 +399,9 @@ th .button {
.nounderline { .nounderline {
text-decoration: none; text-decoration: none;
} }
.cursorpointer {
cursor: pointer;
}
/* ============================================================================== */ /* ============================================================================== */
/* Styles to hide objects */ /* Styles to hide objects */
@ -2312,15 +2314,22 @@ td.hidden {
table.cal_month { border-spacing: 0px; } 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 { 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_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 { 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_current_month_right { border-right: solid 1px #E0E0E0; }
.cal_other_month_right { border-right: solid 1px #C0C0C0; } .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_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_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 { 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 { 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_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; 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); -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); 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 */ /* CKEditor */
/* ============================================================================== */ /* ============================================================================== */
.cke_editable .cke_editable
{ {
margin: 5px !important; margin: 5px !important;
} }

View File

@ -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 string $excludefilter Filter to exclude
* @param int $mode 0=Return array of user instance, 1=Return array of users id only * @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 // Call trigger
$result=$this->call_trigger('GROUP_DELETE',$user); $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 // End call triggers
$this->db->commit(); $this->db->commit();
@ -579,7 +579,7 @@ class UserGroup extends CommonObject
if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity; if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity;
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup (";
$sql.= "datec"; $sql.= "datec";
$sql.= ", nom"; $sql.= ", nom";
@ -602,7 +602,7 @@ class UserGroup extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('GROUP_CREATE',$user); $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 // End call triggers
} }
@ -636,7 +636,7 @@ class UserGroup extends CommonObject
} }
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET ";
$sql.= " nom = '" . $this->db->escape($this->nom) . "'"; $sql.= " nom = '" . $this->db->escape($this->nom) . "'";
$sql.= ", entity = " . $this->db->escape($entity); $sql.= ", entity = " . $this->db->escape($entity);
@ -651,11 +651,11 @@ class UserGroup extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('GROUP_MODIFY',$user); $result=$this->call_trigger('GROUP_MODIFY',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
return 1; return 1;