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

Conflicts:
	htdocs/comm/action/card.php
	htdocs/compta/paiement/list.php
	htdocs/core/class/commonobject.class.php
	htdocs/mrp/mo_list.php
	htdocs/projet/tasks/task.php
	htdocs/public/payment/newpayment.php
This commit is contained in:
Laurent Destailleur 2021-09-20 17:15:12 +02:00
commit deb1965cd5
45 changed files with 1023 additions and 713 deletions

View File

@ -121,8 +121,8 @@ class AccountancyExport
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinumv3'),
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinumv5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
@ -527,14 +527,19 @@ class AccountancyExport
}
/**
* Export format : Quadratus
* Export format : Quadratus (Format ASCII)
* Format since 2015 compatible QuadraCOMPTA
* Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr)
*
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
*
* @param array $TData data
* @return void
*/
public function exportQuadratus(&$TData)
{
global $conf;
global $conf, $db;
$end_line = "\r\n";
@ -547,6 +552,44 @@ class AccountancyExport
$code_compta = $data->subledger_account;
}
$Tab = array();
if (!empty($data->subledger_account)) {
$Tab['type_ligne'] = 'C';
$Tab['num_compte'] = str_pad(self::trunc($data->subledger_account, 8), 8);
$Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30);
if ($data->doc_type == 'customer_invoice') {
$Tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc($data->subledger_label, 6), 6));
$Tab['filler'] = str_repeat(' ', 52);
$Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8);
} elseif ($data->doc_type == 'supplier_invoice') {
$Tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc($data->subledger_label, 6), 6));
$Tab['filler'] = str_repeat(' ', 52);
$Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8);
} else {
$Tab['filler'] = str_repeat(' ', 59);
$Tab['coll_compte'] = str_pad(' ', 8);
}
$Tab['filler2'] = str_repeat(' ', 110);
$Tab['Maj'] = 2; // Partial update (alpha key, label, address, collectif, RIB)
if ($data->doc_type == 'customer_invoice') {
$Tab['type_compte'] = 'C';
} elseif ($data->doc_type == 'supplier_invoice') {
$Tab['coll_compte'] = 'F';
} else {
$Tab['coll_compte'] = 'G';
}
$Tab['filler3'] = str_repeat(' ', 235);
$Tab['end_line'] = $end_line;
print implode($Tab);
}
$Tab = array();
$Tab['type_ligne'] = 'M';
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);

View File

@ -71,6 +71,9 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
if ($object->id > 0) {
$object->calculateCosts();
}
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
@ -305,8 +308,6 @@ if (($id || $ref) && $action == 'edit') {
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$res = $object->fetch_optionals();
$head = bomPrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');

View File

@ -98,7 +98,7 @@ class BOM extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
@ -381,7 +381,7 @@ class BOM extends CommonObject
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
$this->calculateCosts();
//$this->calculateCosts(); // This consume a high number of subrequests. Do not call it into fetch but when you need it.
return $result;
}
@ -1035,7 +1035,8 @@ class BOM extends CommonObject
}
/**
* BOM costs calculation based on cost_price or pmp of each BOM line
* BOM costs calculation based on cost_price or pmp of each BOM line.
* Set the property ->total_cost and ->unit_cost of BOM.
*
* @return void
*/
@ -1045,30 +1046,36 @@ class BOM extends CommonObject
$this->unit_cost = 0;
$this->total_cost = 0;
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
foreach ($this->lines as &$line) {
if (is_array($this->lines) && count($this->lines)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$tmpproduct = new Product($this->db);
$result = $tmpproduct->fetch($line->fk_product);
if ($result < 0) {
$this->error = $tmpproduct->error;
return -1;
}
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
if (empty($line->unit_cost)) {
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
$line->unit_cost = $productFournisseur->fourn_unitprice;
foreach ($this->lines as &$line) {
$tmpproduct->cost_price = 0;
$tmpproduct->pmp = 0;
$result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
if ($result < 0) {
$this->error = $tmpproduct->error;
return -1;
}
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
if (empty($line->unit_cost)) {
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
$line->unit_cost = $productFournisseur->fourn_unitprice;
}
}
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
$this->total_cost += $line->total_cost;
}
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
$this->total_cost += $line->total_cost;
}
$this->total_cost = price2num($this->total_cost, 'MT');
if ($this->qty) {
$this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
$this->total_cost = price2num($this->total_cost, 'MT');
if ($this->qty) {
$this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
}
}
}
}

View File

@ -735,13 +735,14 @@ class ActionComm extends CommonObject
/**
* Load object from database
*
* @param int $id Id of action to get
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @return int <0 if KO, >0 if OK
* @param int $id Id of action to get
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @param string $loadresources 1=Load also resources
* @return int <0 if KO, >0 if OK
*/
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '')
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
{
global $langs;
@ -858,7 +859,11 @@ class ActionComm extends CommonObject
$this->event_paid = $obj->event_paid;
$this->status = $obj->status;
$this->fetchResources();
$this->fetch_optionals();
if ($loadresources) {
$this->fetchResources();
}
}
$this->db->free($resql);
} else {

View File

@ -6,7 +6,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
*
@ -31,13 +31,6 @@
*/
require '../../main.inc.php';
// Security check
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'facture', $facid, '');
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -57,6 +50,10 @@ $facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int');
$userid = GETPOST('userid', 'int');
// Security check
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $facid, '');
$search_ref = GETPOST("search_ref", "alpha");
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');

View File

@ -1733,6 +1733,18 @@ abstract class CommonObject
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the project with id $this->fk_project into this->project
*
* @return int <0 if KO, >=0 if OK
*/
public function fetch_project()
{
// phpcs:enable
return $this->fetch_projet();
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the project with id $this->fk_project into this->project
@ -7329,7 +7341,11 @@ abstract class CommonObject
dol_include_once($InfoFieldList[1]);
if ($classname && class_exists($classname)) {
$object = new $classname($this->db);
$object->fetch($value);
if ($object->element === 'product') { // Special cas for product because default valut of fetch are wrong
$object->fetch($value, '', '', '', 0, 1, 1);
} else {
$object->fetch($value);
}
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
}
} else {

View File

@ -73,6 +73,18 @@ class FormAdmin
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
// If the language to select is not inside the list of available language and empty value is not available, we must find
// an alternative as the language code to pre-select (to avoid to have first element in list pre-selected).
if ($selected && !in_array($selected, $langs_available) && empty($showempty)) {
$tmparray = explode('_', $selected);
if (!empty($tmparray[1])) {
$selected = getLanguageCodeFromCountryCode($tmparray[1]);
}
if (empty($selected)) {
$selected = $langs->defaultlang;
}
}
$out = '';
$out .= '<select '.($multiselect ? 'multiple="multiple" ' : '').'class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($disabled ? ' disabled' : '').'>';

View File

@ -8230,8 +8230,8 @@ function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0)
* Return default language from country code.
* Return null if not found.
*
* @param string $countrycode Country code like 'US', 'FR', 'CA', 'ES', 'MX', ...
* @return string Value of locale like 'en_US', 'fr_FR', ...
* @param string $countrycode Country code like 'US', 'FR', 'CA', 'ES', 'IN', 'MX', ...
* @return string Value of locale like 'en_US', 'fr_FR', ... or null if not found
*/
function getLanguageCodeFromCountryCode($countrycode)
{
@ -8281,12 +8281,12 @@ function getLanguageCodeFromCountryCode($countrycode)
'ar-SY',
'ar-TN',
'ar-YE',
'as-IN',
//'as-IN', // Moved after en-IN
'ba-RU',
'be-BY',
'bg-BG',
'bn-BD',
'bn-IN',
//'bn-IN', // Moved after en-IN
'bo-CN',
'br-FR',
'ca-ES',
@ -8307,6 +8307,8 @@ function getLanguageCodeFromCountryCode($countrycode)
'en-GB',
'en-IE',
'en-IN',
'as-IN', // as-IN must be after en-IN (en in priority if country is IN)
'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN)
'en-JM',
'en-MY',
'en-NZ',
@ -8444,7 +8446,7 @@ function getLanguageCodeFromCountryCode($countrycode)
$locale_language = locale_get_primary_language($locale);
$locale_region = locale_get_region($locale);
if (strtoupper($countrycode) == $locale_region) {
//var_dump($locale.'-'.$locale_language.'-'.$locale_region);
//var_dump($locale.' - '.$locale_language.' - '.$locale_region);
return strtolower($locale_language).'_'.strtoupper($locale_region);
}
}
@ -8884,7 +8886,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if ($newcrit != '') {
$numnewcrit = price2num($newcrit);
if (is_numeric($numnewcrit)) {
$newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$db->sanitize($numnewcrit); // should be a numeric
$newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.((float) $numnewcrit); // should be a numeric
} else {
$newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false
}
@ -8943,7 +8945,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
$newres .= $field." = ".(is_numeric(trim($tmpcrit)) ?trim($tmpcrit) : '0');
$newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? ((float) trim($tmpcrit)) : '0');
} else {
$newres .= $field." LIKE '";

View File

@ -106,8 +106,8 @@ class ConferenceOrBooth extends ActionComm
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),

View File

@ -103,14 +103,15 @@ class ConferenceOrBoothAttendee extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project'),
'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>3,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>-1, 'visible'=>-2),
@ -126,6 +127,7 @@ class ConferenceOrBoothAttendee extends CommonObject
public $fk_actioncomm;
public $email;
public $date_subscription;
public $fk_invoice;
public $amount;
public $note_public;
public $note_private;
@ -634,6 +636,31 @@ class ConferenceOrBoothAttendee extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the project with id $this->fk_project into this->project
*
* @return int <0 if KO, >=0 if OK
*/
public function fetch_projet()
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (empty($this->fk_project) && !empty($this->fk_projet)) {
$this->fk_project = $this->fk_projet; // For backward compatibility
}
if (empty($this->fk_project)) {
return 0;
}
$project = new Project($this->db);
$result = $project->fetch($this->fk_project);
$this->projet = $project; // deprecated
$this->project = $project;
return $result;
}
/**
* Set draft status
@ -836,6 +863,17 @@ class ConferenceOrBoothAttendee extends CommonObject
return $result;
}
/**
* Return the label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLabelStatus($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
/**
* Return the label of the status
*

View File

@ -152,8 +152,6 @@ if (empty($reshook)) {
/*
* View
*
* Put here all code to build page
*/
$form = new Form($db);

View File

@ -55,6 +55,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
$id = GETPOST('id', 'int');
$projectid = GETPOST('projectid', 'int');
$projectref = GETPOST('ref');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -152,12 +153,12 @@ if (!$permissiontoread) accessforbidden();
* Actions
*/
if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && !empty($user->rights->eventorganization->write)) {
$project = new Project($db);
//If "set" fields keys is in projects fields
$project_attr=preg_replace('/^set/', '', $action);
if (array_key_exists($project_attr, $project->fields)) {
$result = $project->fetch($projectid);
$result = $project->fetch($projectid, $projectref);
if ($result < 0) {
setEventMessages(null, $project->errors, 'errors');
} else {
@ -234,11 +235,13 @@ $now = dol_now();
$help_url = '';
$title = $langs->trans('ListOfConferencesOrBooths');
if ($projectid > 0) {
if ($projectid > 0 || $projectref) {
$project = new Project($db);
$result = $project->fetch($projectid);
$result = $project->fetch($projectid, $projectref);
if ($result < 0) {
setEventMessages(null, $project->errors, 'errors');
} else {
$projectid = $project->id;
}
$result = $project->fetch_thirdparty();
if ($result < 0) {
@ -430,8 +433,8 @@ if ($projectid > 0) {
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5');
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id);
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -447,8 +450,8 @@ if ($projectid > 0) {
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$project->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5');
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.((int) $project->id).'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -582,7 +585,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.$id);
header("Location: ".DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.((int) $id));
exit;
}

View File

@ -48,7 +48,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$conf_or_booth_id = GETPOST('conforboothid', 'int');
$fk_project = GETPOST('fk_project', 'int');
$withproject = GETPOST('withproject', 'int');
$withproject = 1;
// Initialize technical objects
$object = new ConferenceOrBoothAttendee($db);
@ -65,6 +65,7 @@ if ($conf_or_booth_id > 0) {
} else {
$object->fk_actioncomm = $confOrBooth->id;
$object->fk_project = $confOrBooth->fk_project;
$fk_project = $object->fk_project;
}
}
@ -74,12 +75,24 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
}
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
if (empty($action) && empty($id) && empty($ref)) {
@ -174,8 +187,6 @@ if (empty($reshook)) {
/*
* View
*
* Put here all code to build page
*/
$form = new Form($db);
@ -305,7 +316,7 @@ if (!empty($withproject)) {
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -319,7 +330,7 @@ if (!empty($withproject)) {
print "</td></tr>";
}
print '<tr><td>';
print '<tr><td class="nowrap">';
$typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
$htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
@ -336,15 +347,15 @@ if (!empty($withproject)) {
print "</td></tr>";
print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
@ -353,7 +364,7 @@ if (!empty($withproject)) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message = '<a target="_blank" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message;
@ -366,7 +377,7 @@ if (!empty($withproject)) {
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -383,7 +394,7 @@ if (!empty($withproject)) {
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -559,6 +570,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
$keyforbreak = 'note_public';
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';

View File

@ -97,7 +97,7 @@ if (!$sortorder) {
}
// Initialize array of search criterias
$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
@ -369,8 +369,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
}
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
@ -646,22 +644,25 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
}
} else {
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($confOrBooth->id > 0) {
$param .= '&conforboothid='.urlencode($confOrBooth->id).$withProjectUrl;
$param .= '&conforboothid='.urlencode($confOrBooth->id);
}
if ($projectstatic->id > 0) {
$param .= '&fk_project='.urlencode($projectstatic->id).$withProjectUrl;
$param .= '&fk_project='.urlencode($projectstatic->id);
}
$param .= $withProjectUrl;
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
@ -694,6 +695,8 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd);

View File

@ -409,16 +409,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($sall) {
$param .= "&amp;sall=".urlencode($sall);
$param .= "&sall=".urlencode($sall);
}
if ($search_ref_exp) {
$param .= "&amp;search_ref_exp=".urlencode($search_ref_exp);
$param .= "&search_ref_exp=".urlencode($search_ref_exp);
}
if ($search_ref_liv) {
$param .= "&amp;search_ref_liv=".urlencode($search_ref_liv);
$param .= "&search_ref_liv=".urlencode($search_ref_liv);
}
if ($search_ref_customer) {
$param .= "&amp;search_ref_customer=".urlencode($search_ref_customer);
$param .= "&search_ref_customer=".urlencode($search_ref_customer);
}
if ($search_user > 0) {
$param .= '&search_user='.urlencode($search_user);
@ -427,13 +427,13 @@ if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
if ($search_company) {
$param .= "&amp;search_company=".urlencode($search_company);
$param .= "&search_company=".urlencode($search_company);
}
if ($search_shipping_method_id) {
$param .= "&amp;search_shipping_method_id=".urlencode($search_shipping_method_id);
}
if ($search_tracking) {
$param .= "&amp;search_tracking=".urlencode($search_tracking);
$param .= "&search_tracking=".urlencode($search_tracking);
}
if ($search_town) {
$param .= '&search_town='.urlencode($search_town);
@ -789,7 +789,7 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['e.ref']['checked'])) {
print "<td>";
print '<td class="nowraponall">';
print $shipment->getNomUrl(1);
print "</td>\n";
if (!$i) {
@ -809,7 +809,7 @@ while ($i < min($num, $limit)) {
// Third party
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td>';
print '<td class="tdoverflowmax150">';
print $companystatic->getNomUrl(1);
print '</td>';
if (!$i) {
@ -827,7 +827,7 @@ while ($i < min($num, $limit)) {
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
print '<td class="nocellnopadd center">';
print $obj->zip;
print '</td>';
if (!$i) {
@ -836,7 +836,7 @@ while ($i < min($num, $limit)) {
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
print '<td class="center">'.$obj->state_name."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -2440,7 +2440,7 @@ class FactureFournisseur extends CommonInvoice
if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?search_option=late&mainmenu=billing&leftmenu=suppliers_bills';
}
}
$this->db->free($resql);

View File

@ -119,7 +119,7 @@ $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_categ_sup = trim(GETPOST("search_categ_sup", 'int'));
$option = GETPOST('option');
$option = GETPOST('search_option');
if ($option == 'late') {
$search_status = '1';
}
@ -803,7 +803,7 @@ if ($resql) {
$param .= '&show_files='.urlencode($show_files);
}
if ($option) {
$param .= "&option=".urlencode($option);
$param .= "&search_option=".urlencode($option);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
@ -1428,9 +1428,9 @@ if ($resql) {
// Date limit
if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
print '<td class="center nowrap">'.dol_print_date($datelimit, 'day');
print '<td class="center nowraponall">'.dol_print_date($datelimit, 'day');
if ($facturestatic->hasDelay()) {
print img_warning($langs->trans('Late'));
print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
}
print '</td>';
if (!$i) {

View File

@ -48,6 +48,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've
$socid = GETPOST('socid', 'int');
// Security check
if ($user->socid) $socid = $user->socid;
$search_ref = GETPOST('search_ref', 'alpha');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');

View File

@ -403,6 +403,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
fk_soc integer,
fk_actioncomm integer,
fk_project integer NOT NULL,
fk_invoice integer NULL,
email varchar(100),
date_subscription datetime,
amount double DEFAULT NULL,
@ -422,6 +423,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);

View File

@ -343,7 +343,7 @@ Modelcsv_ciel=Export for Sage50, Ciel Compta or Compta Evo. (Format XIMPORT)
Modelcsv_quadratus=Export for Quadratus QuadraCompta
Modelcsv_ebp=Export for EBP
Modelcsv_cogilog=Export for Cogilog
Modelcsv_agiris=Export for Agiris
Modelcsv_agiris=Export for Agiris Isacompta
Modelcsv_LDCompta=Export for LD Compta (v9) (Test)
Modelcsv_LDCompta10=Export for LD Compta (v10 & higher)
Modelcsv_openconcerto=Export for OpenConcerto (Test)
@ -351,9 +351,10 @@ Modelcsv_configurable=Export CSV Configurable
Modelcsv_FEC=Export FEC
Modelcsv_FEC2=Export FEC (With dates generation writing / document reversed)
Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland
Modelcsv_winfic=Export Winfic - eWinfic - WinSis Compta
Modelcsv_winfic=Export for Winfic - eWinfic - WinSis Compta
Modelcsv_Gestinumv3=Export for Gestinum (v3)
Modelcsv_Gestinumv5Export for Gestinum (v5)
Modelcsv_Gestinumv5=Export for Gestinum (v5)
Modelcsv_charlemagne=Export for Aplim Charlemagne
ChartofaccountsId=Chart of accounts Id
## Tools - Init accounting account on product / service

View File

@ -155,3 +155,7 @@ PaymentConferenceAttendee = Conference attendee payment
PaymentBoothLocation = Booth location payment
RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email <b>%s</b>
EmailAttendee=Attendee email
EmailCompanyForInvoice=Company email (for invoice, if different of attendee email)
ErrorSeveralCompaniesWithEmailContactUs=Several companies with this email has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation
ErrorSeveralCompaniesWithNameContactUs=Several companies with this name has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation

View File

@ -6,6 +6,7 @@ Language_ar_MA=Arabic (Moroco)
Language_ar_SA=Arabic
Language_ar_TN=Arabic (Tunisia)
Language_ar_IQ=Arabic (Iraq)
Language_as_IN=Assamese
Language_az_AZ=Azerbaijani
Language_bn_BD=Bengali
Language_bn_IN=Bengali (India)

View File

@ -1040,6 +1040,18 @@ if (!defined('NOLOGIN')) {
$user->rights->user->user->supprimer = 1;
$user->rights->user->self->creer = 1;
$user->rights->user->self->password = 1;
//Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$user->rights->user->user_advance->readperms = 1;
$user->rights->user->user_advance->write = 1;
$user->rights->user->self_advance->readperms = 1;
$user->rights->user->self_advance->writeperms = 1;
$user->rights->user->group_advance->read = 1;
$user->rights->user->group_advance->readperms = 1;
$user->rights->user->group_advance->write = 1;
$user->rights->user->group_advance->delete = 1;
}
}
/*

View File

@ -847,6 +847,17 @@ class MyObject extends CommonObject
return $result;
}
/**
* Return the label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLabelStatus($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
/**
* Return the label of the status
*

View File

@ -135,7 +135,7 @@ if (!$sortorder) {
}
// Initialize array of search criterias
$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
@ -432,9 +432,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
}
} else {
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}

View File

@ -84,7 +84,7 @@ if (!$sortorder) {
}
// Initialize array of search criterias
$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
@ -270,8 +270,7 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val)
{
foreach($object->fields as $key => $val) {
$sql .= "t.".$key.", ";
}
// Add fields from extrafields
@ -343,9 +342,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
}
} else {
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}

View File

@ -121,6 +121,7 @@ class Partnership extends CommonObject
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,),
'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,),
// fk_member and fk_soc are added into constructor
);
/**
@ -197,9 +198,9 @@ class Partnership extends CommonObject
$this->db = $db;
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
$this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member');
$this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150');
} else {
$this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company');
$this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'csslist'=>'tdoverflowmax150');
}
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {

View File

@ -223,7 +223,7 @@ if ($resql) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("LatestModifiedProjects", $max).'</th>';
print '<th colspan="5">'.$langs->trans("LatestModifiedProjects", $max).'</th>';
print '</tr>';
$num = $db->num_rows($resql);
@ -277,12 +277,22 @@ if ($resql) {
print '</td>';
// Label
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->title).'">';
print $projectstatic->title;
print '</td>';
// Thirdparty
print '<td class="nowrap">';
if ($companystatic->id > 0) {
print $companystatic->getNomUrl(1, 'company', 16);
}
print '</td>';
// Date
print '<td>'.dol_print_date($db->jdate($obj->datem), 'day').'</td>';
// Status
print '<td class="right">'.$projectstatic->LibStatut($obj->status, 3).'</td>';
print '</tr>';
$i++;

View File

@ -47,13 +47,6 @@ $withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : '');
// Security check
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (!$user->rights->projet->lire) {
accessforbidden();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('projecttaskcommentcard', 'globalcard'));
@ -79,10 +72,21 @@ if (!empty($project_ref) && !empty($withproject)) {
}
}
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
// Security check
$socid = 0;
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
/*
* View
*/
*/
llxHeader('', $langs->trans("CommentPage"));

View File

@ -40,17 +40,18 @@ $confirm = GETPOST('confirm', 'alpha');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
// Security check
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
//$result = restrictedArea($user, 'projet', $id, 'projet_task');
if (!$user->rights->projet->lire) {
accessforbidden();
}
$object = new Task($db);
$projectstatic = new Project($db);
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
// Security check
$socid = 0;
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
/*
* Actions

View File

@ -37,21 +37,13 @@ $langs->loadLangs(array('projects', 'other'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
$mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
// Security check
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
//$result=restrictedArea($user,'projet',$id,'');
if (!$user->rights->projet->lire) {
accessforbidden();
}
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -73,6 +65,17 @@ if (!$sortfield) {
$object = new Task($db);
$projectstatic = new Project($db);
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
// Security check
$socid = 0;
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
/*
* Actions
*/
@ -92,25 +95,21 @@ if (!empty($project_ref) && !empty($withproject)) {
}
if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref) > 0) {
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
$object->fetchComments();
}
$projectstatic->fetch($object->fk_project);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
$object->project = clone $projectstatic;
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
} else {
dol_print_error($db);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
$object->fetchComments();
}
$projectstatic->fetch($object->fk_project);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
$object->project = clone $projectstatic;
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
}
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';

View File

@ -31,7 +31,7 @@ $langs->load('projects');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
$mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@ -85,6 +85,12 @@ if (!empty($project_ref) && !empty($withproject)) {
}
}
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
$permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->creer);

View File

@ -46,13 +46,6 @@ $withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : '');
// Security check
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (!$user->rights->projet->lire) {
accessforbidden();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('projecttaskcard', 'globalcard'));
@ -69,6 +62,17 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
// Security check
$socid = 0;
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
/*
* Actions
*/
@ -85,7 +89,6 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}
if (!$error) {
$object->fetch($id, $ref);
$object->oldcopy = clone $object;
$tmparray = explode('_', $_POST['task_parent']);
@ -121,17 +124,15 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
}
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer) {
if ($object->fetch($id, $ref) >= 0) {
$result = $projectstatic->fetch($object->fk_project);
$projectstatic->fetch_thirdparty();
$result = $projectstatic->fetch($object->fk_project);
$projectstatic->fetch_thirdparty();
if ($object->delete($user) > 0) {
header('Location: '.DOL_URL_ROOT.'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ? '&withproject=1' : ''));
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
if ($object->delete($user) > 0) {
header('Location: '.DOL_URL_ROOT.'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ? '&withproject=1' : ''));
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
@ -149,8 +150,6 @@ if (!empty($project_ref) && !empty($withproject)) {
// Build doc
if ($action == 'builddoc' && $user->rights->projet->creer) {
$object->fetch($id, $ref);
// Save last template used to generate document
if (GETPOST('model')) {
$object->setDocModel($user, GETPOST('model', 'alpha'));
@ -172,17 +171,15 @@ if ($action == 'builddoc' && $user->rights->projet->creer) {
if ($action == 'remove_file' && $user->rights->projet->creer) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($object->fetch($id, $ref) >= 0) {
$langs->load("other");
$upload_dir = $conf->projet->dir_output;
$file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
$langs->load("other");
$upload_dir = $conf->projet->dir_output;
$file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
$ret = dol_delete_file($file);
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
$ret = dol_delete_file($file);
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
}
@ -198,449 +195,447 @@ $formother = new FormOther($db);
$formfile = new FormFile($db);
if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref) > 0) {
$res = $object->fetch_optionals();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
$object->fetchComments();
$res = $object->fetch_optionals();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
$object->fetchComments();
}
$result = $projectstatic->fetch($object->fk_project);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
$object->project = clone $projectstatic;
//$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
if (!empty($withproject)) {
// Tabs for project
$tab = 'tasks';
$head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
$param = ($mode == 'mine' ? '&mode=mine' : '');
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Title
$morehtmlref .= $projectstatic->title;
// Thirdparty
if ($projectstatic->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref.
if (!$user->rights->projet->all->lire) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
$result = $projectstatic->fetch($object->fk_project);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
$object->project = clone $projectstatic;
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
//$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
print '<table class="border tableforfield centpercent">';
if (!empty($withproject)) {
// Tabs for project
$tab = 'tasks';
$head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
$param = ($mode == 'mine' ? '&mode=mine' : '');
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Title
$morehtmlref .= $projectstatic->title;
// Thirdparty
if ($projectstatic->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
$morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref.
if (!$user->rights->projet->all->lire) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
if (!empty($conf->eventorganization->enabled)) {
print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print '</td></tr>';
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) {
print $langs->trans('SharedProject');
} else {
print $langs->trans('PrivateProject');
if (!empty($conf->eventorganization->enabled)) {
print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print '</td></tr>';
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
$start = dol_print_date($projectstatic->date_start, 'day');
print ($start ? $start : '?');
$end = dol_print_date($projectstatic->date_end, 'day');
print ' - ';
print ($end ? $end : '?');
if ($projectstatic->hasDelay()) {
print img_warning("Late");
}
print '</td></tr>';
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) {
print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
}
print '</td></tr>';
// Other attributes
$cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description);
print '</td></tr>';
// Categories
if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id, 'project', 1);
print "</td></tr>";
}
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print '<br>';
}
/*
* Actions
*/
/*print '<div class="tabsAction">';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) {
print $langs->trans('SharedProject');
} else {
print $langs->trans('PrivateProject');
}
print '</td></tr>';
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
{
if ($projectstatic->public || $userWrite > 0)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create'.$param.'">'.$langs->trans('AddTask').'</a>';
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
$start = dol_print_date($projectstatic->date_start, 'day');
print ($start ? $start : '?');
$end = dol_print_date($projectstatic->date_end, 'day');
print ' - ';
print ($end ? $end : '?');
if ($projectstatic->hasDelay()) {
print img_warning("Late");
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTask').'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
print '</td></tr>';
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) {
print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
}
print '</td></tr>';
// Other attributes
$cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
*/
// To verify role of users
//$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
//$arrayofuseridoftask=$object->getListContactId('internal');
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
$head = task_prepare_head($object);
print '<table class="border centpercent">';
if ($action == 'edit' && $user->rights->projet->creer) {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description);
print '</td></tr>';
print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), 0, 'projecttask', 0, '', '');
// Categories
if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id, 'project', 1);
print "</td></tr>";
}
print '<table class="border centpercent">';
print '</table>';
// Ref
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Ref").'</td>';
print '<td><input class="minwidth100" name="taskref" value="'.$object->ref.'"></td></tr>';
print '</div>';
print '</div>';
print '</div>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input class="minwidth500" name="label" value="'.$object->label.'"></td></tr>';
print '<div class="clearboth"></div>';
// Project
if (empty($withproject)) {
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
print $projectstatic->getNomUrl(1);
print '</td></tr>';
print dol_get_fiche_end();
// Third party
print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
if ($projectstatic->societe->id) {
print $projectstatic->societe->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td></tr>';
print '<br>';
}
/*
* Actions
*/
/*print '<div class="tabsAction">';
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
{
if ($projectstatic->public || $userWrite > 0)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create'.$param.'">'.$langs->trans('AddTask').'</a>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTask').'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
}
print '</div>';
*/
// To verify role of users
//$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
//$arrayofuseridoftask=$object->getListContactId('internal');
$head = task_prepare_head($object);
if ($action == 'edit' && $user->rights->projet->creer) {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), 0, 'projecttask', 0, '', '');
print '<table class="border centpercent">';
// Ref
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Ref").'</td>';
print '<td><input class="minwidth100" name="taskref" value="'.$object->ref.'"></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input class="minwidth500" name="label" value="'.$object->label.'"></td></tr>';
// Project
if (empty($withproject)) {
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
print $projectstatic->getNomUrl(1);
print '</td></tr>';
// Third party
print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
if ($projectstatic->societe->id) {
print $projectstatic->societe->getNomUrl(1);
} else {
print '&nbsp;';
}
// Task parent
print '<tr><td>'.$langs->trans("ChildOfProjectTask").'</td><td>';
print $formother->selectProjectTasks($object->fk_task_parent, $projectstatic->id, 'task_parent', ($user->admin ? 0 : 1), 0, 0, 0, $object->id);
print '</td></tr>';
}
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->selectDate($object->date_start, 'dateo', 1, 1, 0, '', 1, 0);
print '</td></tr>';
// Task parent
print '<tr><td>'.$langs->trans("ChildOfProjectTask").'</td><td>';
print $formother->selectProjectTasks($object->fk_task_parent, $projectstatic->id, 'task_parent', ($user->admin ? 0 : 1), 0, 0, 0, $object->id);
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("Deadline").'</td><td>';
print $form->selectDate($object->date_end ? $object->date_end : -1, 'datee', 1, 1, 0, '', 1, 0);
print '</td></tr>';
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->selectDate($object->date_start, 'dateo', 1, 1, 0, '', 1, 0);
print '</td></tr>';
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
print $form->select_duration('planned_workload', $object->planned_workload, 0, 'text');
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("Deadline").'</td><td>';
print $form->selectDate($object->date_end ? $object->date_end : -1, 'datee', 1, 1, 0, '', 1, 0);
print '</td></tr>';
// Progress declared
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>';
print $formother->select_percent($object->progress, 'progress', 0, 5, 0, 100, 1);
print '</td></tr>';
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
print $form->select_duration('planned_workload', $object->planned_workload, 0, 'text');
print '</td></tr>';
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_4.'">'.$object->description.'</textarea>';
print '</td></tr>';
// Progress declared
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>';
print $formother->select_percent($object->progress, 'progress', 0, 5, 0, 100, 1);
print '</td></tr>';
// Other options
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
}
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_4.'">'.$object->description.'</textarea>';
print '</td></tr>';
print '</table>';
// Other options
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
}
print dol_get_fiche_end();
print '</table>';
print $form->buttonsSaveCancel("Modify");
print dol_get_fiche_end();
print '</form>';
print $form->buttonsSaveCancel("Modify");
print '</form>';
} else {
/*
* Fiche tache en mode visu
*/
$param = ($withproject ? '&withproject=1' : '');
$linkback = $withproject ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>' : '';
print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".GETPOST("id", 'int').'&withproject='.$withproject, $langs->trans("DeleteATask"), $langs->trans("ConfirmDeleteATask"), "confirm_delete");
}
if (!GETPOST('withproject') || empty($projectstatic->id)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
$object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")";
} else {
/*
* Fiche tache en mode visu
*/
$param = ($withproject ? '&withproject=1' : '');
$linkback = $withproject ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>' : '';
print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".GETPOST("id", 'int').'&withproject='.$withproject, $langs->trans("DeleteATask"), $langs->trans("ConfirmDeleteATask"), "confirm_delete");
}
if (!GETPOST('withproject') || empty($projectstatic->id)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
$object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")";
} else {
$object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id);
}
$morehtmlref = '';
// Project
if (empty($withproject)) {
$morehtmlref .= '<div class="refidno">';
$morehtmlref .= $langs->trans("Project").': ';
$morehtmlref .= $projectstatic->getNomUrl(1);
$morehtmlref .= '<br>';
// Third party
$morehtmlref .= $langs->trans("ThirdParty").': ';
if (!empty($projectstatic->thirdparty)) {
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref .= '</div>';
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Task parent
print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
if ($object->fk_task_parent > 0) {
$tasktmp = new Task($db);
$tasktmp->fetch($object->fk_task_parent);
print $tasktmp->getNomUrl(1);
}
print '</td></tr>';
// Date start - Date end
print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td colspan="3">';
$start = dol_print_date($object->date_start, 'dayhour');
print ($start ? $start : '?');
$end = dol_print_date($object->date_end, 'dayhour');
print ' - ';
print ($end ? $end : '?');
if ($object->hasDelay()) {
print img_warning("Late");
}
print '</td></tr>';
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td colspan="3">';
if ($object->planned_workload != '') {
print convertSecondToTime($object->planned_workload, 'allhourmin');
}
print '</td></tr>';
// Description
print '<td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
print nl2br($object->description);
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Progress declared
print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
if ($object->progress != '') {
print $object->progress.' %';
}
print '</td></tr>';
// Progress calculated
print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td colspan="3">';
if ($object->planned_workload != '') {
$tmparray = $object->getSummaryOfTimeSpent();
if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) {
print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
} else {
print '0 %';
}
} else {
print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>';
}
print '</td></tr>';
// Other attributes
$cols = 3;
$parameters = array('socid'=>$socid);
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
$object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id);
}
$morehtmlref = '';
if ($action != 'edit') {
/*
* Actions
*/
// Project
if (empty($withproject)) {
$morehtmlref .= '<div class="refidno">';
$morehtmlref .= $langs->trans("Project").': ';
$morehtmlref .= $projectstatic->getNomUrl(1);
$morehtmlref .= '<br>';
print '<div class="tabsAction">';
// Third party
$morehtmlref .= $langs->trans("ThirdParty").': ';
if (!empty($projectstatic->thirdparty)) {
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook)) {
// Modify
if ($user->rights->projet->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit&amp;withproject='.$withproject.'">'.$langs->trans('Modify').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>';
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
// Delete
if ($user->rights->projet->supprimer) {
if (!$object->hasChildren() && !$object->hasTimeSpent()) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.$withproject.'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("TaskHasChild").'">'.$langs->trans('Delete').'</a>';
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
}
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '</div>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Task parent
print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
if ($object->fk_task_parent > 0) {
$tasktmp = new Task($db);
$tasktmp->fetch($object->fk_task_parent);
print $tasktmp->getNomUrl(1);
}
print '</td></tr>';
// Date start - Date end
print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td colspan="3">';
$start = dol_print_date($object->date_start, 'dayhour');
print ($start ? $start : '?');
$end = dol_print_date($object->date_end, 'dayhour');
print ' - ';
print ($end ? $end : '?');
if ($object->hasDelay()) {
print img_warning("Late");
}
print '</td></tr>';
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td colspan="3">';
if ($object->planned_workload != '') {
print convertSecondToTime($object->planned_workload, 'allhourmin');
}
print '</td></tr>';
// Description
print '<td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
print nl2br($object->description);
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Progress declared
print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
if ($object->progress != '') {
print $object->progress.' %';
}
print '</td></tr>';
// Progress calculated
print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td colspan="3">';
if ($object->planned_workload != '') {
$tmparray = $object->getSummaryOfTimeSpent();
if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) {
print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
} else {
print '0 %';
}
} else {
print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>';
}
print '</td></tr>';
// Other attributes
$cols = 3;
$parameters = array('socid'=>$socid);
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
}
if ($action != 'edit') {
/*
* Actions
*/
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook)) {
// Modify
if ($user->rights->projet->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'&withproject='.((int) $withproject).'">'.$langs->trans('Modify').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>';
}
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Delete
if ($user->rights->projet->supprimer) {
if (!$object->hasChildren() && !$object->hasTimeSpent()) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject).'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("TaskHasChild").'">'.$langs->trans('Delete').'</a>';
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
}
/*
* Generated documents
*/
$filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$filedir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = ($user->rights->projet->lire);
$delallowed = ($user->rights->projet->creer);
print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid;
$formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject);
print '</div></div></div>';
print '</div>';
}
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
/*
* Generated documents
*/
$filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$filedir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = ($user->rights->projet->lire);
$delallowed = ($user->rights->projet->creer);
print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid;
$formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject);
print '</div></div></div>';
}
}

View File

@ -108,6 +108,13 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($projectstatic->table_element);
$extrafields->fetch_name_optionals_label($object->table_element);
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
/*
* Actions
@ -1219,6 +1226,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture,";
$sql .= " ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
if (empty($projectidforalltimes)) {
$sql .= " AND t.fk_task =".((int) $object->id);
} else {
@ -1234,7 +1242,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$sql .= natural_search('pt.label', $search_task_label);
}
if ($search_user > 0) {
$sql .= natural_search('t.fk_user', $search_user);
$sql .= natural_search('t.fk_user', $search_user, 2);
}
if ($search_valuebilled == '1') {
$sql .= ' AND t.invoice_id > 0';
@ -1249,6 +1257,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
if (! $resql) {
dol_print_error($db);
exit;
}
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;

View File

@ -64,19 +64,21 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
global $dolibarr_main_instance_unique_id;
global $dolibarr_main_url_root;
// Init vars
$errmsg = '';
$num = 0;
$error = 0;
$backtopage = GETPOST('backtopage', 'alpha');
$action = GETPOST('action', 'aZ09');
$email = GETPOST("email");
$societe = GETPOST("societe");
$emailcompany = GETPOST("emailcompany");
$note_public = GETPOST('note_public', "nohtml");
// Getting id from Post and decoding it
$type = GETPOST('type', 'aZ09');
@ -234,7 +236,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
// If the price has been set, name is required for the invoice
if (!GETPOST("societe") && !empty(floatval($project->price_registration))) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Company"))."<br>\n";
}
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$error++;
@ -269,6 +271,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$confattendee->email = $email;
$confattendee->fk_project = $project->id;
$confattendee->fk_actioncomm = $id;
$confattendee->note_public = $note_public;
$resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0) {
$error++;
@ -293,7 +296,9 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
exit;
}
$resultfetchthirdparty = -1;
$resultfetchthirdparty = 0;
$genericcompanyname = $langs->trans('EventParticipant').' '.($emailcompany ? $emailcompany : $email); // Keep this label simple so we can retreive same thirdparty for another event
// Getting the thirdparty or creating it
$thirdparty = new Societe($db);
@ -303,45 +308,104 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc);
} else {
if (empty($conf->global->EVENTORGANIZATION_DISABLE_RETREIVE_THIRDPARTY_FROM_NAME)) {
// Fetch using the input field by user if we just created the attendee
if (!empty($societe)) {
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $email);
if ($resultfetchthirdparty <= 0) {
// Try to find the thirdparty from the contact
$resultfetchcontact = $contact->fetch('', null, '', $email);
if ($resultfetchcontact <= 0 || $contact->fk_soc <= 0) {
// Need to create a new one (not found or multiple with the same name/email)
$resultfetchthirdparty = 0;
} else {
$thirdparty->fetch($contact->fk_soc);
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
$resultfetchthirdparty = 1;
}
} else {
// We found a unique result with that name/email, so we set the fk_soc of attendee
// Fetch using the field input by end user if we have just created the attendee
if ($resultfetchthirdparty <= 0 && !empty($societe) && !empty($emailcompany)) {
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $emailcompany);
if ($resultfetchthirdparty > 0) {
// We found a unique result with the name + emailcompany, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
} elseif ($resultfetchthirdparty == -2) {
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
}
}
// Fetch using the field input by end user if we have just created the attendee
if ($resultfetchthirdparty <= 0 && !empty($societe) && !empty($email) && $email != $emailcompany) {
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $email);
if ($resultfetchthirdparty > 0) {
// We found a unique result with the name + email, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
} elseif ($resultfetchthirdparty == -2) {
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
}
}
if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) {
// Try to find thirdparty from the email only
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany);
if ($resultfetchthirdparty > 0) {
// We found a unique result with that email only, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
} elseif ($resultfetchthirdparty == -2) {
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
}
}
if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) {
// Try to find thirdparty from the email only
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
if ($resultfetchthirdparty > 0) {
// We found a unique result with that email only, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
} elseif ($resultfetchthirdparty == -2) {
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
}
}
if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) {
// Try to find thirdparty from the generic mail only
$resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', '');
if ($resultfetchthirdparty > 0) {
// We found a unique result with that name + email, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
} elseif ($resultfetchthirdparty == -2) {
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
}
}
// TODO Add more tests on a VAT number, profid or a name ?
if ($resultfetchthirdparty <= 0 && !empty($email)) {
// Try to find the thirdparty from the contact
$resultfetchcontact = $contact->fetch('', null, '', $email);
if ($resultfetchcontact > 0 && $contact->fk_soc > 0) {
$thirdparty->fetch($contact->fk_soc);
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
$resultfetchthirdparty = 1;
}
}
if ($resultfetchthirdparty <= 0 && !empty($societe)) {
// Try to find thirdparty from the company name only
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', '');
if ($resultfetchthirdparty > 0) {
// We found a unique result with that name only, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
} elseif ($resultfetchthirdparty == -2) {
$thirdparty->error = "ErrorSeveralCompaniesWithNameContactUs";
}
} else {
// Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences)
$resultfetchthirdparty = 0;
}
} else {
// Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences)
$resultfetchthirdparty = 0;
}
}
// If price is empty, no need to create a thirdparty, so we force $resultfetchthirdparty as if we have already found thirdp party.
if (empty(floatval($project->price_registration))) {
$resultfetchthirdparty = 1;
}
if ($resultfetchthirdparty < 0) {
// If an error was found
$error++;
$errmsg .= $thirdparty->error;
} elseif ($resultfetchthirdparty == 0) {
} elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
// Creation of a new thirdparty
if (!empty($societe)) {
$thirdparty->name = $societe;
} else {
$thirdparty->name = $email;
$thirdparty->name = $genericcompanyname;
}
$thirdparty->address = GETPOST("address");
$thirdparty->zip = GETPOST("zipcode");
@ -350,7 +414,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$thirdparty->fournisseur = 0;
$thirdparty->country_id = GETPOST("country_id", 'int');
$thirdparty->state_id = GETPOST("state_id", 'int');
$thirdparty->email = $email;
$thirdparty->email = ($emailcompany ? $emailcompany : $email);
// Load object modCodeTiers
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
@ -388,6 +452,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if (!$error) {
if (!empty(floatval($project->price_registration))) {
$outputlangs = $langs;
// TODO Use default language of $thirdparty->default_lang to build $outputlang
// Get product to use for invoice
@ -405,30 +470,41 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$errmsg .= $productforinvoicerow->error;
} else {
$facture = new Facture($db);
$facture->type = Facture::TYPE_STANDARD;
$facture->socid = $thirdparty->id;
$facture->paye = 0;
$facture->date = dol_now();
$facture->cond_reglement_id = $confattendee->cond_reglement_id;
$facture->fk_project = $project->id;
if (empty($confattendee->fk_invoice)) {
$facture->type = Facture::TYPE_STANDARD;
$facture->socid = $thirdparty->id;
$facture->paye = 0;
$facture->date = dol_now();
$facture->cond_reglement_id = $confattendee->cond_reglement_id;
$facture->fk_project = $project->id;
$facture->status = Facture::STATUS_DRAFT;
if (empty($facture->cond_reglement_id)) {
$paymenttermstatic = new PaymentTerm($confattendee->db);
$facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
if (empty($facture->cond_reglement_id)) {
$error++;
$confattendee->error = 'ErrorNoPaymentTermRECEPFound';
$confattendee->errors[] = $confattendee->error;
$paymenttermstatic = new PaymentTerm($confattendee->db);
$facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
if (empty($facture->cond_reglement_id)) {
$error++;
$confattendee->error = 'ErrorNoPaymentTermRECEPFound';
$confattendee->errors[] = $confattendee->error;
}
}
$resultfacture = $facture->create($user);
if ($resultfacture <= 0) {
$confattendee->error = $facture->error;
$confattendee->errors = $facture->errors;
$error++;
} else {
$confattendee->fk_invoice = $resultfacture;
$confattendee->update($user);
}
}
$resultfacture = $facture->create($user);
if ($resultfacture <= 0) {
$confattendee->error = $facture->error;
$confattendee->errors = $facture->errors;
$error++;
} else {
$facture->add_object_linked($confattendee->element, $confattendee->id);
$facture->fetch($confattendee->fk_invoice);
}
// Add link between invoice and the attendee registration
/*if (!$error) {
$facture->add_object_linked($confattendee->element, $confattendee->id);
}*/
}
if (!$error) {
@ -610,7 +686,10 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print '<table class="border" summary="form to subscribe" id="tablesubscribe">' . "\n";
// Email
print '<tr><td>' . $langs->trans("Email") . '<font color="red">*</font></td><td><input type="text" name="email" maxlength="255" class="minwidth200" value="' . dol_escape_htmltag(GETPOST('email')) . '"></td></tr>' . "\n";
print '<tr><td>' . $langs->trans("EmailAttendee") . '<font color="red">*</font></td><td>';
print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input type="text" name="email" maxlength="255" class="minwidth200" value="' . dol_escape_htmltag(GETPOST('email')) . '"></td></tr>' . "\n";
// Company
print '<tr id="trcompany" class="trcompany"><td>' . $langs->trans("Company");
if (!empty(floatval($project->price_registration))) {
@ -619,15 +698,25 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print ' </td><td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print '<input type="text" name="societe" class="minwidth200" value="' . dol_escape_htmltag(GETPOST('societe')) . '"></td></tr>' . "\n";
// Email company for invoice
if ($project->price_registration) {
print '<tr><td>' . $langs->trans("EmailCompanyForInvoice") . '</td><td>';
print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input type="text" name="emailcompany" maxlength="255" class="minwidth200" value="' . dol_escape_htmltag(GETPOST('emailcompany')) . '"></td></tr>' . "\n";
}
// Address
print '<tr><td>' . $langs->trans("Address") . '</td><td>' . "\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="' . ROWS_3 . '">' . dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1) . '</textarea></td></tr>' . "\n";
print '<textarea name="address" id="address" wrap="soft" class="centpercent" rows="' . ROWS_2 . '">' . dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1) . '</textarea></td></tr>' . "\n";
// Zip / Town
print '<tr><td>' . $langs->trans('Zip') . ' / ' . $langs->trans('Town') . '</td><td>';
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
print ' / ';
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
print '</td></tr>';
// Country
print '<tr><td>' . $langs->trans('Country') . '<font color="red">*</font></td><td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
@ -666,6 +755,14 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print '</td></tr>';
}
$notetoshow = $note_public;
print '<tr><td>' . $langs->trans('Note') . '</td><td>';
if (!empty($conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION)) {
$notetoshow = str_replace('\n', "\n", $conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION);
}
print '<textarea name="note_public" class="centpercent" rows="'.ROWS_9.'">'.dol_escape_htmltag($notetoshow, 0, 1).'</textarea>';
print '</td></tr>';
print "</table>\n";
print dol_get_fiche_end();

View File

@ -115,6 +115,8 @@ if (!$action) {
if ($source == 'organizedeventregistration') {
// Finding the Attendee
$attendee = new ConferenceOrBoothAttendee($db);
$invoiceid = GETPOST('ref', 'int');
$invoice = new Facture($db);
@ -123,14 +125,28 @@ if ($source == 'organizedeventregistration') {
if ($resultinvoice <= 0) {
setEventMessages(null, $invoice->errors, "errors");
} else {
/*
$attendeeid = 0;
$invoice->fetchObjectLinked();
$linkedAttendees = $invoice->linkedObjectsIds['conferenceorboothattendee'];
if (is_array($linkedAttendees)) {
$linkedAttendees = array_values($linkedAttendees);
$attendeeid = $linkedAttendees[0];
}*/
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee";
$sql .= " WHERE fk_invoice = ".((int) $invoiceid);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$attendeeid = $obj->rowid;
}
}
$attendee = new ConferenceOrBoothAttendee($db);
$resultattendee = $attendee->fetch($linkedAttendees[0]);
if ($attendeeid > 0) {
$resultattendee = $attendee->fetch($attendeeid);
if ($resultattendee <= 0) {
setEventMessages(null, $attendee->errors, "errors");
@ -1840,7 +1856,7 @@ if ($source == 'organizedeventregistration') {
print '</td></tr>'."\n";
if (! is_object($attendee->project)) {
$text = 'ErrorProjectotFound';
$text = 'ErrorProjectNotFound';
} else {
$text = $langs->trans("PaymentEvent").' - '.$attendee->project->title;
}

View File

@ -1037,7 +1037,7 @@ if ($ispaymentok) {
}
// TODO send email with acknowledgment for the donation
// (need that the donation module can gen a pdf document for the cerfa with pre filled content)
// (we need first that the donation module is able to generate a pdf document for the cerfa with pre filled content)
} elseif (array_key_exists('ATT', $tmptag) && $tmptag['ATT'] > 0) {
// Record payment for registration to an event for an attendee
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -579,43 +579,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($sall) {
$param .= "&amp;sall=".urlencode($sall);
$param .= "&sall=".urlencode($sall);
}
if ($search_ref_rcp) {
$param .= "&amp;search_ref_rcp=".urlencode($search_ref_rcp);
$param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
}
if ($search_ref_liv) {
$param .= "&amp;search_ref_liv=".urlencode($search_ref_liv);
$param .= "&search_ref_liv=".urlencode($search_ref_liv);
}
if ($search_company) {
$param .= "&amp;search_company=".urlencode($search_company);
$param .= "&search_company=".urlencode($search_company);
}
if ($optioncss != '') {
$param .= '&amp;optioncss='.urlencode($optioncss);
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_billed != '' && $search_billed >= 0) {
$param .= "&amp;search_billed=".urlencode($search_billed);
$param .= "&search_billed=".urlencode($search_billed);
}
if ($search_town) {
$param .= "&amp;search_town=".urlencode($search_town);
$param .= "&search_town=".urlencode($search_town);
}
if ($search_zip) {
$param .= "&amp;search_zip=".urlencode($search_zip);
$param .= "&search_zip=".urlencode($search_zip);
}
if ($search_state) {
$param .= "&amp;search_state=".urlencode($search_state);
$param .= "&search_state=".urlencode($search_state);
}
if ($search_status != '') {
$param .= "&amp;search_status=".urlencode($search_status);
$param .= "&search_status=".urlencode($search_status);
}
if ($search_country) {
$param .= "&amp;search_country=".urlencode($search_country);
$param .= "&search_country=".urlencode($search_country);
}
if ($search_type_thirdparty) {
$param .= "&amp;search_type_thirdparty=".urlencode($search_type_thirdparty);
$param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
}
if ($search_ref_supplier) {
$param .= "&amp;search_ref_supplier=".urlencode($search_ref_supplier);
$param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
}
// Add $param from extra fields
foreach ($search_array_options as $key => $val) {
@ -891,7 +891,7 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['e.ref']['checked'])) {
print "<td>";
print '<td class="nowraponall">';
print $reception->getNomUrl(1);
$filename = dol_sanitizeFileName($reception->ref);
$filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref);
@ -904,10 +904,10 @@ while ($i < min($num, $limit)) {
}
}
// Ref customer
// Ref supplier
if (!empty($arrayfields['e.ref_supplier']['checked'])) {
print "<td>";
print $obj->ref_supplier;
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">';
print dol_escape_htmltag($obj->ref_supplier);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
@ -916,7 +916,7 @@ while ($i < min($num, $limit)) {
// Third party
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td>';
print '<td class="tdoverflowmax150">';
print $companystatic->getNomUrl(1);
print '</td>';
if (!$i) {
@ -925,8 +925,8 @@ while ($i < min($num, $limit)) {
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->town;
print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).'">';
print dol_escape_htmltag($obj->town);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -934,8 +934,8 @@ while ($i < min($num, $limit)) {
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->zip;
print '<td class="nocellnopadd center"">';
print dol_escape_htmltag($obj->zip);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -943,7 +943,7 @@ while ($i < min($num, $limit)) {
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
print "<td>".dol_escape_htmltag($obj->state_name)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -952,7 +952,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center">';
$tmparray = getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
print dol_escape_htmltag($tmparray['label']);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -2581,7 +2581,7 @@ class Societe extends CommonObject
$label .= ' ('.dol_escape_htmltag($this->name_alias).')';
}
}
$label .= '<br><b>'.$langs->trans('Email').':</b> '.$this->email;
$label .= '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
if (!empty($this->phone) || !empty($this->fax)) {
$phonelist = array();
if ($this->phone) {
@ -2590,7 +2590,7 @@ class Societe extends CommonObject
if ($this->fax) {
$phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', '&nbsp', 'fax');
}
$label .= '<br><b>'.$langs->trans('Phone').':</b> '.implode('&nbsp;', $phonelist);
$label .= '<br>'.implode('&nbsp;', $phonelist);
}
if (!empty($this->address)) {
$label .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs); // Address + country

View File

@ -999,36 +999,39 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
<?php
// TakePOS setup check
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
$sql .= " AND active = 1";
$sql .= " ORDER BY libelle";
if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
$sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement";
$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
$sql .= " AND active = 1";
$sql .= " ORDER BY libelle";
$resql = $db->query($sql);
$paiementsModes = array();
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$paycode = $obj->code;
if ($paycode == 'LIQ') {
$paycode = 'CASH';
}
if ($paycode == 'CHQ') {
$paycode = 'CHEQUE';
}
$resql = $db->query($sql);
$paiementsModes = array();
if ($resql) {
while ( $obj = $db->fetch_object($resql) ) {
$paycode = $obj->code;
if ($paycode == 'LIQ') {
$paycode = 'CASH';
}
if ($paycode == 'CHQ') {
$paycode = 'CHEQUE';
}
$constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
if (!empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
array_push($paiementsModes, $obj);
$constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
if ( ! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
array_push($paiementsModes, $obj);
}
}
}
if (empty($paiementsModes)) {
$langs->load('errors');
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
}
}
if (empty($paiementsModes)) {
$langs->load('errors');
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
}
if (count($maincategories) == 0) {
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
$tmpcategory = new Categorie($db);

View File

@ -188,11 +188,9 @@ if ($action == 'valid' && $user->rights->facture->creer) {
if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
$bankaccount = GETPOST('accountid', 'int');
} else {
if ($pay == "cash") {
if ($pay == 'LIQ') {
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility
} elseif ($pay == "card") {
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility
} elseif ($pay == "cheque") {
} elseif ($pay == "CHQ") {
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility
} else {
$accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];

View File

@ -330,23 +330,20 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
$paycode = $arrayOfValidPaymentModes[0]->code;
$payIcon = '';
if ($paycode == 'LIQ') {
$paycode = 'cash';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'coins';
}
} elseif ($paycode == 'CB') {
$paycode = 'card';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'credit-card';
}
} elseif ($paycode == 'CHQ') {
$paycode = 'cheque';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'money-check';
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
} else {
print '<button type="button" class="calcbutton2">'.$langs->trans("NoPaimementModesDefined").'</button>';
}
@ -359,23 +356,20 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
$paycode = $arrayOfValidPaymentModes[1]->code;
$payIcon = '';
if ($paycode == 'LIQ') {
$paycode = 'cash';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'coins';
}
} elseif ($paycode == 'CB') {
$paycode = 'card';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'credit-card';
}
} elseif ($paycode == 'CHQ') {
$paycode = 'cheque';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'money-check';
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
} else {
$button = array_pop($action_buttons);
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
@ -389,23 +383,20 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
$paycode = $arrayOfValidPaymentModes[2]->code;
$payIcon = '';
if ($paycode == 'LIQ') {
$paycode = 'cash';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'coins';
}
} elseif ($paycode == 'CB') {
$paycode = 'card';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'credit-card';
}
} elseif ($paycode == 'CHQ') {
$paycode = 'cheque';
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'money-check';
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span>'.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? '<br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span>'.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? '<br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
} else {
$button = array_pop($action_buttons);
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';

View File

@ -532,7 +532,7 @@ if (empty($reshook)) {
}
}
if ($action == 'setsubject') {
if ($action == 'setsubject' && $user->rights->ticket->write) {
if ($object->fetch(GETPOST('id', 'int'))) {
if ($action == 'setsubject') {
$object->subject = GETPOST('subject', 'alphanohtml');

View File

@ -3123,7 +3123,7 @@ if (!GETPOST('hide_websitemenu')) {
print '</span>'; // end websitetools
print '<span class="websitehelp">';
if (GETPOST('editsource', 'alpha') || GETPOST('editcontent', 'alpha')) {
if ($action == 'editsource' || $action == 'editcontent' || GETPOST('editsource', 'alpha') || GETPOST('editcontent', 'alpha')) {
$url = 'https://wiki.dolibarr.org/index.php/Module_Website';
$htmltext = $langs->transnoentitiesnoconv("YouCanEditHtmlSource", $url);