diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index e48dba1c355..1a96bac49ad 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -97,6 +97,12 @@ $modules=array( 'img' => 'user' ) ), + 'expensereport' => array( + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS', + 'img' => 'trip' + ) + ), ); if ($action == 'update') diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index c5d868d02e3..10e9674ec8d 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -538,11 +538,11 @@ if ($id > 0 || ! empty($ref)) print ''; $period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1); - $period_filter .= '
'. $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); + $period_filter .= ' '; + $period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); print ''; - print ' '; - print ''.$period_filter.''; + print ''.$period_filter.''; print ''; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $filtertype=''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7f5b33ee73a..143c93cfe22 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3851,6 +3851,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__REFCLIENT__'] = $object->ref_client; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); + $formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:''); $formmail->substit['__PERSONALIZED__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 773ec79f796..5926d42bb8e 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -191,17 +191,18 @@ if ($result) // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; // Amount - print "".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency).""; - print " "; + print "".price($obj->amount).""; + print ""; print "\n"; $total = $total + $obj->amount; $i++; } + print ''.$langs->trans("Total").''; print ''.price($total,0,$outputlangs,1,-1,-1,$conf->currency).""; - print " "; + print ""; print ""; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ade96390a76..dc3c7fc3640 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -516,9 +516,10 @@ class Contact extends CommonObject */ function fetch($id, $user=0, $ref_ext='') { - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); global $langs; + dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); + if (empty($id) && empty($ref_ext)) { $this->error='BadParameter'; @@ -547,7 +548,6 @@ class Contact extends CommonObject if ($id) $sql.= " WHERE c.rowid = ". $id; elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 58597862f8c..073cd510f8c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2159,11 +2159,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - if (empty($sourceid) && empty($targetid)) + /*if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERR); return -1; - } + }*/ // Links between objects are stored in table element_element $sql = 'SELECT rowid, fk_source, sourcetype, fk_target, targettype'; @@ -3794,7 +3794,7 @@ abstract class CommonObject */ function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') { - global $_POST, $conf; + global $_POST, $conf, $langs; $out = ''; @@ -3852,7 +3852,7 @@ abstract class CommonObject if($extrafields->attribute_required[$key]) $label = ''.$label.''; - $out .= ''.$label.''; + $out .= ''.$langs->trans($label).''; $out .=''; switch($mode) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 13d2881563f..29fed41a6ad 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -474,6 +474,7 @@ class Conf $this->adherent->cotisation = new stdClass(); $this->bank->rappro = new stdClass(); $this->bank->cheque = new stdClass(); + $this->expensereport->payment = new stdClass(); $this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60; $this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60; $this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60; @@ -486,6 +487,7 @@ class Conf $this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60; $this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60; $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; + $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; // For modules that want to disable top or left menu if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index af0c6b91da0..682ddb1b1d1 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -24,12 +24,12 @@ /** * Function get content from an URL (use proxy if proxy defined) * - * @param string $url URL to call. - * @param string $postorget 'POST', 'GET', 'HEAD' - * @param string $param Parameters of URL (x=value1&y=value2) - * @param string $followlocation 1=Follow location, 0=Do not follow - * @param array $addheaders Array of string to add into header. Example: array('Accept: application/xrds+xml', ....) - * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) + * @param string $url URL to call. + * @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'DELETE' + * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED + * @param string $followlocation 1=Follow location, 0=Do not follow + * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) + * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) */ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array()) { @@ -74,7 +74,18 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea else if ($postorget == 'PUT') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' - curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as PUT fields + if (! is_array($param)) parse_str($param, $array_param); + else + { + dol_syslog("parameter param must be a string", LOG_WARNING); + $array_param=$param; + } + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields + } + else if ($postorget == 'PUTALREADYFORMATED') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string } else if ($postorget == 'HEAD') { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 8ed3c312e50..da5be961519 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -744,7 +744,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass // First line of company infos $line1=""; $line2=""; $line3=""; $line4=""; - if ($showdetails && 1) + if ($showdetails) { // Company name if ($fromcompany->name) @@ -788,7 +788,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $line2.=($line2?" - ":"").$fromcompany->email; } } - if (($showdetails && 2) || ($fromcompany->country_code == 'DE')) + if ($showdetails || ($fromcompany->country_code == 'DE')) { // Managers if ($fromcompany->managers) @@ -1707,7 +1707,7 @@ function pdf_getLinkedObjects($object,$outputlangs) foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 7100453cab5..ca8785acdfb 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -49,7 +49,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>' . $label . ''; + print '>' . $langs->trans($label) . ''; //TODO Improve element and rights detection //var_dump($user->rights); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 86d5eb51d18..78ca120516e 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1480,6 +1480,89 @@ class ExpenseReport extends CommonObject return $ret; } + /** + * Charge indicateurs this->nb pour le tableau de bord + * + * @return int <0 if KO, >0 if OK + */ + function load_state_board() + { + global $conf; + + $this->nb=array(); + + $sql = "SELECT count(ex.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; + $sql.= " WHERE ex.fk_statut > 0"; + $sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["expensereports"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + + } + + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @param User $user Objet user + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK + */ + function load_board($user) + { + global $conf, $langs; + + if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + + $now=dol_now(); + + $sql = "SELECT ex.rowid, ex.date_valid"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; + $sql.= " WHERE ex.fk_statut = 5"; + $sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + $langs->load("members"); + + $response = new WorkboardResponse(); + $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24; + $response->label=$langs->trans("ExpenseReportsToPay"); + $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5'; + $response->img=img_object($langs->trans("ExpenseReports"),"user"); + + while ($obj=$this->db->fetch_object($resql)) + { + $response->nbtodo++; + + if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) { + $response->nbtodolate++; + } + } + + return $response; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 78a78195d37..5a1f38806bb 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -4,8 +4,9 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2014 Jean Heimburger + * Copyright (C) 2014 Jean Heimburger * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -262,6 +263,12 @@ if ($object->id > 0) print ""; print ''; + // Categories + print ''; + print '"; + // Other attributes $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/index.php b/htdocs/index.php index 8c37688c0f8..7462b05b3e7 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -158,7 +158,8 @@ if (empty($user->societe_id)) ! empty($conf->facture->enabled) && $user->rights->facture->lire, ! empty($conf->contrat->enabled) && $user->rights->contrat->activer, ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire, - ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire); + ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire, + ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire); // Class file containing the method load_state_board for each line $includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/societe/class/client.class.php", @@ -171,7 +172,8 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php"); + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php"); // Name class containing the method load_state_board for each line $classes=array('Client', 'Client', @@ -184,7 +186,8 @@ if (empty($user->societe_id)) 'Facture', 'Contrat', 'CommandeFournisseur', - 'FactureFournisseur'); + 'FactureFournisseur', + 'ExpenseReport'); // Cle array returned by the method load_state_board for each line $keys=array('customers', 'prospects', @@ -197,7 +200,8 @@ if (empty($user->societe_id)) 'invoices', 'Contracts', 'supplier_orders', - 'supplier_invoices'); + 'supplier_invoices', + 'expensereports'); // Dashboard Icon lines $icons=array('company', 'company', @@ -210,7 +214,8 @@ if (empty($user->societe_id)) 'bill', 'order', 'order', - 'bill'); + 'bill', + 'trip'); // Translation keyword $titres=array("ThirdPartyCustomersStats", "ThirdPartyProspectsStats", @@ -223,7 +228,8 @@ if (empty($user->societe_id)) "BillsCustomers", "Contracts", "SuppliersOrders", - "SuppliersInvoices"); + "SuppliersInvoices", + "ExpenseReports"); // Dashboard Link lines $links=array(DOL_URL_ROOT.'/comm/list.php', DOL_URL_ROOT.'/comm/prospect/list.php', @@ -236,7 +242,8 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy', DOL_URL_ROOT.'/contrat/list.php', DOL_URL_ROOT.'/fourn/commande/list.php', - DOL_URL_ROOT.'/fourn/facture/list.php'); + DOL_URL_ROOT.'/fourn/facture/list.php', + DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'); // Translation lang files $langfile=array("companies", "prospects", @@ -247,7 +254,8 @@ if (empty($user->societe_id)) "propal", "orders", "bills", - "contracts"); + "contracts", + "trips"); // Loop and displays each line of table @@ -402,6 +410,15 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use $dashboardlines[] = $board->load_board($user); } +// Number of expense reports to pay +if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) +{ + include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $board=new ExpenseReport($db); + + $dashboardlines[] = $board->load_board($user); +} + // Calculate total nb of late $totallate=0; $var=true; diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 3b627f3d99b..13604638f01 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -75,6 +75,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_NOT insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0); insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0); insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0); +insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); -- diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql new file mode 100644 index 00000000000..8b64acf2ce8 --- /dev/null +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -0,0 +1,25 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 3.9.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To restrict request to Mysql version x.y use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + +INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); + +ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); +ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); diff --git a/htdocs/install/mysql/tables/llx_accounting_system.sql b/htdocs/install/mysql/tables/llx_accounting_system.sql index 50a9c66b054..b0be95c7666 100644 --- a/htdocs/install/mysql/tables/llx_accounting_system.sql +++ b/htdocs/install/mysql/tables/llx_accounting_system.sql @@ -21,7 +21,7 @@ create table llx_accounting_system ( rowid integer AUTO_INCREMENT PRIMARY KEY, - pcg_version varchar(12) NOT NULL, + pcg_version varchar(32) NOT NULL, fk_pays integer NOT NULL, label varchar(128) NOT NULL, active smallint DEFAULT 0 diff --git a/htdocs/install/mysql/tables/llx_accountingaccount.sql b/htdocs/install/mysql/tables/llx_accountingaccount.sql index f4e4d694471..3847ce91811 100644 --- a/htdocs/install/mysql/tables/llx_accountingaccount.sql +++ b/htdocs/install/mysql/tables/llx_accountingaccount.sql @@ -24,7 +24,7 @@ create table llx_accountingaccount entity integer DEFAULT 1 NOT NULL, datec datetime, tms timestamp, - fk_pcg_version varchar(12) NOT NULL, + fk_pcg_version varchar(32) NOT NULL, pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, account_number varchar(32) NOT NULL, diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 3b54b6d9714..c6f4f316a04 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -102,3 +102,5 @@ ConfirmSaveTrip=Are you sure you want to validate this expense report ? NoTripsToExportCSV=No expense report to export for this period. ExpenseReportPayment=Expense report payment + +ExpenseReportsToPay=Expense reports to pay diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 9e8cd7acef3..96e4c955cd6 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -204,7 +204,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Label - print ''; + print ''; print ''; // Nature diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 52c69b16ec6..21bfad54f0e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -660,9 +660,16 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $origin = new FactureFournisseur($this->db); break; - + default: - return ''; + if ($origintype) + { + dol_include_once ('/'.$origintype.'/class/'.$origintype.'.class.php'); + $classname = ucfirst($origintype); + $origin = new $classname($this->db); + } + else + return ''; break; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index f983e5db5fe..5ef872e3185 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -347,7 +347,7 @@ $langs->load("margins"); //print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; -print '
' . $langs->trans("Categories") . ''; + print $form->showCategories($object->id, 'supplier', 1); + print "
'.$langs->trans("Label").''.$object->libelle.'
'.$langs->trans("Label").''.$object->label.'
'; +print '
'; print ''; print ''; print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 864f507494a..b80f0f2c086 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1,14 +1,15 @@ - * Copyright (C) 2003 Brian Fraval - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2011-2013 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Marcos García +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2003 Brian Fraval + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2011-2013 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -411,7 +412,7 @@ if (empty($reshook)) } } - // Categories association + // Customer categories association $custcats = GETPOST( 'custcats', 'array' ); if (!empty( $custcats )) { $cat = new Categorie( $db ); @@ -421,6 +422,16 @@ if (empty($reshook)) } } + // Supplier categories association + $suppcats = GETPOST('suppcats', 'array'); + if (!empty($suppcats)) { + $cat = new Categorie($db); + foreach ($suppcats as $id_category) { + $cat->fetch($id_category); + $cat->add_type($object, 'supplier'); + } + } + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -525,7 +536,7 @@ if (empty($reshook)) $error = $object->error; $errors = $object->errors; } - // Categories association + // Customer categories association // First we delete all categories association $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_societe'; $sql .= ' WHERE fk_soc = ' . $object->id; @@ -541,6 +552,22 @@ if (empty($reshook)) } } + // Supplier categories association + // First we delete all categories association + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_fournisseur'; + $sql .= ' WHERE fk_soc = ' . $object->id; + $db->query($sql); + + // Then we add the associated categories + $categories = GETPOST('suppcats', 'array'); + if (!empty($categories)) { + $cat = new Categorie($db); + foreach ($categories as $id_category) { + $cat->fetch($id_category); + $cat->add_type($object, 'supplier'); + } + } + // Logo/Photo save $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -1245,13 +1272,26 @@ else } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - print '"; - } + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print '"; + } + + // Supplier + if ($object->fournisseur) { + print '"; + } + } // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); @@ -1761,19 +1801,36 @@ else } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - print ''; - print ''; + print '"; } - print $form->multiselectarray( 'custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); - print ""; - } + + // Supplier + if ($object->fournisseur) { + print ''; + print '"; + } + } // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); @@ -2207,13 +2264,24 @@ else } // Tags / categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - print ''; - print '"; - } + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print ''; + print '"; + } + + // Supplier + if ($object->fournisseur) { + print ''; + print '"; + } + } // Incoterms if (!empty($conf->incoterm->enabled))
'.$langs->trans("Element").''.$langs->trans("Number").'
'.fieldLabel('Categories','custcats').''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); - print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); - print "
' . fieldLabel('CustomersCategoriesShort', 'custcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, + null, "90%"); + print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); + print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, + null, "90%"); + print "
'.fieldLabel('Categories', 'custcats').''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_CUSTOMER, null, null, null, null, 1); - $c = new Categorie( $db ); - $cats = $c->containing( $object->id, Categorie::TYPE_CUSTOMER ); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print '
' . fieldLabel('CustomersCategoriesShort', 'custcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print "
' . $langs->trans( "Categories" ) . ''; - print $form->showCategories( $object->id, 'customer', 1 ); - print "
' . $langs->trans("CustomersCategoriesShort") . ''; + print $form->showCategories($object->id, 'customer', 1); + print "
' . $langs->trans("SuppliersCategoriesShort") . ''; + print $form->showCategories($object->id, 'supplier', 1); + print "