diff --git a/ChangeLog b/ChangeLog
index e09d9adbceb..d9c7b362e3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,15 +8,19 @@ For users:
- New: [ task #867 ] Remove ESAEB external module code from core.
- New: Can create proposal from an intervention.
- New: Can filter events on a group of users.
-- New: Add thirdparty to filter on events.
+- New: Can filter events of a thirdparty.
+- New: Split Agenda view (month, week, day) into different tabs.
- New: Form to add a photo is immediatly available on photo page if
permissions are ok (save one click per photo to add).
- New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos
shown on main product card.
- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to
create an automatic event into agenda.
-- New: Add new type of event (when type of events are used, not by
- default)
+- New: Add new type of event (when type of events are used, not by default)
+- New: Add country into table of thirdparties type. This will allow to provide
+ a list of thirdparty types specific to a country (like argentina that
+ need type A or B).
+- New: Can force a specific bank account onto an invoice/order...
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem
@@ -26,6 +30,13 @@ For users:
- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action
- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action
- Fix: [ bug #1505, #1504] Project trigger problem
+- Fix: [ bug #1463, #1464 ] Proposal triggers problem
+- Fix: [ bug #1498, #1499 ] Shipment/Delivery triggers problem
+- Fix: [ bug #1465, #1466 ] Product triggers problem
+- Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message
+- Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action
+- Fix: [ bug #1506, #1507 ] ECM trigger error problem
+- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
- New: [ task #1204 ] add a ref_int contract field
For translators:
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index 0aaafa461fb..eff3f85fdf6 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -137,15 +137,15 @@ print "\n";
$var=false;
print "
";
print '
';
-print $langs->trans("Ref").':
';
+print ':
';
print '
';
print "
";
print '
';
-print $langs->trans("Name").':
';
+print ':
';
print '
';
print "
";
print '
';
-print $langs->trans("Other").':
';
+print ':
';
print '
';
print "";
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 656158a19cd..788483196e4 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -130,16 +130,16 @@ $tablib[24]= "DictionaryAccountancysystem";
$tablib[25]= "DictionaryRevenueStamp";
$tablib[26]= "DictionaryResourceType";
-// Requete pour extraction des donnees des dictionnaires
+// Requests to extract data
$tabsql=array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.code as country_code, p.libelle as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_pays as p WHERE f.fk_pays=p.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, p.code as country_code, p.libelle as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid and r.active=1 and p.active=1";
-$tabsql[3] = "SELECT r.rowid as rowid, code_region as code, nom as libelle, r.fk_pays as country_id, p.code as country_code, p.libelle as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
+$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, p.code as country_code, p.libelle as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
$tabsql[4] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_pays";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.civilite AS libelle, c.active FROM ".MAIN_DB_PREFIX."c_civilite AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, p.code as country_code, p.libelle as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_pays as p WHERE a.fk_pays=p.rowid and p.active=1";
-$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent";
+$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, p.code as country_code, p.libelle as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON t.fk_country=p.rowid";
$tabsql[9] = "SELECT code_iso as code, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p WHERE t.fk_pays=p.rowid";
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
@@ -159,7 +159,7 @@ $tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.c
$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_pays as p WHERE t.fk_pays=p.rowid";
$tabsql[26]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
-// Critere de tri du dictionnaire
+// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[1] ="country ASC, code ASC";
$tabsqlsort[2] ="country ASC, code ASC";
@@ -168,7 +168,7 @@ $tabsqlsort[4] ="code ASC";
$tabsqlsort[5] ="libelle ASC";
$tabsqlsort[6] ="a.type ASC, a.module ASC, a.position ASC, a.code ASC";
$tabsqlsort[7] ="country ASC, code ASC, a.libelle ASC";
-$tabsqlsort[8] ="libelle ASC";
+$tabsqlsort[8] ="country DESC, libelle ASC";
$tabsqlsort[9] ="label ASC";
$tabsqlsort[10]="country ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
$tabsqlsort[11]="element ASC, source ASC, code ASC";
@@ -197,7 +197,7 @@ $tabfield[4] = "code,libelle";
$tabfield[5] = "code,libelle";
$tabfield[6] = "code,libelle,type,position";
$tabfield[7] = "code,libelle,country_id,country,accountancy_code,deductible";
-$tabfield[8] = "code,libelle";
+$tabfield[8] = "code,libelle,country_id,country";
$tabfield[9] = "code,label,unicode";
$tabfield[10]= "country_id,country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[11]= "element,source,code,libelle";
@@ -226,7 +226,7 @@ $tabfieldvalue[4] = "code,libelle";
$tabfieldvalue[5] = "code,libelle";
$tabfieldvalue[6] = "code,libelle,type,position";
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
-$tabfieldvalue[8] = "code,libelle";
+$tabfieldvalue[8] = "code,libelle,country";
$tabfieldvalue[9] = "code,label,unicode";
$tabfieldvalue[10]= "country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[11]= "element,source,code,libelle";
@@ -255,7 +255,7 @@ $tabfieldinsert[4] = "code,libelle";
$tabfieldinsert[5] = "code,civilite";
$tabfieldinsert[6] = "code,libelle,type,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
-$tabfieldinsert[8] = "code,libelle";
+$tabfieldinsert[8] = "code,libelle,fk_country";
$tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[11]= "element,source,code,libelle";
@@ -428,7 +428,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
- if ($value == 'country' && in_array('region_id',$listfield)) continue; // For region page, we do not require the country input
+ if ($value == 'country' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
+ if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
@@ -473,9 +474,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).' ';
}*/
}
- if (isset($_POST["country"]) && $_POST["country"]=='0') {
- $ok=0;
- setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors');
+ if (isset($_POST["country"]) && $_POST["country"]=='0')
+ {
+ if (in_array($tablib[$id],array('DictionaryCompanyType')))
+ {
+ $_POST["country"]='';
+ }
+ else
+ {
+ $ok=0;
+ setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors');
+ }
}
// Clean some parameters
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 0fd1a57f5ef..b3c66fb6a3c 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -1023,8 +1023,6 @@ else // View by day
}
-$db->close();
-
/* TODO Export
print '
@@ -1041,6 +1039,8 @@ $("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format
llxFooter();
+$db->close();
+
/**
* Show event of a particular day
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
new file mode 100644
index 00000000000..7bd0edafe69
--- /dev/null
+++ b/htdocs/comm/action/peruser.php
@@ -0,0 +1,480 @@
+
+ * Copyright (C) 2003 Eric Seigne
+ * Copyright (C) 2004-2014 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2011 Juanjo Menent
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+
+/**
+ * \file htdocs/comm/action/peruser.php
+ * \ingroup agenda
+ * \brief Tab of calendar events per user
+ */
+
+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.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
+if (! empty($conf->projet->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+}
+
+if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
+
+$filter=GETPOST("filter",'',3);
+$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","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);
+$usergroup = GETPOST("usergroup","int",3);
+$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
+
+
+$sortfield = GETPOST("sortfield",'alpha');
+$sortorder = GETPOST("sortorder",'alpha');
+$page = GETPOST("page","int");
+if ($page == -1) { $page = 0; }
+$limit = $conf->liste_limit;
+$offset = $limit * $page;
+if (! $sortorder) $sortorder="ASC";
+if (! $sortfield) $sortfield="a.datec";
+
+// Security check
+$socid = GETPOST("socid","int");
+if ($user->societe_id) $socid=$user->societe_id;
+$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
+if ($socid < 0) $socid='';
+
+$canedit=1;
+if (! $user->rights->agenda->myactions->read) accessforbidden();
+if (! $user->rights->agenda->allactions->read) $canedit=0;
+if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
+{
+ $filtera=$user->id;
+ $filtert=$user->id;
+ $filterd=$user->id;
+}
+
+$action=GETPOST('action','alpha');
+//$year=GETPOST("year");
+$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
+$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
+$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
+$day=GETPOST("day","int")?GETPOST("day","int"):0;
+$pid=GETPOST("projectid","int",3);
+$status=GETPOST("status");
+$type=GETPOST("type");
+$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
+$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':'');
+
+if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
+if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
+
+if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') {
+ $action='show_month'; $day='';
+} // View by month
+if (GETPOST('viewweek') || $action == 'show_week') {
+ $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
+} // View by week
+if (GETPOST('viewday') || $action == 'show_day') {
+ $action='show_day'; $day=($day?$day:date("d"));
+} // View by day
+
+
+$langs->load("agenda");
+$langs->load("other");
+$langs->load("commercial");
+
+// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
+$hookmanager->initHooks(array('agenda'));
+
+
+/*
+ * Actions
+ */
+
+// None
+
+
+/*
+ * View
+ */
+
+$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
+llxHeader('',$langs->trans("Agenda"),$help_url);
+
+$form=new Form($db);
+$companystatic=new Societe($db);
+$contactstatic=new Contact($db);
+
+$now=dol_now();
+$nowarray=dol_getdate($now);
+$nowyear=$nowarray['year'];
+$nowmonth=$nowarray['mon'];
+$nowday=$nowarray['mday'];
+
+// Define list of all external calendars
+$listofextcals=array();
+if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
+{
+ $i=0;
+ while($i < $conf->global->AGENDA_EXT_NB)
+ {
+ $i++;
+ $source='AGENDA_EXT_SRC'.$i;
+ $name='AGENDA_EXT_NAME'.$i;
+ $color='AGENDA_EXT_COLOR'.$i;
+ $buggedfile='AGENDA_EXT_BUGGEDFILE'.$i;
+ if (! empty($conf->global->$source) && ! empty($conf->global->$name))
+ {
+ // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
+ $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0));
+ }
+ }
+}
+
+
+if (empty($action) || $action=='show_month')
+{
+ $prev = dol_get_prev_month($month, $year);
+ $prev_year = $prev['year'];
+ $prev_month = $prev['month'];
+ $next = dol_get_next_month($month, $year);
+ $next_year = $next['year'];
+ $next_month = $next['month'];
+
+ $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month
+ $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month
+ // tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday)
+ $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2;
+ $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
+ if ($tmpday >= 1) $tmpday -= 7;
+ // Define firstdaytoshow and lastdaytoshow
+ $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
+ $next_day=7-($max_day_in_month+1-$tmpday)%7;
+ if ($next_day < 6) $next_day+=7;
+ $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
+}
+if ($action=='show_week')
+{
+ $prev = dol_get_first_day_week($day, $month, $year);
+ $prev_year = $prev['prev_year'];
+ $prev_month = $prev['prev_month'];
+ $prev_day = $prev['prev_day'];
+ $first_day = $prev['first_day'];
+
+ $week = $prev['week'];
+
+ $day = (int) $day;
+ $next = dol_get_next_week($day, $week, $month, $year);
+ $next_year = $next['year'];
+ $next_month = $next['month'];
+ $next_day = $next['day'];
+
+ // Define firstdaytoshow and lastdaytoshow
+ $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
+ $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
+
+ $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'.$next_year.'-'.$next_month.'-'.$next_day;
+//print dol_print_date($firstdaytoshow,'day');
+//print dol_print_date($lastdaytoshow,'day');
+
+$title=$langs->trans("DoneAndToDoActions");
+if ($status == 'done') $title=$langs->trans("DoneActions");
+if ($status == 'todo') $title=$langs->trans("ToDoActions");
+
+$param='';
+if ($status) $param="&status=".$status;
+if ($filter) $param.="&filter=".$filter;
+if ($filtera) $param.="&filtera=".$filtera;
+if ($filtert) $param.="&filtert=".$filtert;
+if ($filterd) $param.="&filterd=".$filterd;
+if ($socid) $param.="&socid=".$socid;
+if ($showbirthday) $param.="&showbirthday=1";
+if ($pid) $param.="&projectid=".$pid;
+if ($actioncode != '') $param.="&actioncode=".$actioncode;
+if ($type) $param.="&type=".$type;
+if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action;
+$param.="&maxprint=".$maxprint;
+
+// Show navigation bar
+if (empty($action) || $action=='show_month')
+{
+ $nav ="".img_previous($langs->trans("Previous"))."\n";
+ $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y");
+ $nav.=" \n";
+ $nav.="".img_next($langs->trans("Next"))."\n";
+ $nav.=" (".$langs->trans("Today").")";
+ $picto='calendar';
+}
+if ($action=='show_week')
+{
+ $nav ="".img_previous($langs->trans("Previous"))."\n";
+ $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week;
+ $nav.=" \n";
+ $nav.="".img_next($langs->trans("Next"))."\n";
+ $nav.=" (".$langs->trans("Today").")";
+ $picto='calendarweek';
+}
+if ($action=='show_day')
+{
+ $nav ="".img_previous($langs->trans("Previous"))."\n";
+ $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort");
+ $nav.=" \n";
+ $nav.="".img_next($langs->trans("Next"))."\n";
+ $nav.=" (".$langs->trans("Today").")";
+ $picto='calendarday';
+}
+
+// Must be after the nav definition
+$param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
+//print 'x'.$param;
+
+
+
+
+$tabactive='cardperuser';
+
+$paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
+
+$head = calendars_prepare_head($paramnoaction);
+
+dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
+print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals,$actioncode,$usergroup);
+dol_fiche_end();
+
+print_fiche_titre($s,$link.' '.$nav, '');
+
+
+// Get event in an array
+$eventarray=array();
+
+$sql = 'SELECT a.id,a.label,';
+$sql.= ' a.datep,';
+$sql.= ' a.datep2,';
+$sql.= ' a.datea,';
+$sql.= ' a.datea2,';
+$sql.= ' a.percent,';
+$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
+$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
+$sql.= ' a.fk_soc, a.fk_contact,';
+$sql.= ' ca.code';
+$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
+if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
+if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
+$sql.= ' WHERE a.fk_action = ca.id';
+$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
+if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
+if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
+if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
+if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
+if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action";
+if ($action == 'show_day')
+{
+ $sql.= " AND (";
+ $sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
+ $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
+ $sql.= " OR ";
+ $sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
+ $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
+ $sql.= " OR ";
+ $sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
+ $sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
+ $sql.= ')';
+}
+else
+{
+ // To limit array
+ $sql.= " AND (";
+ $sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
+ $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
+ $sql.= " OR ";
+ $sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
+ $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
+ $sql.= " OR ";
+ $sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
+ $sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
+ $sql.= ')';
+}
+if ($type) $sql.= " AND ca.id = ".$type;
+if ($status == '0') { $sql.= " AND a.percent = 0"; }
+if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
+if ($status == '50') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // Running
+if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
+if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
+if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
+{
+ $sql.= " AND (";
+ if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
+ if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
+ if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
+ if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
+ $sql.= ")";
+}
+// Sort on date
+$sql.= ' ORDER BY datep';
+//print $sql;
+
+dol_syslog("comm/action/index.php", LOG_DEBUG);
+$resql=$db->query($sql);
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+ $i=0;
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($resql);
+
+ // Create a new object action
+ $event=new ActionComm($db);
+ $event->id=$obj->id;
+ $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
+ $event->datef=$db->jdate($obj->datep2);
+ $event->type_code=$obj->code;
+ $event->libelle=$obj->label;
+ $event->percentage=$obj->percent;
+ $event->author->id=$obj->fk_user_author; // user id of creator
+ $event->usertodo->id=$obj->fk_user_action; // user id of owner
+ $event->userdone->id=$obj->fk_user_done; // deprecated
+ // $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event
+ $event->priority=$obj->priority;
+ $event->fulldayevent=$obj->fulldayevent;
+ $event->location=$obj->location;
+ $event->transparency=$obj->transparency;
+
+ $event->societe->id=$obj->fk_soc;
+ $event->contact->id=$obj->fk_contact;
+
+ // Defined date_start_in_calendar and date_end_in_calendar property
+ // They are date start and end of action but modified to not be outside calendar view.
+ if ($event->percentage <= 0)
+ {
+ $event->date_start_in_calendar=$event->datep;
+ if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
+ else $event->date_end_in_calendar=$event->datep;
+ }
+ else
+ {
+ $event->date_start_in_calendar=$event->datep;
+ if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
+ else $event->date_end_in_calendar=$event->datep;
+ }
+ // Define ponctual property
+ if ($event->date_start_in_calendar == $event->date_end_in_calendar)
+ {
+ $event->ponctuel=1;
+ }
+
+ // Check values
+ if ($event->date_end_in_calendar < $firstdaytoshow ||
+ $event->date_start_in_calendar > $lastdaytoshow)
+ {
+ // This record is out of visible range
+ }
+ else
+ {
+ if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
+ if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
+
+ // Add an entry in actionarray for each day
+ $daycursor=$event->date_start_in_calendar;
+ $annee = date('Y',$daycursor);
+ $mois = date('m',$daycursor);
+ $jour = date('d',$daycursor);
+
+ // Loop on each day covered by action to prepare an index to show on calendar
+ $loop=true; $j=0;
+ $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
+ do
+ {
+ //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.' ';
+
+ $eventarray[$daykey][]=$event;
+ $j++;
+
+ $daykey+=60*60*24;
+ if ($daykey > $event->date_end_in_calendar) $loop=false;
+ }
+ while ($loop);
+
+ //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef);
+ //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array ';
+ }
+ $i++;
+
+ }
+}
+else
+{
+ dol_print_error($db);
+}
+
+$maxnbofchar=18;
+$cachethirdparties=array();
+$cachecontacts=array();
+
+// Define theme_datacolor array
+$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
+if (is_readable($color_file))
+{
+ include_once $color_file;
+}
+if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220));
+
+
+
+
+/* TODO Export
+ print '
+
+
+
+
+
+';
+*/
+
+llxFooter();
+
+$db->close();
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 98653992025..eada82f7f6a 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -78,9 +78,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '
';
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 54ad75515f7..307164556c7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1080,6 +1080,36 @@ abstract class CommonObject
}
+ /**
+ * Change the bank account
+ *
+ * @param int $fk_account Id of bank account
+ * @return int 1 if OK, 0 if KO
+ */
+ function setBankAccount($fk_account)
+ {
+ if (! $this->table_element) {
+ dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined",LOG_ERR);
+ return -1;
+ }
+ if ($fk_account<0) $fk_account='NULL';
+ dol_syslog(get_class($this).'::setBankAccount('.$fk_account.')');
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql.= " SET fk_account = ".$fk_account;
+ $sql.= " WHERE rowid=".$this->id;
+
+ if ($this->db->query($sql)) {
+ $this->fk_account = ($fk_account=='NULL')?null:$fk_account;
+ return 1;
+ } else {
+ dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
+ $this->error=$this->db->error();
+ return 0;
+ }
+ }
+
+
/**
* Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined.
@@ -2714,21 +2744,21 @@ abstract class CommonObject
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '
';
// Description
- print '
'.$langs->trans('Description').'
';
+ print '
';
// VAT
- print '
'.$langs->trans('VAT').'
';
+ print '
';
// Price HT
- print '
'.$langs->trans('PriceUHT').'
';
+ print '
';
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '
';
// Qty
- print '
'.$langs->trans('Qty').'
';
+ print '
';
// Reduction short
- print '
'.$langs->trans('ReductionShort').'
';
+ print '
';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php
index dd039b71015..eea64ed10ac 100644
--- a/htdocs/core/class/ctypent.class.php
+++ b/htdocs/core/class/ctypent.class.php
@@ -156,7 +156,8 @@ class Ctypent // extends CommonObject
$sql = "SELECT";
$sql.= " t.id,";
$sql.= " t.code,";
- $sql.= " t.libelle,";
+ $sql.= " t.libelle as label,";
+ $sql.= " t.fk_country as country_id,";
$sql.= " t.active,";
$sql.= " t.module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_typent as t";
@@ -173,7 +174,8 @@ class Ctypent // extends CommonObject
$this->id = $obj->id;
$this->code = $obj->code;
- $this->libelle = $obj->libelle;
+ $this->libelle = $obj->label;
+ $this->country_id = $obj->country_id;
$this->active = $obj->active;
$this->module = $obj->module;
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 1e7f0bb8246..d1b338176a4 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2480,6 +2480,40 @@ class Form
}
}
+ /**
+ * Display form to select bank account
+ *
+ * @param string $page Page
+ * @param int $selected Id of bank account
+ * @param string $htmlname Name of select html field
+ * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
+ * @return void
+ */
+ function formSelectAccount($page, $selected='', $htmlname='fk_account', $addempty=0)
+ {
+ global $langs;
+ if ($htmlname != "none") {
+ print '';
+ } else {
+ if ($selected) {
+ require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
+ $bankstatic=new Account($this->db);
+ $bankstatic->fetch($selected);
+ print $bankstatic->label.' ('.$bankstatic->currency_code.')';
+ } else {
+ print " ";
+ }
+ }
+ }
+
/**
* Return list of categories having choosed type
*
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index d71c26af29c..7728080c01b 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -57,13 +57,13 @@ class FormCompany
*/
function typent_array($mode=0, $filter='')
{
- global $langs;
+ global $langs,$mysoc;
$effs = array();
$sql = "SELECT id, code, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_typent";
- $sql.= " WHERE active = 1";
+ $sql.= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id)?'0':$mysoc->country_id).")";
if ($filter) $sql.=" ".$filter;
$sql.= " ORDER by id";
dol_syslog(get_class($this).'::typent_array', LOG_DEBUG);
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 4201cde9e9d..3c37a79b7dd 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -659,6 +659,49 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true;
//Samedi (6) et dimanche (0)
}
+
+ if ($countrycode == 'ES')
+ {
+ $countryfound=1;
+
+ // Definition des dates feriees fixes
+ if($jour == 1 && $mois == 1) $ferie=true; // Año nuevo
+ if($jour == 6 && $mois == 1) $ferie=true; // Día Reyes
+ if($jour == 1 && $mois == 5) $ferie=true; // 1 Mayo
+ if($jour == 15 && $mois == 8) $ferie=true; // 15 Agosto
+ if($jour == 12 && $mois == 10) $ferie=true; // Día Hispanidad
+ if($jour == 1 && $mois == 11) $ferie=true; // 1 noviembre
+ if($jour == 6 && $mois == 12) $ferie=true; // Constitución
+ if($jour == 8 && $mois == 12) $ferie=true; // Inmaculada
+ if($jour == 25 && $mois == 12) $ferie=true; // 25 diciembre
+
+ // Calcul día de Pascua
+ $date_paques = easter_date($annee);
+ $jour_paques = date("d", $date_paques);
+ $mois_paques = date("m", $date_paques);
+ if($jour_paques == $jour && $mois_paques == $mois) $ferie=true;
+ // Paques
+
+ // Viernes Santo
+ $date_viernes = mktime(
+ date("H", $date_paques),
+ date("i", $date_paques),
+ date("s", $date_paques),
+ date("m", $date_paques),
+ date("d", $date_paques) -2,
+ date("Y", $date_paques)
+ );
+ $jour_viernes = date("d", $date_viernes);
+ $mois_viernes = date("m", $date_viernes);
+ if($jour_viernes == $jour && $mois_viernes == $mois) $ferie=true;
+ //Viernes Santo
+
+ // Calul des samedis et dimanches
+ $jour_julien = unixtojd($timestampStart);
+ $jour_semaine = jddayofweek($jour_julien, 0);
+ if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true;
+ //Samedi (6) et dimanche (0)
+ }
// Cas pays non defini
if (! $countryfound)
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index bb67e863667..efd0b46d6b4 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -77,7 +77,7 @@ $(document).ready(function () {
';
+
// Status
$alreadypaid=$object->getSommePaiement();
print '
'.$langs->trans('Status').'
'.$object->getLibStatut(4,$alreadypaid).'
';
@@ -2131,7 +2160,7 @@ else
// Make payments
if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0)
{
- print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice
+ print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice
}
// Classify paid
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 8ff312202f3..0e39f591bdd 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -1670,12 +1670,12 @@ class Holiday extends CommonObject
// Filtrage de séléction
if(!empty($filter)) {
- $sql.= $filter;
+ $sql.= " ".$filter;
}
// Ordre d'affichage
if(!empty($order)) {
- $sql.= $order;
+ $sql.= " ".$order;
}
dol_syslog(get_class($this)."::fetchLog", LOG_DEBUG);
diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php
index d66d1c8cfbd..93b426b5ad3 100644
--- a/htdocs/holiday/fiche.php
+++ b/htdocs/holiday/fiche.php
@@ -3,6 +3,7 @@
* Copyright (C) 2012-2013 Laurent Destailleur
* Copyright (C) 2012 Regis Houssin
* Copyright (C) 2013 Juanjo Menent
+ * Copyright (C) 2014 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -111,7 +112,7 @@ if ($action == 'create')
// Si aucun jours ouvrés dans la demande
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
- if($nbopenedday < 1)
+ if($nbopenedday < 0.5)
{
header('Location: fiche.php?action=request&error=DureeHoliday');
exit;
@@ -208,7 +209,7 @@ if ($action == 'update')
// Si pas de jours ouvrés dans la demande
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
- if ($nbopenedday < 1)
+ if ($nbopenedday < 0.5)
{
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday');
exit;
@@ -398,7 +399,7 @@ if($action == 'confirm_valid')
if ($verif > 0)
{
// Calculcate number of days consummed
- $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1);
+ $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday);
$soldeActuel = $cp->getCpforUser($cp->fk_user);
$newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted'));
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index a3d58458d43..063fefd62e0 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.php
@@ -152,6 +152,7 @@ if ($memmaxorig != '')
preg_match('/([0-9]+)([a-zA-Z]*)/i',$memmax,$reg);
if ($reg[2])
{
+ if (strtoupper($reg[2]) == 'G') $memmax=$reg[1]*1024*1024*1024;
if (strtoupper($reg[2]) == 'M') $memmax=$reg[1]*1024*1024;
if (strtoupper($reg[2]) == 'K') $memmax=$reg[1]*1024;
}
diff --git a/htdocs/install/mysql/data/llx_c_typent.sql b/htdocs/install/mysql/data/llx_c_typent.sql
index 154798cdd4f..8349cd13a5a 100644
--- a/htdocs/install/mysql/data/llx_c_typent.sql
+++ b/htdocs/install/mysql/data/llx_c_typent.sql
@@ -27,17 +27,19 @@
--
--
--- Types entreprises
+-- Types of thirdparties
--
delete from llx_c_typent;
-insert into llx_c_typent (id,code,libelle,active) values ( 0, 'TE_UNKNOWN', '-', 1);
-insert into llx_c_typent (id,code,libelle,active) values ( 1, 'TE_STARTUP', 'Start-up', 0);
-insert into llx_c_typent (id,code,libelle,active) values ( 2, 'TE_GROUP', 'Grand groupe', 1);
-insert into llx_c_typent (id,code,libelle,active) values ( 3, 'TE_MEDIUM', 'PME/PMI', 1);
-insert into llx_c_typent (id,code,libelle,active) values ( 4, 'TE_SMALL', 'TPE', 1);
-insert into llx_c_typent (id,code,libelle,active) values ( 5, 'TE_ADMIN', 'Administration',1);
-insert into llx_c_typent (id,code,libelle,active) values ( 6, 'TE_WHOLE', 'Grossiste', 0);
-insert into llx_c_typent (id,code,libelle,active) values ( 7, 'TE_RETAIL', 'Revendeur', 0);
-insert into llx_c_typent (id,code,libelle,active) values ( 8, 'TE_PRIVATE', 'Particulier', 1);
-insert into llx_c_typent (id,code,libelle,active) values (100, 'TE_OTHER', 'Autres', 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 0, 'TE_UNKNOWN', '-', NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 1, 'TE_STARTUP', 'Start-up', NULL, 0);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 2, 'TE_GROUP', 'Grand groupe', NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 3, 'TE_MEDIUM', 'PME/PMI', NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 4, 'TE_SMALL', 'TPE', NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 5, 'TE_ADMIN', 'Administration',NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 6, 'TE_WHOLE', 'Grossiste', NULL, 0);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 7, 'TE_RETAIL', 'Revendeur', NULL, 0);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A1', 'Type A', 23, 1);
+insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B2', 'Type B', 23, 1);
diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
index 956f034a695..7796813b732 100644
--- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
+++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
@@ -21,9 +21,14 @@
ALTER TABLE llx_c_paiement ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER active;
-insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (29,'FICHINTER_CLASSIFY_BILLED','Classify intervention as billed','Executed when a intervention is classified as billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19);
+-- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
+ALTER TABLE llx_c_typent ADD COLUMN fk_country integer NULL AFTER libelle;
+
+INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (29,'FICHINTER_CLASSIFY_BILLED','Classify intervention as billed','Executed when a intervention is classified as billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19);
+
+INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4);
+
-insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4);
ALTER TABLE llx_accountingaccount add column entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_accountingaccount add column datec datetime NOT NULL AFTER entity;
@@ -97,6 +102,8 @@ ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_user_author FOREI
ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_product (fk_product);
ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
+ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_account integer AFTER date_livraison;
+ALTER TABLE llx_facture_fourn ADD COLUMN fk_account integer AFTER fk_projet;
-- Fiscal years
create table llx_accounting_fiscalyear
@@ -113,4 +120,4 @@ create table llx_accounting_fiscalyear
fk_user_modif integer NULL
)ENGINE=innodb;
-ALTER TABLE llx_contrat ADD COLUMN ref_int varchar(30) after ref;
\ No newline at end of file
+ALTER TABLE llx_contrat ADD COLUMN ref_ext varchar(30) after ref;
diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql
index 62d39cea8ad..06a41727b69 100644
--- a/htdocs/install/mysql/tables/llx_c_typent.sql
+++ b/htdocs/install/mysql/tables/llx_c_typent.sql
@@ -19,9 +19,10 @@
create table llx_c_typent
(
- id integer PRIMARY KEY,
- code varchar(12) NOT NULL,
- libelle varchar(30),
- active tinyint DEFAULT 1 NOT NULL,
- module varchar(32) NULL
+ id integer PRIMARY KEY,
+ code varchar(12) NOT NULL,
+ libelle varchar(30),
+ fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
+ active tinyint DEFAULT 1 NOT NULL,
+ module varchar(32) NULL
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql
index 51e57452397..d8076c1c06c 100644
--- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql
+++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql
@@ -55,6 +55,7 @@ create table llx_commande_fournisseur
model_pdf varchar(255),
date_livraison date default NULL,
+ fk_account integer, -- bank account
fk_cond_reglement integer, -- condition de reglement
fk_mode_reglement integer, -- mode de reglement
fk_input_method integer default 0,
diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql
index 3af6d5928dc..9cef8fddb42 100644
--- a/htdocs/install/mysql/tables/llx_contrat.sql
+++ b/htdocs/install/mysql/tables/llx_contrat.sql
@@ -22,7 +22,7 @@ create table llx_contrat
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30), -- contrat reference
- ref_int varchar(30), -- internal contract ref
+ ref_ext varchar(30), -- external contract ref
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp,
datec datetime, -- creation date
diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql
index c980d43e40f..2bb85f8400e 100644
--- a/htdocs/install/mysql/tables/llx_facture_fourn.sql
+++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql
@@ -58,6 +58,7 @@ create table llx_facture_fourn
fk_facture_source integer, -- facture origine si facture avoir
fk_projet integer, -- projet auquel est associee la facture
+ fk_account integer, -- bank account
fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...)
fk_mode_reglement integer, -- mode de reglement (CHQ, VIR, ...)
date_lim_reglement date, -- date limite de reglement
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index fd3f8979532..00d2521c309 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -296,7 +296,7 @@ CurrentVersion=Dolibarr current version
CallUpdatePage=Go to the page that updates the database structure and datas: %s.
LastStableVersion=Last stable version
GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used: {000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask. {000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s. {000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required. {dd} day (01 to 31). {mm} month (01 to 12). {yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
-GenericMaskCodes2={cccc} the client code on n characters {cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter. {tttt} The code of company type on n characters (see dictionary-company types).
+GenericMaskCodes2={cccc} the client code on n characters {cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter. {tttt} The code of thirdparty type on n characters (see dictionary-thirdparty types).
GenericMaskCodes3=All other characters in the mask will remain intact. Spaces are not allowed.
GenericMaskCodes4a=Example on the 99th %s of the third party TheCompany done 2007-01-31:
GenericMaskCodes4b=Example on third party created on 2007-03-01:
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 399050d0547..c46e333c191 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -446,15 +446,12 @@ class Livraison extends CommonObject
return -1;
}
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
- $interface = new Interfaces($this->db);
- $result = $interface->run_triggers('DELIVERY_VALIDATE', $this, $user, $langs, $conf);
- // Fin appel triggers
+ // Call trigger
+ $result=$this->call_trigger('DELIVERY_VALIDATE',$user);
+ // End call triggers
if ($result < 0)
{
$this->db->rollback();
- $this->error = $interface->errors;
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
return -1;
}
@@ -604,14 +601,14 @@ class Livraison extends CommonObject
}
}
- // Call triggers
- include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
- $interface=new Interfaces($this->db);
- $result=$interface->run_triggers('DELIVERY_DELETE',$this,$user,$langs,$conf);
- if ($result < 0) {
- $error++; $this->errors=$interface->errors;
- }
- // End call triggers
+ // Call trigger
+ $result=$this->call_trigger('DELIVERY_DELETE',$user);
+ if ($result < 0)
+ {
+ $this->db->rollback();
+ return -4;
+ }
+ // End call triggers
return 1;
}
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index bdaaffdafe3..f35d493a485 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1800,18 +1800,21 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput
global $conf,$langs;
$ret='';
- $ret.='