Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Rui Strecht 2017-09-11 15:56:48 +01:00
commit 5213ce60c5
31 changed files with 1034 additions and 48 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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
}
}

View File

@ -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);

View File

@ -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
}
}

View File

@ -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";

View File

@ -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);
}

View File

@ -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->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':'');
$head[$h][1] = $langs->trans("TaskCommentLinks");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$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';

View File

@ -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,43 @@ 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');
}
/**
* 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);
}
/**

View File

@ -2209,3 +2209,100 @@ 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) 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);

View File

@ -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);

View File

@ -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);
@ -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'),
@ -249,6 +249,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
)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;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8;

View File

@ -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;
)ENGINE=innodb;

View File

@ -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;

View File

@ -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;
)ENGINE=innodb;

View File

@ -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

View File

@ -0,0 +1,28 @@
-- ===========================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===========================================================================
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
) ENGINE=innodb;

View File

@ -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

View File

@ -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

View File

@ -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') . ': <input type="text" name="search_
$moreforfilter.= '</div>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
@ -397,7 +397,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Rest of fields search
foreach($object->fields as $key => $val)
@ -445,7 +445,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Rest of fields title
foreach($object->fields as $key => $val)
@ -535,7 +535,7 @@ while ($i < min($num, $limit))
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Rest of fields
foreach($object->fields as $key => $val)
@ -610,7 +610,7 @@ if ($num == 0)
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";

View File

@ -918,6 +918,15 @@ print '</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowCommentOnTask").'</td>';
print '<td align="center" width="300">';
echo ajax_constantonoff('PROJECT_ALLOW_COMMENT_ON_TASK');
print '</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '</tr>';
print '</table></form>';

View File

@ -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;
@ -257,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
{
@ -1777,4 +1783,332 @@ 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()
{
$this->comments = array();
$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;
}
}
}

View File

@ -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))

View File

@ -0,0 +1,393 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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);
$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 = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Title
$morehtmlref.=$projectstatic->title;
// Thirdparty
if ($projectstatic->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
$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 '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject');
print '</td></tr>';
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($projectstatic->date_start,'day');
$end=dol_print_date($projectstatic->date_end,'day');
if ($end) print ' - '.$end;
print '</td></tr>';
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>';
// Other attributes
$cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description);
print '</td></tr>';
// Categories
if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id,'project',1);
print "</td></tr>";
}
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
print '<br>';
}
$head=task_prepare_head($task);
/*
* Fiche tache en mode visu
*/
$param=($withproject?'&withproject=1':'');
$linkback=$withproject?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>':'';
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.='<div class="refidno">';
$morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>';
// Third party
$morehtmlref.=$langs->trans("ThirdParty").': ';
if (!empty($projectstatic->thirdparty)) {
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref.='</div>';
}
dol_banner_tab($task, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Nb comments
print '<td class="tdtop">'.$langs->trans("TaskNbComments").'</td><td>';
print $task->getNbComments();
print '</td></tr>';
// Other attributes
$cols = 3;
$parameyers=array('socid'=>$socid);
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
dol_fiche_end();
print '<br>';
print '<div id="comment">';
// Add comment
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addcomment">';
print '<input type="hidden" name="id" value="'.$task->id.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
print '<td width="25%">'.$langs->trans("Comments").'</td>';
print '<td width="25%"></td>';
print '<td width="25%"></td>';
print '<td width="25%"></td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td></td>';
// Description
print '<td colspan="2">';
$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 '</td>';
print '<td align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td></tr>';
print '</table></form>';
// 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 '<div class="width100p clearboth">';
if($comment->fk_user == $user->id) {
print '<div class="width25p float">&nbsp;</div>';
}
print '<div class="width75p float comment" style="background-color:#'.$TColors[$fk_user].'">';
print '<div class="comment-description">';
print $comment->description;
print '</div>';
print '<div class="comment-info">';
print $langs->trans('User').' : '.$userstatic->getNomUrl().'<br/>';
print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec');
if(($first && $fk_user == $user->id) || $user->admin == 1) {
print '<br/> <a href="?action=deletecomment&id='.$id.'&withproject=1&idcomment='.$comment->id.'">'.$langs->trans('Delete').'</a>';
}
print '</div>';
print '</div>';
if($comment->fk_user != $user->id) {
print '<div class="width25p float">&nbsp;</div>';
}
$first = false;
}
}
print '<br>';
print '</div>';
}
}
llxFooter();
$db->close();

View File

@ -205,8 +205,8 @@ if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT))
}
if (empty($text))
{
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage").'</strong><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br>'.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'<br><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage").'</strong></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'<br><br></td></tr>'."\n";
}
print $text;

View File

@ -243,8 +243,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
}
if (empty($text))
{
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br>'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
}
print $text;

View File

@ -594,8 +594,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
}
if (empty($text))
{
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br>'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
}
print $text;

View File

@ -348,8 +348,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
}
if (empty($text))
{
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br>'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
}
print $text;

View File

@ -411,8 +411,8 @@ if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
}
if (empty($text))
{
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br>'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n";
$text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
}
print $text;

View File

@ -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", "actioncomm");
/**

View File

@ -827,6 +827,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)
{
@ -3800,6 +3810,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 */