From 8906c95eea14c5ec4fa0b7205d311a40ed5fcda2 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 7 Sep 2017 16:23:51 +0200 Subject: [PATCH 01/17] NEW comments system on task --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/core/lib/functions2.lib.php | 22 + htdocs/core/lib/project.lib.php | 13 +- .../install/mysql/migration/6.0.0-7.0.0.sql | 11 + .../mysql/tables/llx_projet_task_comment.sql | 28 ++ htdocs/langs/en_US/projects.lang | 5 + htdocs/langs/fr_FR/projects.lang | 5 + htdocs/projet/admin/project.php | 9 + htdocs/projet/class/task.class.php | 331 ++++++++++++++- htdocs/projet/tasks/comment.php | 394 ++++++++++++++++++ htdocs/theme/eldy/style.css.php | 33 ++ 11 files changed, 850 insertions(+), 3 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_projet_task_comment.sql create mode 100644 htdocs/projet/tasks/comment.php diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f007cbdbf81..4dea3053d23 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -938,7 +938,7 @@ class Propal extends CommonObject $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".(double) $this->multicurrency_tx; $sql.= ")"; - + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 40dcb1fe77d..9d3e6ee1b63 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2240,3 +2240,25 @@ function getModuleDirForApiClass($module) return $moduledirforclass; } + +/* + * Return 2 hexa code randomly + * + * @param $min int Between 0 and 255 + * @param $max int Between 0 and 255 + * @return String + */ +function random_color_part($min=0,$max=255) { + return str_pad( dechex( mt_rand( $min, $max) ), 2, '0', STR_PAD_LEFT); +} + +/* + * Return hexadecimal color randomly + * + * @param $min int Between 0 and 255 + * @param $max int Between 0 and 255 + * @return String + */ +function random_color($min=0, $max=255) { + return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); +} \ No newline at end of file diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 035b7eac57b..189c37dbe32 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -175,6 +175,17 @@ function task_prepare_head($object) // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); + + // Manage discussion + if (empty($conf->global->MAIN_ALLOW_COMMENT_ON_TASK)) + { + $nbComments= $object->getNbComments(); + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); + $head[$h][1] = $langs->trans("TaskCommentLinks"); + if ($nbComments > 0) $head[$h][1].= ' '.$nbComments.''; + $head[$h][2] = 'task_comment'; + $h++; + } if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { @@ -187,7 +198,7 @@ function task_prepare_head($object) $head[$h][2] = 'task_notes'; $h++; } - + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index be89142cecb..b0e585aeacd 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -224,6 +224,17 @@ UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS'; +CREATE TABLE llx_projet_task_comment ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime DEFAULT NULL, + tms timestamp, + description text NOT NULL, + fk_user integer DEFAULT NULL, + fk_task integer DEFAULT NULL, + entity integer DEFAULT 1, + import_key varchar(125) DEFAULT NULL +); + -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8; diff --git a/htdocs/install/mysql/tables/llx_projet_task_comment.sql b/htdocs/install/mysql/tables/llx_projet_task_comment.sql new file mode 100644 index 00000000000..42fe572958a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_projet_task_comment.sql @@ -0,0 +1,28 @@ +-- =========================================================================== +-- Copyright (C) 2005 Rodolphe Quiedeville +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =========================================================================== + +CREATE TABLE llx_projet_task_comment ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime DEFAULT NULL, + tms timestamp, + description text NOT NULL, + fk_user integer DEFAULT NULL, + fk_task integer DEFAULT NULL, + entity integer DEFAULT 1, + import_key varchar(125) DEFAULT NULL +); diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 92282fd29f0..57406704bf4 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -208,3 +208,8 @@ OppStatusPENDING=Pending OppStatusWON=Won OppStatusLOST=Lost Budget=Budget +# Comments trans +AllowCommentOnTask=Allow user comments on tasks +TaskCommentLinks=Comments +TaskNbComments=Number of comments +TaskComment=Task's comments space diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 746fbd59c38..ece3272c743 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -207,3 +207,8 @@ OppStatusPENDING=En attente OppStatusWON=Gagné OppStatusLOST=Perdu Budget=Budget +#Comments trans +AllowCommentOnTask=Autoriser les commentaires entre utilisateurs sur les tâches +TaskCommentLinks=Commentaires +TaskNbComments=Nombre de commentaires +TaskComment=Tâches espace commentaires diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 744e52e0f2f..0c0da27457e 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -918,6 +918,15 @@ print ''; print ' '; print ''; +print ''; +print ''.$langs->trans("AllowCommentOnTask").''; + +print ''; +echo ajax_constantonoff('PROJECT_ALLOW_COMMENT_ON_TASK'); +print ''; +print ' '; +print ''; + print ''; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 17d1b5fcf45..258805f9970 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -35,7 +35,7 @@ class Task extends CommonObject public $table_element='projet_task'; //!< Name of table without prefix where object is stored public $fk_element='fk_task'; public $picto = 'task'; - protected $childtables=array('projet_task_time'); // To test if we can delete object + protected $childtables=array('projet_task_time','projet_task_comment'); // To test if we can delete object var $fk_task_parent; var $label; @@ -69,6 +69,8 @@ class Task extends CommonObject var $timespent_withhour; // 1 = we entered also start hours for timesheet line var $timespent_fk_user; var $timespent_note; + + var $comments = array(); public $oldcopy; @@ -1777,4 +1779,331 @@ class Task extends CommonObject return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay))); } + + /** + * Return nb comments already posted + * + * @return int + */ + public function getNbComments() + { + return count($this->comments); + } + + /** + * Load comments linked with current task + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetchComments() + { + $sql = "SELECT"; + $sql.= " c.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_comment as c"; + $sql.= " WHERE c.fk_task = ".$this->id; + $sql.= " ORDER BY c.tms DESC"; + + dol_syslog(get_class($this)."::fetchComments", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $num_rows = $this->db->num_rows($resql); + if ($num_rows > 0) + { + while($obj = $this->db->fetch_object($resql)) + { + $comment = new TaskComment($this->db); + $comment->fetch($obj->rowid); + $this->comments[] = $comment; + } + return $num_rows; + }else{ + return 0; + } + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } } + +/** + * Class to manage tasks + */ +class TaskComment extends CommonObject +{ + public $element='project_task_comment'; //!< Id that identify managed objects + public $table_element='projet_task_comment'; //!< Name of table without prefix where object is stored + public $fk_element='fk_task'; + public $picto = 'task'; + + var $fk_task; + + var $description; + + var $tms; + + var $datec; + + var $fk_user; + + var $entity; + + var $import_key; + + public $oldcopy; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + } + + + /** + * Create into database + * + * @param User $user User that create + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + function create($user, $notrigger=0) + { + global $conf, $langs; + + $error=0; + + // Insert request + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_comment ("; + $sql.= "description"; + $sql.= ", datec"; + $sql.= ", fk_task"; + $sql.= ", fk_user"; + $sql.= ", entity"; + $sql.= ", import_key"; + $sql.= ") VALUES ("; + $sql.= "'".$this->db->escape($this->description)."'"; + $sql.= ", ".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null'); + $sql.= ", '".(isset($this->fk_task)?$this->fk_task:"null")."'"; + $sql.= ", '".(isset($this->fk_user)?$this->fk_user:"null")."'"; + $sql.= ", ".(!empty($this->entity)?$this->entity:'1'); + $sql.= ", ".(!empty($this->import_key)?"'".$this->import_key."'":"null"); + $sql.= ")"; + + var_dump($this->db); + echo $sql; + + $this->db->begin(); + + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + + if (! $error) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_comment"); + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('TASK_COMMENT_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return $this->id; + } + } + + + /** + * Load object in memory from database + * + * @param int $id Id object + * @param int $ref ref object + * @return int <0 if KO, 0 if not found, >0 if OK + */ + function fetch($id) + { + global $langs; + + $sql = "SELECT"; + $sql.= " c.rowid,"; + $sql.= " c.description,"; + $sql.= " c.datec,"; + $sql.= " c.tms,"; + $sql.= " c.fk_task,"; + $sql.= " c.fk_user,"; + $sql.= " c.entity,"; + $sql.= " c.import_key"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_comment as c"; + $sql.= " WHERE c.rowid = ".$id; + + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $num_rows = $this->db->num_rows($resql); + + if ($num_rows) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + $this->description = $obj->description; + $this->datec = $this->db->jdate($obj->datec); + $this->tms = $obj->tms; + $this->fk_user = $obj->fk_user; + $this->fk_task = $obj->fk_task; + $this->entity = $obj->entity; + $this->import_key = $obj->import_key; + } + + $this->db->free($resql); + + if ($num_rows) return 1; + else return 0; + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } + + + /** + * Update database + * + * @param User $user User that modify + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <=0 if KO, >0 if OK + */ + function update($user=null, $notrigger=0) + { + global $conf, $langs; + $error=0; + + // Clean parameters + if (isset($this->fk_task)) $this->fk_project=trim($this->fk_task); + if (isset($this->fk_user)) $this->fk_project=trim($this->fk_user); + if (isset($this->description)) $this->description=trim($this->description); + + + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_comment SET"; + $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; + $sql.= " datec=".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null').","; + $sql.= " fk_task=".(isset($this->fk_task)?$this->fk_task:"null").","; + $sql.= " fk_user=".(isset($this->fk_user)?$this->fk_user:"null").","; + $sql.= " entity=".(!empty($this->entity)?$this->entity:'1').","; + $sql.= " import_key=".(!empty($this->import_key)?"'".$this->import_key."'":"null"); + $sql.= " WHERE rowid=".$this->id; + + $this->db->begin(); + + dol_syslog(get_class($this)."::update", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('TASK_COMMENT_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } + + + /** + * Delete task from database + * + * @param User $user User that delete + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function delete($user, $notrigger=0) + { + global $conf, $langs; + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + + $error=0; + + $this->db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_comment"; + $sql.= " WHERE rowid=".$this->id; + + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('TASK_COMMENT_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + }else{ + $this->db->commit(); + return 1; + } + } +} \ No newline at end of file diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php new file mode 100644 index 00000000000..0446cc71ea6 --- /dev/null +++ b/htdocs/projet/tasks/comment.php @@ -0,0 +1,394 @@ + + * Copyright (C) 2006-2017 Laurent Destailleur + * Copyright (C) 2010-2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/projet/tasks/task.php + * \ingroup project + * \brief Page of a project task + */ + +require ("../../main.inc.php"); +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/project/task/modules_task.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + +$langs->load("projects"); +$langs->load("companies"); + +$id=GETPOST('id','int'); +$idcomment=GETPOST('idcomment','int'); +$ref=GETPOST("ref",'alpha',1); // task ref +$taskref=GETPOST("taskref",'alpha'); // task ref +$action=GETPOST('action','alpha'); +$confirm=GETPOST('confirm','alpha'); +$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->societe_id > 0) $socid = $user->societe_id; // 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')); + +$task = new Task($db); +$object = new TaskComment($db); +$extrafields = new ExtraFields($db); +$projectstatic = new Project($db); +$userstatic = new User($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($task->table_element); + + +/* + * Actions + */ + +if ($action == 'addcomment') +{ + if (!empty($_POST['comment_description'])) + { + $object->description = GETPOST('comment_description'); + $object->datec = time(); + $object->fk_task = $id; + $object->fk_user = $user->id; + $object->entity = $conf->entity; + if ($object->create($user) > 0) + { + header('Location: '.DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$id.($withproject?'&withproject=1':'')); + exit; + } + else + { + setEventMessages($task->error,$task->errors,'errors'); + $action=''; + } + } +} +if ($action == 'deletecomment') +{ + if ($object->fetch($idcomment) >= 0) + { + if ($object->delete($user) > 0) + { + header('Location: '.DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$id.($withproject?'&withproject=1':'')); + exit; + } + else + { + setEventMessages($task->error,$task->errors,'errors'); + $action=''; + } + } +} + +// Retreive First Task ID of Project if withprojet is on to allow project prev next to work +if (! empty($project_ref) && ! empty($withproject)) +{ + if ($projectstatic->fetch('',$project_ref) > 0) + { + $tasksarray=$task->getTasksArray(0, 0, $projectstatic->id, $socid, 0); + if (count($tasksarray) > 0) + { + $id=$tasksarray[0]->id; + } + else + { + header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.(empty($mode)?'':'&mode='.$mode)); + } + } +} + +/* + * View +*/ + + +llxHeader('', $langs->trans("TaskComment")); + +$form = new Form($db); +$formother = new FormOther($db); +$formfile = new FormFile($db); + +if ($id > 0 || ! empty($ref)) +{ + if ($task->fetch($id,$ref) > 0) + { + $res=$task->fetch_optionals($task->id,$extralabels); + $res = $task->fetchComments(); + + $result=$projectstatic->fetch($task->fk_project); + if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + + $task->project = clone $projectstatic; + + $userWrite = $projectstatic->restrictedProjectArea($user,'write'); + + if (! empty($withproject)) + { + // Tabs for project + $tab='tasks'; + $head=project_prepare_head($projectstatic); + dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project')); + + $param=($mode=='mine'?'&mode=mine':''); + + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $tasksListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); + $projectstatic->next_prev_filter=" rowid in (".(count($tasksListId)?join(',',array_keys($tasksListId)):'0').")"; + } + + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print ''; + + // Visibility + print ''; + + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($projectstatic->date_start,'day'); + $end=dol_print_date($projectstatic->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id,'project',1); + print "
'; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); + + print '
'; + } + + $head=task_prepare_head($task); + + /* + * Fiche tache en mode visu + */ + $param=($withproject?'&withproject=1':''); + $linkback=$withproject?''.$langs->trans("BackToList").'':''; + + dol_fiche_head($head, 'task_comment', $langs->trans("Task"), -1, 'projecttask'); + + if ($action == 'delete') + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"].'&withproject='.$withproject,$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); + } + + if (! GETPOST('withproject') || empty($projectstatic->id)) + { + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); + $task->next_prev_filter=" fk_projet in (".$projectsListId.")"; + } + else $task->next_prev_filter=" fk_projet = ".$projectstatic->id; + + $morehtmlref=''; + + // Project + if (empty($withproject)) + { + $morehtmlref.='
'; + $morehtmlref.=$langs->trans("Project").': '; + $morehtmlref.=$projectstatic->getNomUrl(1); + $morehtmlref.='
'; + + // Third party + $morehtmlref.=$langs->trans("ThirdParty").': '; + if (!empty($projectstatic->thirdparty)) { + $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); + } + $morehtmlref.='
'; + } + + dol_banner_tab($task, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); + + print '
'; + + print '
'; + print ''; + + // Nb comments + print ''; + + // Other attributes + $cols = 3; + $parameyers=array('socid'=>$socid); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("TaskNbComments").''; + print $task->getNbComments(); + print '
'; + + print '
'; + + dol_fiche_end(); + + + print '
'; + print '
'; + + // Add comment + + print '
'; + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + print ''; + print ''; + + // Description + print ''; + + print ''; + print '
'.$langs->trans("Comments").'
'; + + $desc = ($_POST['comment_description']?$_POST['comment_description']:''); + + $doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '100%'); + print $doleditor->Create(1); + + print ''; + print ''; + print '
'; + + // List of comments + if(!empty($task->comments)) { + // Default color for current user + $TColors = array($user->id => 'efefef'); + $first = true; + foreach($task->comments as $comment) { + $fk_user = $comment->fk_user; + $userstatic->fetch($fk_user); + if(empty($TColors[$fk_user])) { + $TColors[$fk_user] = random_color(180,240); + } + print '
'; + if($comment->fk_user == $user->id) { + print '
 
'; + } + + print '
'; + print '
'; + print $comment->description; + print '
'; + print '
'; + print $langs->trans('User').' : '.$userstatic->getNomUrl().'
'; + print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec'); + if($first && $fk_user == $user->id) { + print '
'.$langs->trans('Delete').''; + } + print '
'; + print '
'; + + if($comment->fk_user != $user->id) { + print '
 
'; + } + + $first = false; + } + } + + print '
'; + print '
'; + + } +} + + +llxFooter(); +$db->close(); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1b0d04469c3..ccec30b0a34 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -826,6 +826,16 @@ div.fiche>form>div.div-table-responsive { .titlefieldmiddle { width: 50%; } .imgmaxwidth180 { max-width: 180px; } +.width20p { width:20%; } +.width25p { width:25%; } +.width40p { width:40%; } +.width50p { width:50%; } +.width60p { width:60%; } +.width75p { width:75%; } +.width80p { width:80%; } +.width100p { width:100%; } + + /* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) { @@ -3799,6 +3809,29 @@ pre#editfilecontentaceeditorid { } +/* ============================================================================== */ +/* Comments */ +/* ============================================================================== */ + +#comment div { + box-sizing:border-box; +} + +#comment .comment { + border-radius:7px; + padding:7px 10px; + margin-bottom:10px; +} +#comment .comment-info { + font-size:0.8em; + color:#555; + margin-top:5px; +} +#comment textarea { + width: 100%; +} + + /* ============================================================================== */ /* JSGantt */ From 680fab313c40ec971d2929b013ac87b45480024d Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 7 Sep 2017 16:47:52 +0200 Subject: [PATCH 02/17] NEW preload comments in task --- htdocs/projet/class/task.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 258805f9970..cf94307a32a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -259,8 +259,12 @@ class Task extends CommonObject $this->db->free($resql); - if ($num_rows) return 1; - else return 0; + if ($num_rows) { + $this->fetchComments(); + return 1; + }else { + return 0; + } } else { From 7f5950c9582fd74c62ff4503c473c17a5cef0ae9 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 8 Sep 2017 09:14:34 +0200 Subject: [PATCH 03/17] FIX multiple comments not reset on fetch --- htdocs/projet/class/task.class.php | 1 + htdocs/projet/tasks/comment.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index cf94307a32a..3789759c2e9 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1801,6 +1801,7 @@ class Task extends CommonObject */ public function fetchComments() { + $this->comments = array(); $sql = "SELECT"; $sql.= " c.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_comment as c"; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 0446cc71ea6..3f0cbe0bf47 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -141,7 +141,6 @@ if ($id > 0 || ! empty($ref)) if ($task->fetch($id,$ref) > 0) { $res=$task->fetch_optionals($task->id,$extralabels); - $res = $task->fetchComments(); $result=$projectstatic->fetch($task->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); @@ -369,7 +368,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print $langs->trans('User').' : '.$userstatic->getNomUrl().'
'; print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec'); - if($first && $fk_user == $user->id) { + if(($first && $fk_user == $user->id) || $user->admin == 1) { print '
'.$langs->trans('Delete').''; } print '
'; From fdd758abb4db8b0125c5044c8eb8d53f780d08a9 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 8 Sep 2017 09:17:22 +0200 Subject: [PATCH 04/17] FIX empty test on conf fortask comment was bad --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 189c37dbe32..0395f9f17ff 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -177,7 +177,7 @@ function task_prepare_head($object) complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); // Manage discussion - if (empty($conf->global->MAIN_ALLOW_COMMENT_ON_TASK)) + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) { $nbComments= $object->getNbComments(); $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); From e555233dc12c1a206ae41754df78f2086cbba110 Mon Sep 17 00:00:00 2001 From: Kjeld Borch Egevang Date: Sat, 9 Sep 2017 11:29:30 +0200 Subject: [PATCH 05/17] Remove processing by htmlentities() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When translated texts contain international characters they are unintentionally changed by htmlentities(). You can see the problem at the admin/index.php page (language set to French): Les paramètres dans le menu Configuration -> Société/Organisation sont requis car les données définies sont utilisées dans l'affichage Dolibarr et pour personnaliser le comportement par défaut du logiciel (pour les fonctionnalités liées à un pays par exemple). --- htdocs/core/class/translate.class.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 169aec16307..180b4db0ba6 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -620,15 +620,6 @@ class Translate if ($maxsize) $str=dol_trunc($str,$maxsize); - // We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities - $str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str); - - // Crypt string into HTML - $str=htmlentities($str,ENT_QUOTES,$this->charset_output); - - // Restore HTML tags - $str=str_replace(array('__lt__','__gt__','__quot__'),array('<','>','"',),$str); - return $str; } else // Translation is not available From 698a047573824d6acaac3f253fee6549d4e15201 Mon Sep 17 00:00:00 2001 From: reeperbahnause Date: Sat, 9 Sep 2017 20:00:09 +0200 Subject: [PATCH 06/17] fix #7361 missing generateDocument function fix #7361 Function generateDocument was missing for Class Fichinter --- htdocs/fichinter/class/fichinter.class.php | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index eaf10c357e4..9b71efe7811 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -579,6 +579,38 @@ class Fichinter extends CommonObject return $amount; } + + /** + * Create a document onto disk according to template module. + * + * @param string $modele Force model to use ('' to not force) + * @param Translate $outputlangs Object langs to use for output + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$langs; + + $langs->load("interventions"); + + if (! dol_strlen($modele)) { + + $modele = 'azur'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->PROPALE_ADDON_PDF)) { + $modele = $conf->global->PROPALE_ADDON_PDF; + } + } + + $modelpath = "core/modules/fichinter/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } /** * Returns the label status From 8dbf4bfaeeebb9e292816ab3413e93e7c778abb8 Mon Sep 17 00:00:00 2001 From: Gitdyr Date: Sat, 9 Sep 2017 21:19:02 +0200 Subject: [PATCH 07/17] Danish accounting accounts. --- htdocs/install/mysql/data/llx_accounting.sql | 98 +++++++++++++++++++ .../mysql/data/llx_accounting_category.sql | 4 +- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_accounting.sql b/htdocs/install/mysql/data/llx_accounting.sql index 43e72640450..bf973656661 100644 --- a/htdocs/install/mysql/data/llx_accounting.sql +++ b/htdocs/install/mysql/data/llx_accounting.sql @@ -2209,3 +2209,101 @@ INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4782, 'PCG08-PYME','INCOME', 'XXXXXX', '7991', '4780', 'Revisión del deterioro de créditos a corto plazo empresas asociadas', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4783, 'PCG08-PYME','INCOME', 'XXXXXX', '7992', '4780', 'Revisión del deterioro de créditos a corto plazo otras partes vinculadas', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4784, 'PCG08-PYME','INCOME', 'XXXXXX', '7993', '4780', 'Revisión del deterioro de créditos a corto plazo otras empresas', 1); + +-- +-- Description of the accounts in DK-STD +-- + +INSERT INTO llx_accounting_system (rowid, pcg_version, label, active) VALUES (5,'DK-STD', 'Standardkontoplan fra SKAT', 1); + +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUE +(5082, 'DK-STD', 'Indtægter', 'XXXXXX', '1000', '0', 'Salg af varer/ydelser m. moms', 1), +(5083, 'DK-STD', 'Indtægter', '', '1010', '', 'Salg af varer EU', 1), +(5084, 'DK-STD', 'Indtægter', '', '1020', '', 'Salg af ydelser EU', 1), +(5085, 'DK-STD', 'Indtægter', '', '1030', '', 'Ej momspligtigt salg', 1), +(5086, 'DK-STD', 'Indtægter', '', '1040', '', 'Regulering igangværende arbejder', 1), +(5087, 'DK-STD', 'Omkostninger', '', '1100', '', 'Varekøb med moms', 1), +(5088, 'DK-STD', 'Omkostninger', '', '1110', '', 'Køb af varer EU', 1), +(5089, 'DK-STD', 'Omkostninger', '', '1120', '', 'Køb af ydelser EU', 1), +(5090, 'DK-STD', 'Omkostninger', '', '1130', '', 'Varelagerregulering', 1), +(5091, 'DK-STD', 'Omkostninger', '', '1140', '', 'Eget vareforbrug', 1), +(5092, 'DK-STD', 'Omkostninger', '', '1300', '', 'Repræsentation', 1), +(5093, 'DK-STD', 'Omkostninger', '', '1310', '', 'Annoncer/reklame', 1), +(5094, 'DK-STD', 'Omkostninger', '', '1320', '', 'Rejseudgifter', 1), +(5095, 'DK-STD', 'Omkostninger', '', '1330', '', 'Aviser og blade', 1), +(5096, 'DK-STD', 'Omkostninger', '', '1400', '', 'Brændstof', 1), +(5097, 'DK-STD', 'Omkostninger', '', '1410', '', 'Bilforsikring', 1), +(5098, 'DK-STD', 'Omkostninger', '', '1420', '', 'Vedligeholdelse', 1), +(5099, 'DK-STD', 'Omkostninger', '', '1430', '', 'Grøn ejerafgift mv.', 1), +(5100, 'DK-STD', 'Omkostninger', '', '1440', '', 'Leje og leasing', 1), +(5101, 'DK-STD', 'Omkostninger', '', '1450', '', 'Bilvask og pleje af bil', 1), +(5102, 'DK-STD', 'Omkostninger', '', '1460', '', 'Parkeringsudgifter', 1), +(5103, 'DK-STD', 'Omkostninger', '', '1470', '', 'Biludgifter efter statens takster', 1), +(5104, 'DK-STD', 'Omkostninger', '', '1480', '', 'Fri bil', 1), +(5105, 'DK-STD', 'Omkostninger', '', '1490', '', 'Privat andel af biludgifter', 1), +(5106, 'DK-STD', 'Omkostninger', '', '1600', '', 'Husleje uden forbrug', 1), +(5107, 'DK-STD', 'Omkostninger', '', '1610', '', 'Forbrugsudgifter (el, vand, gas og varme mv)', 1), +(5108, 'DK-STD', 'Omkostninger', '', '1620', '', 'Ejendomsskatter og forsikringer', 1), +(5109, 'DK-STD', 'Omkostninger', '', '1630', '', 'Vedligeholdelse af lokaler', 1), +(5110, 'DK-STD', 'Omkostninger', '', '1700', '', 'Kontorartikler og tryksager', 1), +(5111, 'DK-STD', 'Omkostninger', '', '1705', '', 'Telefon og internet', 1), +(5112, 'DK-STD', 'Omkostninger', '', '1710', '', 'Fri telefon privat andel', 1), +(5113, 'DK-STD', 'Omkostninger', '', '1715', '', 'Anskaffelse af småaktiver', 1), +(5114, 'DK-STD', 'Omkostninger', '', '1720', '', 'Arbejdstøj', 1), +(5115, 'DK-STD', 'Omkostninger', '', '1725', '', 'Rådgiverudgifter', 1), +(5116, 'DK-STD', 'Omkostninger', '', '1730', '', 'Porto og gebyrer', 1), +(5117, 'DK-STD', 'Omkostninger', '', '1735', '', 'Forsikringer', 1), +(5118, 'DK-STD', 'Omkostninger', '', '1740', '', 'Bøger og faglitteratur', 1), +(5119, 'DK-STD', 'Omkostninger', '', '1745', '', 'Konstaterede tab på debitorer', 1), +(5120, 'DK-STD', 'Omkostninger', '', '1750', '', 'Kassedifferencer', 1), +(5121, 'DK-STD', 'Afskrivninger', '', '2000', '', 'Afskrivning driftsmidler og inventar', 1), +(5122, 'DK-STD', 'Afskrivninger', '', '2010', '', 'Afskrivning blandede driftsmidler', 1), +(5123, 'DK-STD', 'Afskrivninger', '', '2020', '', 'Afskrivninger privat andel', 1), +(5124, 'DK-STD', 'Afskrivninger', '', '2030', '', 'Gevinst og tab ved salg af aktiver', 1), +(5125, 'DK-STD', 'Finansielle poster', '', '2400', '', 'Renteindtægter bank', 1), +(5126, 'DK-STD', 'Finansielle poster', '', '2410', '', 'Renteindtægter kunder', 1), +(5127, 'DK-STD', 'Finansielle poster', '', '2500', '', 'Renteudgifter bank og realkreditinstitut', 1), +(5128, 'DK-STD', 'Finansielle poster', '', '2510', '', 'Renteudgifter leverandører', 1), +(5129, 'DK-STD', 'Finansielle poster', '', '2520', '', 'Fradragsberettigede låneomkostninger', 1), +(5130, 'DK-STD', 'Finansielle poster', '', '2530', '', 'Fradragsberettigede renteudgifter til det offentlige', 1), +(5131, 'DK-STD', 'Balance', '', '3000', '', 'Afskrivningsgrundlag primo', 1), +(5132, 'DK-STD', 'Balance', '', '3010', '', 'Årets køb', 1), +(5133, 'DK-STD', 'Balance', '', '3015', '', 'Årets forbedringer', 1), +(5134, 'DK-STD', 'Balance', '', '3020', '', 'Årest salg', 1), +(5135, 'DK-STD', 'Balance', '', '3030', '', 'Årets afskrivning', 1), +(5136, 'DK-STD', 'Balance', '', '3040', '', 'Gevinst og tab', 1), +(5137, 'DK-STD', 'Balance', '', '3100', '', 'Afskrivningsgrundlag primo', 1), +(5138, 'DK-STD', 'Balance', '', '3110', '', 'Årets køb', 1), +(5139, 'DK-STD', 'Balance', '', '3115', '', 'Årets forbedringer', 1), +(5140, 'DK-STD', 'Balance', '', '3120', '', 'Årets salg', 1), +(5141, 'DK-STD', 'Balance', '', '3130', '', 'Årets afskrivning', 1), +(5142, 'DK-STD', 'Balance', '', '3140', '', 'Gevinst og tab', 1), +(5143, 'DK-STD', 'Balance', '', '3900', '', 'Huslejedepositum', 1), +(5144, 'DK-STD', 'Balance', '', '4000', '', 'Kasse', 1), +(5145, 'DK-STD', 'Balance', '', '4010', '', 'Bank', 1), +(5146, 'DK-STD', 'Balance', '', '4020', '', 'Forudbetalte omkostninger', 1), +(5147, 'DK-STD', 'Balance', '', '4030', '', 'Debitorer', 1), +(5148, 'DK-STD', 'Balance', '', '4040', '', 'Varelager', 1), +(5149, 'DK-STD', 'Balance', '', '4050', '', 'Igangværende arbejder', 1), +(5150, 'DK-STD', 'Balance', '', '5000', '', 'Egenkapital primo', 1), +(5151, 'DK-STD', 'Balance', '', '5010', '', 'Årets resultat', 1), +(5152, 'DK-STD', 'Balance', '', '5020', '', 'Privat hævet', 1), +(5153, 'DK-STD', 'Balance', '', '5030', '', 'Fri bil', 1), +(5154, 'DK-STD', 'Balance', '', '5040', '', 'Statens takster', 1), +(5155, 'DK-STD', 'Balance', '', '5050', '', 'Fri telefon m.v.', 1), +(5156, 'DK-STD', 'Balance', '', '5060', '', 'Private andele', 1), +(5157, 'DK-STD', 'Balance', '', '5065', '', 'Private afskrivninger', 1), +(5158, 'DK-STD', 'Balance', '', '5070', '', 'Driftsudgifter u/fradrag', 1), +(5159, 'DK-STD', 'Balance', '', '5080', '', 'Privat udlæg', 1), +(5160, 'DK-STD', 'Balance', '', '5090', '', 'Indskud', 1), +(5161, 'DK-STD', 'Balance', '', '7000', '', 'Gæld bank og realkreditinstitut', 1), +(5162, 'DK-STD', 'Balance', '', '7010', '', 'Gæld til leverandører af varer og tjenesteydelser', 1), +(5163, 'DK-STD', 'Balance', '', '7020', '', 'Periodeafgrænsningsposter', 1), +(5164, 'DK-STD', 'Balance', '', '7030', '', 'Anden gæld', 1), +(5165, 'DK-STD', 'Balance', '', '8000', '', 'Salgsmoms', 1), +(5166, 'DK-STD', 'Balance', '', '8010', '', 'Købsmoms', 1), +(5167, 'DK-STD', 'Balance', '', '8020', '', 'Konto for afgift af varekøb i EU', 1), +(5168, 'DK-STD', 'Balance', '', '8030', '', 'Konto for afgift af købte ydelser i EU', 1), +(5169, 'DK-STD', 'Balance', '', '8040', '', 'El- afgift', 1), +(5170, 'DK-STD', 'Balance', '', '8050', '', 'Øvrige energiafgifter', 1), +(5171, 'DK-STD', 'Balance', '', '8060', '', 'Betalt moms', 1) diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql index 538a4257aab..4954ed3f0fc 100644 --- a/htdocs/install/mysql/data/llx_accounting_category.sql +++ b/htdocs/install/mysql/data/llx_accounting_category.sql @@ -18,7 +18,7 @@ -- Group of accounting account for French result. This is a minimal default setup. -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1); -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Example: 7xxxxx', 0, 0, '', '10', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Example: 6xxxxx', 0, 0, '', '20', 1, 1); INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'PROFIT', 'Balance', '', 0, 1, 'VENTES+DEPENSES', '30', 1, 1); From 68a8ef6e2d528523a4758bc18c30d820ad64a1ee Mon Sep 17 00:00:00 2001 From: Gitdyr Date: Sat, 9 Sep 2017 22:21:55 +0200 Subject: [PATCH 08/17] Fixed. --- htdocs/install/mysql/data/llx_accounting.sql | 181 +++++++++---------- 1 file changed, 90 insertions(+), 91 deletions(-) diff --git a/htdocs/install/mysql/data/llx_accounting.sql b/htdocs/install/mysql/data/llx_accounting.sql index bf973656661..4d2ddce37bc 100644 --- a/htdocs/install/mysql/data/llx_accounting.sql +++ b/htdocs/install/mysql/data/llx_accounting.sql @@ -2216,94 +2216,93 @@ INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype INSERT INTO llx_accounting_system (rowid, pcg_version, label, active) VALUES (5,'DK-STD', 'Standardkontoplan fra SKAT', 1); -INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUE -(5082, 'DK-STD', 'Indtægter', 'XXXXXX', '1000', '0', 'Salg af varer/ydelser m. moms', 1), -(5083, 'DK-STD', 'Indtægter', '', '1010', '', 'Salg af varer EU', 1), -(5084, 'DK-STD', 'Indtægter', '', '1020', '', 'Salg af ydelser EU', 1), -(5085, 'DK-STD', 'Indtægter', '', '1030', '', 'Ej momspligtigt salg', 1), -(5086, 'DK-STD', 'Indtægter', '', '1040', '', 'Regulering igangværende arbejder', 1), -(5087, 'DK-STD', 'Omkostninger', '', '1100', '', 'Varekøb med moms', 1), -(5088, 'DK-STD', 'Omkostninger', '', '1110', '', 'Køb af varer EU', 1), -(5089, 'DK-STD', 'Omkostninger', '', '1120', '', 'Køb af ydelser EU', 1), -(5090, 'DK-STD', 'Omkostninger', '', '1130', '', 'Varelagerregulering', 1), -(5091, 'DK-STD', 'Omkostninger', '', '1140', '', 'Eget vareforbrug', 1), -(5092, 'DK-STD', 'Omkostninger', '', '1300', '', 'Repræsentation', 1), -(5093, 'DK-STD', 'Omkostninger', '', '1310', '', 'Annoncer/reklame', 1), -(5094, 'DK-STD', 'Omkostninger', '', '1320', '', 'Rejseudgifter', 1), -(5095, 'DK-STD', 'Omkostninger', '', '1330', '', 'Aviser og blade', 1), -(5096, 'DK-STD', 'Omkostninger', '', '1400', '', 'Brændstof', 1), -(5097, 'DK-STD', 'Omkostninger', '', '1410', '', 'Bilforsikring', 1), -(5098, 'DK-STD', 'Omkostninger', '', '1420', '', 'Vedligeholdelse', 1), -(5099, 'DK-STD', 'Omkostninger', '', '1430', '', 'Grøn ejerafgift mv.', 1), -(5100, 'DK-STD', 'Omkostninger', '', '1440', '', 'Leje og leasing', 1), -(5101, 'DK-STD', 'Omkostninger', '', '1450', '', 'Bilvask og pleje af bil', 1), -(5102, 'DK-STD', 'Omkostninger', '', '1460', '', 'Parkeringsudgifter', 1), -(5103, 'DK-STD', 'Omkostninger', '', '1470', '', 'Biludgifter efter statens takster', 1), -(5104, 'DK-STD', 'Omkostninger', '', '1480', '', 'Fri bil', 1), -(5105, 'DK-STD', 'Omkostninger', '', '1490', '', 'Privat andel af biludgifter', 1), -(5106, 'DK-STD', 'Omkostninger', '', '1600', '', 'Husleje uden forbrug', 1), -(5107, 'DK-STD', 'Omkostninger', '', '1610', '', 'Forbrugsudgifter (el, vand, gas og varme mv)', 1), -(5108, 'DK-STD', 'Omkostninger', '', '1620', '', 'Ejendomsskatter og forsikringer', 1), -(5109, 'DK-STD', 'Omkostninger', '', '1630', '', 'Vedligeholdelse af lokaler', 1), -(5110, 'DK-STD', 'Omkostninger', '', '1700', '', 'Kontorartikler og tryksager', 1), -(5111, 'DK-STD', 'Omkostninger', '', '1705', '', 'Telefon og internet', 1), -(5112, 'DK-STD', 'Omkostninger', '', '1710', '', 'Fri telefon privat andel', 1), -(5113, 'DK-STD', 'Omkostninger', '', '1715', '', 'Anskaffelse af småaktiver', 1), -(5114, 'DK-STD', 'Omkostninger', '', '1720', '', 'Arbejdstøj', 1), -(5115, 'DK-STD', 'Omkostninger', '', '1725', '', 'Rådgiverudgifter', 1), -(5116, 'DK-STD', 'Omkostninger', '', '1730', '', 'Porto og gebyrer', 1), -(5117, 'DK-STD', 'Omkostninger', '', '1735', '', 'Forsikringer', 1), -(5118, 'DK-STD', 'Omkostninger', '', '1740', '', 'Bøger og faglitteratur', 1), -(5119, 'DK-STD', 'Omkostninger', '', '1745', '', 'Konstaterede tab på debitorer', 1), -(5120, 'DK-STD', 'Omkostninger', '', '1750', '', 'Kassedifferencer', 1), -(5121, 'DK-STD', 'Afskrivninger', '', '2000', '', 'Afskrivning driftsmidler og inventar', 1), -(5122, 'DK-STD', 'Afskrivninger', '', '2010', '', 'Afskrivning blandede driftsmidler', 1), -(5123, 'DK-STD', 'Afskrivninger', '', '2020', '', 'Afskrivninger privat andel', 1), -(5124, 'DK-STD', 'Afskrivninger', '', '2030', '', 'Gevinst og tab ved salg af aktiver', 1), -(5125, 'DK-STD', 'Finansielle poster', '', '2400', '', 'Renteindtægter bank', 1), -(5126, 'DK-STD', 'Finansielle poster', '', '2410', '', 'Renteindtægter kunder', 1), -(5127, 'DK-STD', 'Finansielle poster', '', '2500', '', 'Renteudgifter bank og realkreditinstitut', 1), -(5128, 'DK-STD', 'Finansielle poster', '', '2510', '', 'Renteudgifter leverandører', 1), -(5129, 'DK-STD', 'Finansielle poster', '', '2520', '', 'Fradragsberettigede låneomkostninger', 1), -(5130, 'DK-STD', 'Finansielle poster', '', '2530', '', 'Fradragsberettigede renteudgifter til det offentlige', 1), -(5131, 'DK-STD', 'Balance', '', '3000', '', 'Afskrivningsgrundlag primo', 1), -(5132, 'DK-STD', 'Balance', '', '3010', '', 'Årets køb', 1), -(5133, 'DK-STD', 'Balance', '', '3015', '', 'Årets forbedringer', 1), -(5134, 'DK-STD', 'Balance', '', '3020', '', 'Årest salg', 1), -(5135, 'DK-STD', 'Balance', '', '3030', '', 'Årets afskrivning', 1), -(5136, 'DK-STD', 'Balance', '', '3040', '', 'Gevinst og tab', 1), -(5137, 'DK-STD', 'Balance', '', '3100', '', 'Afskrivningsgrundlag primo', 1), -(5138, 'DK-STD', 'Balance', '', '3110', '', 'Årets køb', 1), -(5139, 'DK-STD', 'Balance', '', '3115', '', 'Årets forbedringer', 1), -(5140, 'DK-STD', 'Balance', '', '3120', '', 'Årets salg', 1), -(5141, 'DK-STD', 'Balance', '', '3130', '', 'Årets afskrivning', 1), -(5142, 'DK-STD', 'Balance', '', '3140', '', 'Gevinst og tab', 1), -(5143, 'DK-STD', 'Balance', '', '3900', '', 'Huslejedepositum', 1), -(5144, 'DK-STD', 'Balance', '', '4000', '', 'Kasse', 1), -(5145, 'DK-STD', 'Balance', '', '4010', '', 'Bank', 1), -(5146, 'DK-STD', 'Balance', '', '4020', '', 'Forudbetalte omkostninger', 1), -(5147, 'DK-STD', 'Balance', '', '4030', '', 'Debitorer', 1), -(5148, 'DK-STD', 'Balance', '', '4040', '', 'Varelager', 1), -(5149, 'DK-STD', 'Balance', '', '4050', '', 'Igangværende arbejder', 1), -(5150, 'DK-STD', 'Balance', '', '5000', '', 'Egenkapital primo', 1), -(5151, 'DK-STD', 'Balance', '', '5010', '', 'Årets resultat', 1), -(5152, 'DK-STD', 'Balance', '', '5020', '', 'Privat hævet', 1), -(5153, 'DK-STD', 'Balance', '', '5030', '', 'Fri bil', 1), -(5154, 'DK-STD', 'Balance', '', '5040', '', 'Statens takster', 1), -(5155, 'DK-STD', 'Balance', '', '5050', '', 'Fri telefon m.v.', 1), -(5156, 'DK-STD', 'Balance', '', '5060', '', 'Private andele', 1), -(5157, 'DK-STD', 'Balance', '', '5065', '', 'Private afskrivninger', 1), -(5158, 'DK-STD', 'Balance', '', '5070', '', 'Driftsudgifter u/fradrag', 1), -(5159, 'DK-STD', 'Balance', '', '5080', '', 'Privat udlæg', 1), -(5160, 'DK-STD', 'Balance', '', '5090', '', 'Indskud', 1), -(5161, 'DK-STD', 'Balance', '', '7000', '', 'Gæld bank og realkreditinstitut', 1), -(5162, 'DK-STD', 'Balance', '', '7010', '', 'Gæld til leverandører af varer og tjenesteydelser', 1), -(5163, 'DK-STD', 'Balance', '', '7020', '', 'Periodeafgrænsningsposter', 1), -(5164, 'DK-STD', 'Balance', '', '7030', '', 'Anden gæld', 1), -(5165, 'DK-STD', 'Balance', '', '8000', '', 'Salgsmoms', 1), -(5166, 'DK-STD', 'Balance', '', '8010', '', 'Købsmoms', 1), -(5167, 'DK-STD', 'Balance', '', '8020', '', 'Konto for afgift af varekøb i EU', 1), -(5168, 'DK-STD', 'Balance', '', '8030', '', 'Konto for afgift af købte ydelser i EU', 1), -(5169, 'DK-STD', 'Balance', '', '8040', '', 'El- afgift', 1), -(5170, 'DK-STD', 'Balance', '', '8050', '', 'Øvrige energiafgifter', 1), -(5171, 'DK-STD', 'Balance', '', '8060', '', 'Betalt moms', 1) +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5082, 'DK-STD', 'Indtægter', '', '1000', '', 'Salg af varer/ydelser m. moms', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5083, 'DK-STD', 'Indtægter', '', '1010', '', 'Salg af varer EU', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5084, 'DK-STD', 'Indtægter', '', '1020', '', 'Salg af ydelser EU', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5085, 'DK-STD', 'Indtægter', '', '1030', '', 'Ej momspligtigt salg', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5086, 'DK-STD', 'Indtægter', '', '1040', '', 'Regulering igangværende arbejder', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5087, 'DK-STD', 'Omkostninger', '', '1100', '', 'Varekøb med moms', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5088, 'DK-STD', 'Omkostninger', '', '1110', '', 'Køb af varer EU', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5089, 'DK-STD', 'Omkostninger', '', '1120', '', 'Køb af ydelser EU', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5090, 'DK-STD', 'Omkostninger', '', '1130', '', 'Varelagerregulering', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5091, 'DK-STD', 'Omkostninger', '', '1140', '', 'Eget vareforbrug', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5092, 'DK-STD', 'Omkostninger', '', '1300', '', 'Repræsentation', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5093, 'DK-STD', 'Omkostninger', '', '1310', '', 'Annoncer/reklame', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5094, 'DK-STD', 'Omkostninger', '', '1320', '', 'Rejseudgifter', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5095, 'DK-STD', 'Omkostninger', '', '1330', '', 'Aviser og blade', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5096, 'DK-STD', 'Omkostninger', '', '1400', '', 'Brændstof', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5097, 'DK-STD', 'Omkostninger', '', '1410', '', 'Bilforsikring', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5098, 'DK-STD', 'Omkostninger', '', '1420', '', 'Vedligeholdelse', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5099, 'DK-STD', 'Omkostninger', '', '1430', '', 'Grøn ejerafgift mv.', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5100, 'DK-STD', 'Omkostninger', '', '1440', '', 'Leje og leasing', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5101, 'DK-STD', 'Omkostninger', '', '1450', '', 'Bilvask og pleje af bil', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5102, 'DK-STD', 'Omkostninger', '', '1460', '', 'Parkeringsudgifter', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5103, 'DK-STD', 'Omkostninger', '', '1470', '', 'Biludgifter efter statens takster', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5104, 'DK-STD', 'Omkostninger', '', '1480', '', 'Fri bil', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5105, 'DK-STD', 'Omkostninger', '', '1490', '', 'Privat andel af biludgifter', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5106, 'DK-STD', 'Omkostninger', '', '1600', '', 'Husleje uden forbrug', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5107, 'DK-STD', 'Omkostninger', '', '1610', '', 'Forbrugsudgifter (el, vand, gas og varme mv)', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5108, 'DK-STD', 'Omkostninger', '', '1620', '', 'Ejendomsskatter og forsikringer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5109, 'DK-STD', 'Omkostninger', '', '1630', '', 'Vedligeholdelse af lokaler', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5110, 'DK-STD', 'Omkostninger', '', '1700', '', 'Kontorartikler og tryksager', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5111, 'DK-STD', 'Omkostninger', '', '1705', '', 'Telefon og internet', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5112, 'DK-STD', 'Omkostninger', '', '1710', '', 'Fri telefon privat andel', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5113, 'DK-STD', 'Omkostninger', '', '1715', '', 'Anskaffelse af småaktiver', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5114, 'DK-STD', 'Omkostninger', '', '1720', '', 'Arbejdstøj', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5115, 'DK-STD', 'Omkostninger', '', '1725', '', 'Rådgiverudgifter', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5116, 'DK-STD', 'Omkostninger', '', '1730', '', 'Porto og gebyrer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5117, 'DK-STD', 'Omkostninger', '', '1735', '', 'Forsikringer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5118, 'DK-STD', 'Omkostninger', '', '1740', '', 'Bøger og faglitteratur', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5119, 'DK-STD', 'Omkostninger', '', '1745', '', 'Konstaterede tab på debitorer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5120, 'DK-STD', 'Omkostninger', '', '1750', '', 'Kassedifferencer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5121, 'DK-STD', 'Afskrivninger', '', '2000', '', 'Afskrivning driftsmidler og inventar', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5122, 'DK-STD', 'Afskrivninger', '', '2010', '', 'Afskrivning blandede driftsmidler', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5123, 'DK-STD', 'Afskrivninger', '', '2020', '', 'Afskrivninger privat andel', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5124, 'DK-STD', 'Afskrivninger', '', '2030', '', 'Gevinst og tab ved salg af aktiver', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5125, 'DK-STD', 'Finansielle poster', '', '2400', '', 'Renteindtægter bank', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5126, 'DK-STD', 'Finansielle poster', '', '2410', '', 'Renteindtægter kunder', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5127, 'DK-STD', 'Finansielle poster', '', '2500', '', 'Renteudgifter bank og realkreditinstitut', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5128, 'DK-STD', 'Finansielle poster', '', '2510', '', 'Renteudgifter leverandører', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5129, 'DK-STD', 'Finansielle poster', '', '2520', '', 'Fradragsberettigede låneomkostninger', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5130, 'DK-STD', 'Finansielle poster', '', '2530', '', 'Fradragsberettigede renteudgifter til det offentlige', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5131, 'DK-STD', 'Balance', '', '3000', '', 'Afskrivningsgrundlag primo', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5132, 'DK-STD', 'Balance', '', '3010', '', 'Årets køb', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5133, 'DK-STD', 'Balance', '', '3015', '', 'Årets forbedringer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5134, 'DK-STD', 'Balance', '', '3020', '', 'Årest salg', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5135, 'DK-STD', 'Balance', '', '3030', '', 'Årets afskrivning', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5136, 'DK-STD', 'Balance', '', '3040', '', 'Gevinst og tab', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5137, 'DK-STD', 'Balance', '', '3100', '', 'Afskrivningsgrundlag primo', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5138, 'DK-STD', 'Balance', '', '3110', '', 'Årets køb', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5139, 'DK-STD', 'Balance', '', '3115', '', 'Årets forbedringer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5140, 'DK-STD', 'Balance', '', '3120', '', 'Årets salg', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5141, 'DK-STD', 'Balance', '', '3130', '', 'Årets afskrivning', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5142, 'DK-STD', 'Balance', '', '3140', '', 'Gevinst og tab', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5143, 'DK-STD', 'Balance', '', '3900', '', 'Huslejedepositum', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5144, 'DK-STD', 'Balance', '', '4000', '', 'Kasse', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5145, 'DK-STD', 'Balance', '', '4010', '', 'Bank', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5146, 'DK-STD', 'Balance', '', '4020', '', 'Forudbetalte omkostninger', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5147, 'DK-STD', 'Balance', '', '4030', '', 'Debitorer', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5148, 'DK-STD', 'Balance', '', '4040', '', 'Varelager', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5149, 'DK-STD', 'Balance', '', '4050', '', 'Igangværende arbejder', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5150, 'DK-STD', 'Balance', '', '5000', '', 'Egenkapital primo', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5151, 'DK-STD', 'Balance', '', '5010', '', 'Årets resultat', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5152, 'DK-STD', 'Balance', '', '5020', '', 'Privat hævet', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5153, 'DK-STD', 'Balance', '', '5030', '', 'Fri bil', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5154, 'DK-STD', 'Balance', '', '5040', '', 'Statens takster', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5155, 'DK-STD', 'Balance', '', '5050', '', 'Fri telefon m.v.', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5156, 'DK-STD', 'Balance', '', '5060', '', 'Private andele', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5157, 'DK-STD', 'Balance', '', '5065', '', 'Private afskrivninger', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5158, 'DK-STD', 'Balance', '', '5070', '', 'Driftsudgifter u/fradrag', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5159, 'DK-STD', 'Balance', '', '5080', '', 'Privat udlæg', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5160, 'DK-STD', 'Balance', '', '5090', '', 'Indskud', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5161, 'DK-STD', 'Balance', '', '7000', '', 'Gæld bank og realkreditinstitut', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5162, 'DK-STD', 'Balance', '', '7010', '', 'Gæld til leverandører af varer og tjenesteydelser', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5163, 'DK-STD', 'Balance', '', '7020', '', 'Periodeafgrænsningsposter', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5164, 'DK-STD', 'Balance', '', '7030', '', 'Anden gæld', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5165, 'DK-STD', 'Balance', '', '8000', '', 'Salgsmoms', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5166, 'DK-STD', 'Balance', '', '8010', '', 'Købsmoms', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5167, 'DK-STD', 'Balance', '', '8020', '', 'Konto for afgift af varekøb i EU', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5168, 'DK-STD', 'Balance', '', '8030', '', 'Konto for afgift af købte ydelser i EU', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5169, 'DK-STD', 'Balance', '', '8040', '', 'El- afgift', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5170, 'DK-STD', 'Balance', '', '8050', '', 'Øvrige energiafgifter', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (5171, 'DK-STD', 'Balance', '', '8060', '', 'Betalt moms', 1); From 7f8d791d39517085c2cb2ebef7213ef33752d376 Mon Sep 17 00:00:00 2001 From: Gitdyr Date: Sun, 10 Sep 2017 07:24:38 +0200 Subject: [PATCH 09/17] Revert "Remove processing by htmlentities()" This reverts commit e555233dc12c1a206ae41754df78f2086cbba110. --- htdocs/core/class/translate.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 180b4db0ba6..169aec16307 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -620,6 +620,15 @@ class Translate if ($maxsize) $str=dol_trunc($str,$maxsize); + // We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities + $str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str); + + // Crypt string into HTML + $str=htmlentities($str,ENT_QUOTES,$this->charset_output); + + // Restore HTML tags + $str=str_replace(array('__lt__','__gt__','__quot__'),array('<','>','"',),$str); + return $str; } else // Translation is not available From f8938f308d90532d6021297fe93103793b60e7c2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 11 Sep 2017 08:17:25 +0200 Subject: [PATCH 10/17] Fix: remove table prefix --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 2 +- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 283981ad4a0..098677d96c7 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -63,7 +63,7 @@ ALTER TABLE llx_mailing MODIFY COLUMN langs varchar(64); ALTER TABLE llx_facture_fourn ADD COLUMN date_pointoftax date DEFAULT NULL; ALTER TABLE llx_facture_fourn ADD COLUMN date_valid date; -ALTER TABLE llx_bookmark DROP COLUM fk_soc; +ALTER TABLE llx_bookmark DROP COLUMN fk_soc; ALTER TABLE llx_website MODIFY COLUMN ref varchar(128); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8e210a01c6c..393f1af1a16 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -44,7 +44,7 @@ class Societe extends CommonObject public $table_element = 'societe'; public $fk_element='fk_soc'; protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object - protected $childtablesoncascade=array("llx_societe_prices", "llx_societe_log", "llx_societe_address", "llx_product_fournisseur_price", "llx_product_customer_price_log", "llx_product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "llx_categorie", "llx_notify", "llx_notfy_def"); + protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notfy_def"); /** From 092b87bbda00ea514873784ec6c127fb120a96a3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 11 Sep 2017 13:36:03 +0200 Subject: [PATCH 11/17] Fix: add llx_actioncomm in $childtablesoncascade --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 393f1af1a16..161aec10d8f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -44,7 +44,7 @@ class Societe extends CommonObject public $table_element = 'societe'; public $fk_element='fk_soc'; protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object - protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notfy_def"); + protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notfy_def", "actioncomm"); /** From 59ab52c7182654ef9ea94ecf3fed6af4db3a0a27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2017 13:39:03 +0200 Subject: [PATCH 12/17] FIX hidden option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN --- htdocs/commande/card.php | 3 ++- htdocs/commande/class/commande.class.php | 3 ++- htdocs/compta/facture/card.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6d62f6c129a..03c91b69710 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -398,6 +398,7 @@ if (empty($reshook)) } // Now we create same links to contact than the ones found on origin object + /* Useless, already into the create if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) { $originforcontact = $object->origin; @@ -420,7 +421,7 @@ if (empty($reshook)) } } else dol_print_error($resqlcontact); - } + }*/ // Hooks $parameters = array('objFrom' => $srcobject); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3262a563f4c..5785e73bac4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -920,7 +920,8 @@ class Commande extends CommonOrder foreach ($exp->linkedObjectsIds['commande'] as $key => $value) { $originforcontact = 'commande'; - $originidforcontact = $value->id; + if (is_object($value)) $originidforcontact = $value->id; + else $originidforcontact = $value; break; // We take first one } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 23b310fd9f7..248bc31737d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1299,6 +1299,7 @@ if (empty($reshook)) } // Now we create same links to contact than the ones found on origin object + /* Useless, already into the create if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) { $originforcontact = $object->origin; @@ -1321,7 +1322,7 @@ if (empty($reshook)) } } else dol_print_error($resqlcontact); - } + }*/ // Hooks $parameters = array('objFrom' => $srcobject); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d05ad059577..572e59e737a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -498,7 +498,8 @@ class Facture extends CommonInvoice foreach ($exp->linkedObjectsIds['commande'] as $key => $value) { $originforcontact = 'commande'; - $originidforcontact = $value->id; + if (is_object($value)) $originidforcontact = $value->id; + else $originidforcontact = $value; break; // We take first one } } From dcc9cb4a165d88befaefc45d881e5b65b34d0a36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2017 14:29:27 +0200 Subject: [PATCH 13/17] Some fixes in various payment --- htdocs/core/class/html.formprojet.class.php | 3 +++ htdocs/install/mysql/tables/llx_payment_various.sql | 4 ++-- htdocs/projet/element.php | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 524bd82ddd1..798c4981eba 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -509,6 +509,9 @@ class FormProjets $sql = 'SELECT t.rowid, t.label as ref'; $projectkey='fk_origin'; break; + case "payment_various": + $sql = "SELECT t.rowid, t.num_payment as ref"; + break; case "chargesociales": default: $sql = "SELECT t.rowid, t.ref"; diff --git a/htdocs/install/mysql/tables/llx_payment_various.sql b/htdocs/install/mysql/tables/llx_payment_various.sql index e92b244b009..e719dae7d8c 100644 --- a/htdocs/install/mysql/tables/llx_payment_various.sql +++ b/htdocs/install/mysql/tables/llx_payment_various.sql @@ -19,6 +19,8 @@ create table llx_payment_various ( rowid integer AUTO_INCREMENT PRIMARY KEY, + num_payment varchar(50), -- ref + label varchar(255), tms timestamp, datec datetime, -- Create date datep date, -- date de paiement @@ -26,8 +28,6 @@ create table llx_payment_various sens smallint DEFAULT 0 NOT NULL,-- Sens of the operation: 0 for debit operation, 1 for credit operation amount double(24,8) DEFAULT 0 NOT NULL, fk_typepayment integer NOT NULL, - num_payment varchar(50), -- ref - label varchar(255), accountancy_code varchar(32), fk_projet integer DEFAULT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 0dcb710cfb5..1e4d4132944 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -448,7 +448,7 @@ $listofreferent=array( 'datefieldname'=>'datev', 'margin'=>'minus', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/compta/bank_various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid, 'lang'=>'banks', 'buttonnew'=>'AddVariousPayment', 'testnew'=>$user->rights->banque->modifier, @@ -731,7 +731,7 @@ foreach ($listofreferent as $key => $value) if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS; } - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, array('payment_various'))) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300'); if (! $selectList || ($selectList<0)) From 22b88181009d55d7fdd7c0efcdf3d4afd73ee954 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2017 14:41:46 +0200 Subject: [PATCH 14/17] FIX #7359 --- htdocs/fichinter/class/fichinter.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index eaf10c357e4..b9bb40bdd7a 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -559,9 +559,10 @@ class Fichinter extends CommonObject /** * Returns amount based on user thm * - * @return float amount + * @return float Amount */ - function getAmount() { + function getAmount() + { global $db; $amount = 0; @@ -571,13 +572,11 @@ class Fichinter extends CommonObject $thm = $this->author->thm; - foreach($this->lines as &$line) { - - $amount+=$line->qty * $thm; - + foreach($this->lines as $line) { + $amount += ($line->duration / 60 / 60 * $thm); } - return $amount; + return price2num($amount, 'MT'); } /** From f0f6df4c903122fa729638bba2df8358bdadb508 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2017 15:23:49 +0200 Subject: [PATCH 15/17] Fix tables declaration --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 8 ++++---- htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql | 2 +- htdocs/install/mysql/tables/llx_c_exp_tax_range.sql | 2 +- htdocs/install/mysql/tables/llx_expensereport_ik.sql | 2 +- htdocs/install/mysql/tables/llx_projet_task_comment.sql | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index d866369fedf..14b1e424469 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -98,14 +98,14 @@ CREATE TABLE IF NOT EXISTS llx_expensereport_ik ( fk_range integer DEFAULT 0 NOT NULL, coef double DEFAULT 0 NOT NULL, offset double DEFAULT 0 NOT NULL -)ENGINE=innodb DEFAULT CHARSET=utf8; +)ENGINE=innodb; CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat ( rowid integer AUTO_INCREMENT PRIMARY KEY, label varchar(48) NOT NULL, entity integer DEFAULT 1 NOT NULL, active integer DEFAULT 1 NOT NULL -)ENGINE=innodb DEFAULT CHARSET=utf8; +)ENGINE=innodb; CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -113,7 +113,7 @@ CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range ( range_ik double DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, active integer DEFAULT 1 NOT NULL -)ENGINE=innodb DEFAULT CHARSET=utf8; +)ENGINE=innodb; INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES ('EX_KME', 'ExpLabelKm', 1, '625100'), @@ -258,7 +258,7 @@ CREATE TABLE llx_projet_task_comment ( fk_task integer DEFAULT NULL, entity integer DEFAULT 1, import_key varchar(125) DEFAULT NULL -); +)ENGINE=innodb; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; diff --git a/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql b/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql index 9caea48ca21..e7227b2a2e9 100644 --- a/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql +++ b/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql @@ -23,4 +23,4 @@ CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat ( label varchar(48) NOT NULL, entity integer DEFAULT 1 NOT NULL, active integer DEFAULT 1 NOT NULL -)ENGINE=innodb DEFAULT CHARSET=utf8; \ No newline at end of file +)ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_c_exp_tax_range.sql b/htdocs/install/mysql/tables/llx_c_exp_tax_range.sql index 4b60557851a..f108549eb45 100644 --- a/htdocs/install/mysql/tables/llx_c_exp_tax_range.sql +++ b/htdocs/install/mysql/tables/llx_c_exp_tax_range.sql @@ -24,4 +24,4 @@ CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range ( range_ik double DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, active integer DEFAULT 1 NOT NULL -)ENGINE=innodb DEFAULT CHARSET=utf8; +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expensereport_ik.sql b/htdocs/install/mysql/tables/llx_expensereport_ik.sql index 13f1a8067d6..8debb56921c 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_ik.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_ik.sql @@ -26,4 +26,4 @@ CREATE TABLE IF NOT EXISTS llx_expensereport_ik ( fk_range integer DEFAULT 0 NOT NULL, coef double DEFAULT 0 NOT NULL, offset double DEFAULT 0 NOT NULL -)ENGINE=innodb DEFAULT CHARSET=utf8; \ No newline at end of file +)ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_projet_task_comment.sql b/htdocs/install/mysql/tables/llx_projet_task_comment.sql index 42fe572958a..561f8276455 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_comment.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_comment.sql @@ -25,4 +25,4 @@ CREATE TABLE llx_projet_task_comment ( fk_task integer DEFAULT NULL, entity integer DEFAULT 1, import_key varchar(125) DEFAULT NULL -); +) ENGINE=innodb; From 8cb9e8c2da98cc65a2de0e3c650388c48c737792 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2017 16:26:01 +0200 Subject: [PATCH 16/17] Add $object into hooks --- htdocs/modulebuilder/template/myobject_list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 97b7421a001..e034fae2cf6 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -147,7 +147,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -208,7 +208,7 @@ foreach($object->fields as $key => $val) foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql=preg_replace('/, $/','', $sql); $sql.= " FROM ".MAIN_DB_PREFIX."myobject as t"; @@ -236,7 +236,7 @@ foreach ($search_array_options as $key => $val) } // Add where from hooks $parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.=$db->order($sortfield,$sortorder); @@ -341,7 +341,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': Date: Mon, 11 Sep 2017 16:31:44 +0200 Subject: [PATCH 17/17] Save space --- htdocs/public/onlinesign/newonlinesign.php | 4 ++-- htdocs/public/paybox/newpayment.php | 4 ++-- htdocs/public/payment/newpayment.php | 4 ++-- htdocs/public/paypal/newpayment.php | 4 ++-- htdocs/public/stripe/newpayment.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index dc81934dd95..63617076a1b 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -205,8 +205,8 @@ if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) } if (empty($text)) { - $text.='
'.$langs->trans("WelcomeOnOnlineSignaturePage").'
'."\n"; - $text.='
'.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'

'."\n"; + $text.='
'.$langs->trans("WelcomeOnOnlineSignaturePage").''."\n"; + $text.=''.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'

'."\n"; } print $text; diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 22d2e4ddc00..0d8e930c95c 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -243,8 +243,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT)) } if (empty($text)) { - $text.='
'.$langs->trans("WelcomeOnPaymentPage").'
'."\n"; - $text.='
'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; + $text.='
'.$langs->trans("WelcomeOnPaymentPage").''."\n"; + $text.=''.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; } print $text; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 620ac797818..1bf86f9ffbc 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -594,8 +594,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT)) } if (empty($text)) { - $text.='
'.$langs->trans("WelcomeOnPaymentPage").'
'."\n"; - $text.='
'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; + $text.='
'.$langs->trans("WelcomeOnPaymentPage").''."\n"; + $text.=''.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; } print $text; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index efbe9b1b682..310f553269b 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -348,8 +348,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT)) } if (empty($text)) { - $text.='
'.$langs->trans("WelcomeOnPaymentPage").'
'."\n"; - $text.='
'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; + $text.='
'.$langs->trans("WelcomeOnPaymentPage").''."\n"; + $text.=''.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; } print $text; diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index e12cb194c4d..f74e7bd0295 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -411,8 +411,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT)) } if (empty($text)) { - $text.='
'.$langs->trans("WelcomeOnPaymentPage").'
'."\n"; - $text.='
'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; + $text.='
'.$langs->trans("WelcomeOnPaymentPage").''."\n"; + $text.=''.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'

'."\n"; } print $text;