Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop Conflicts: htdocs/langs/nl_NL/main.lang
This commit is contained in:
commit
02a5755876
@ -458,8 +458,8 @@ if ($result) {
|
||||
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
|
||||
|
||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||
$accountingaccountstatic->label = $objp->label;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -194,7 +194,7 @@ print '<script type="text/javascript">
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||
$sql .= " aa.label, aa.labelshort, aa.account_number,";
|
||||
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
|
||||
@ -459,8 +459,8 @@ if ($result) {
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy;
|
||||
|
||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||
$accountingaccountstatic->label = $objp->label;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -513,7 +513,7 @@ if ($result) {
|
||||
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
@ -56,16 +56,22 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'p
|
||||
$facid = GETPOST('facid', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$day = GETPOST('day', 'int');
|
||||
$month = GETPOST('month', 'int');
|
||||
$year = GETPOST('year', 'int');
|
||||
|
||||
$search_ref = GETPOST("search_ref", "alpha");
|
||||
$search_company = GETPOST("search_company", 'alpha');
|
||||
$search_paymenttype = GETPOST("search_paymenttype");
|
||||
$search_account = GETPOST("search_account", "int");
|
||||
$search_payment_num = GETPOST('search_payment_num', 'alpha');
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_company = GETPOST("search_company", 'alpha');
|
||||
$search_paymenttype = GETPOST("search_paymenttype");
|
||||
$search_account = GETPOST("search_account", "int");
|
||||
$search_payment_num = GETPOST('search_payment_num', 'alpha');
|
||||
$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
|
||||
$search_status = GETPOST('search_status', 'intcomma');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -130,14 +136,20 @@ if (empty($reshook)) {
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_ref = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_account = '';
|
||||
$search_amount = '';
|
||||
$search_paymenttype = '';
|
||||
$search_payment_num = '';
|
||||
$search_company = '';
|
||||
$day = '';
|
||||
$year = '';
|
||||
$month = '';
|
||||
$search_status = '';
|
||||
$option = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
@ -211,10 +223,15 @@ if (GETPOST("orphelins", "alpha")) {
|
||||
}
|
||||
|
||||
// Search criteria
|
||||
$sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
}
|
||||
if ($search_account > 0) {
|
||||
$sql .= " AND b.fk_account=".((int) $search_account);
|
||||
}
|
||||
@ -273,11 +290,40 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
$param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
|
||||
$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
|
||||
$param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
|
||||
$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
|
||||
$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
|
||||
|
||||
if (GETPOST("orphelins")) {
|
||||
$param .= '&orphelins=1';
|
||||
}
|
||||
if ($search_ref) {
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
}
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_company) {
|
||||
$param .= '&search_company='.urlencode($search_company);
|
||||
}
|
||||
if ($search_amount != '') {
|
||||
$param .= '&search_amount='.urlencode($search_amount);
|
||||
}
|
||||
if ($search_payment_num) {
|
||||
$param .= '&search_payment_num='.urlencode($search_payment_num);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
@ -305,10 +351,12 @@ if ($search_all) {
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$massactionbutton = '';
|
||||
if ($massactionbutton) {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
|
||||
|
||||
@ -331,11 +379,12 @@ if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
// Filter: Date
|
||||
if (!empty($arrayfields['p.datep']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
|
||||
}
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
|
||||
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,11 @@ class box_boms extends ModeleBoxes
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatestModifiedBoms", $max));
|
||||
|
||||
if ($user->rights->bom->read) {
|
||||
$sql = "SELECT p.ref as product_ref, p.tobuy, p.tosell";
|
||||
$sql = "SELECT p.ref as product_ref";
|
||||
$sql .= ", p.rowid as productid";
|
||||
$sql .= ", p.tosell";
|
||||
$sql .= ", p.tobuy";
|
||||
$sql .= ", p.tobatch";
|
||||
$sql .= ", c.rowid";
|
||||
$sql .= ", c.date_creation";
|
||||
$sql .= ", c.tms";
|
||||
@ -111,12 +115,13 @@ class box_boms extends ModeleBoxes
|
||||
|
||||
$bomstatic->id = $objp->rowid;
|
||||
$bomstatic->ref = $objp->ref;
|
||||
$bomstatic->id = $objp->socid;
|
||||
$bomstatic->status = $objp->status;
|
||||
|
||||
$productstatic->id = $objp->productid;
|
||||
$productstatic->ref = $objp->product_ref;
|
||||
$productstatic->status = $objp->tobuy;
|
||||
$productstatic->status_buy = $objp->tosell;
|
||||
$productstatic->status = $objp->tosell;
|
||||
$productstatic->status_buy = $objp->tobuy;
|
||||
$productstatic->status_batch = $objp->tobatch;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="nowraponall"',
|
||||
|
||||
@ -86,12 +86,15 @@ class box_mos extends ModeleBoxes
|
||||
|
||||
if ($user->rights->mrp->read) {
|
||||
$sql = "SELECT p.ref as product_ref";
|
||||
$sql .= ", p.rowid as productid";
|
||||
$sql .= ", p.tosell";
|
||||
$sql .= ", p.tobuy";
|
||||
$sql .= ", p.tobatch";
|
||||
$sql .= ", c.rowid";
|
||||
$sql .= ", c.date_creation";
|
||||
$sql .= ", c.tms";
|
||||
$sql .= ", c.ref";
|
||||
$sql .= ", c.status";
|
||||
//$sql.= ", c.fk_user_valid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."mrp_mo as c";
|
||||
$sql .= " WHERE c.fk_product = p.rowid";
|
||||
@ -110,9 +113,12 @@ class box_mos extends ModeleBoxes
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
$mostatic->id = $objp->rowid;
|
||||
$mostatic->ref = $objp->ref;
|
||||
$mostatic->id = $objp->socid;
|
||||
$mostatic->status = $objp->status;
|
||||
$productstatic->id = $objp->productid;
|
||||
$productstatic->ref = $objp->product_ref;
|
||||
$productstatic->status = $objp->tosell;
|
||||
$productstatic->status_buy = $objp->tobuy;
|
||||
$productstatic->status_batch = $objp->tobatch;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="nowraponall"',
|
||||
|
||||
@ -569,14 +569,14 @@ class FormTicket
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param string $morecss More CSS
|
||||
* @param int $use_multilevel if != 0 create a multilevel select ( Do not use any of the other params)
|
||||
* @param int $use_multilevel if > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
|
||||
* @return void
|
||||
*/
|
||||
public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0)
|
||||
{
|
||||
global $langs, $user;
|
||||
|
||||
if ($use_multilevel == 0) {
|
||||
if ($use_multilevel <= 0) {
|
||||
$ticketstat = new Ticket($this->db);
|
||||
|
||||
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
|
||||
@ -655,12 +655,13 @@ class FormTicket
|
||||
}
|
||||
|
||||
print ajax_combobox('select'.$htmlname);
|
||||
} else {
|
||||
$groupticket=GETPOST('groupticket', 'aZ09');
|
||||
$groupticketchild=GETPOST('groupticket_child', 'aZ09');
|
||||
} elseif ($htmlname!='') {
|
||||
$groupticket=GETPOST($htmlname, 'aZ09');
|
||||
$groupticketchild=GETPOST($htmlname.'_child', 'aZ09');
|
||||
$arraycodenotparent[] = "";
|
||||
$arrayidused = array();
|
||||
$stringtoprint = '<span class="supportemailfield bold">'.$langs->trans("GroupOfTicket").'</span> ';
|
||||
$stringtoprint .= '<select name="groupticket" id ="groupticket" class="maxwidth500 minwidth400">';
|
||||
$stringtoprint .= '<select name="'.$htmlname.'" id ="'.$htmlname.'" class="maxwidth500 minwidth400" child_id="0">';
|
||||
$stringtoprint .= '<option value=""> </option>';
|
||||
|
||||
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ";
|
||||
@ -682,10 +683,11 @@ class FormTicket
|
||||
$grouplabel = $obj->label;
|
||||
$isparent = $obj->isparent;
|
||||
$iselected = $groupticket == $obj->code ?'selected':'';
|
||||
$stringtoprint .= '<option '.$iselected.' class="groupticket'.dol_escape_htmltag($grouprowid).'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
|
||||
$stringtoprint .= '<option '.$iselected.' class="'.$htmlname.dol_escape_htmltag($grouprowid).'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
|
||||
if ($isparent == 'NOTPARENT') {
|
||||
$arraycodenotparent[] = $groupvalue;
|
||||
}
|
||||
$arrayidused[]=$grouprowid;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -693,68 +695,93 @@ class FormTicket
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
if ($num_rows == 1) {
|
||||
return '<input type="hidden" name="groupticket" id="groupticket" value="'.dol_escape_htmltag($groupvalue).'">';
|
||||
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
|
||||
}
|
||||
$stringtoprint .= '</select> ';
|
||||
$levelid = 1;
|
||||
while ($levelid <= $use_multilevel) {
|
||||
$tabscript = array();
|
||||
$stringtoprint .= '<select name="'.$htmlname.'_child_'.$levelid.'" id ="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">';
|
||||
$stringtoprint .= '<option value=""> </option>';
|
||||
|
||||
$stringtoprint .= '<select name="groupticket_child" id ="groupticket_child" class="maxwidth500 minwidth400">';
|
||||
$stringtoprint .= '<option value=""> </option>';
|
||||
|
||||
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctcjoin.code as codefather";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
|
||||
$sql .= " WHERE ctc.public = 1";
|
||||
$sql .= " AND ctc.active = 1";
|
||||
$sql .= " AND ctc.fk_parent <> 0";
|
||||
$sql .= $this->db->order('ctc.pos', 'ASC');
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num_rows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$grouprowid = $obj->rowid;
|
||||
$groupvalue = $obj->code;
|
||||
$grouplabel = $obj->label;
|
||||
$fatherid = $obj->fk_parent;
|
||||
$groupcodefather = $obj->codefather;
|
||||
$iselected = $groupticketchild == $obj->code ?'selected':'';
|
||||
$stringtoprint .= '<option '.$iselected.' class="groupticket_'.dol_escape_htmltag($fatherid).'_child" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
|
||||
$tabscript[] = 'if($("#groupticket")[0].value == "'.dol_escape_js($groupcodefather).'"){
|
||||
$(".groupticket_'.dol_escape_htmltag($fatherid).'_child").show()
|
||||
}else{
|
||||
$(".groupticket_'.dol_escape_htmltag($fatherid).'_child").hide()
|
||||
}';
|
||||
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctcjoin.code as codefather, ";
|
||||
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
|
||||
$sql .= " WHERE ctc.public = 1";
|
||||
$sql .= " AND ctc.active = 1";
|
||||
if (!empty($arrayidused)) {
|
||||
$sql .= " AND ctc.fk_parent IN ( ";
|
||||
foreach ($arrayidused as $idused) {
|
||||
$sql .= $idused.", ";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$stringtoprint .='</select>';
|
||||
|
||||
$stringtoprint .='<script>';
|
||||
$stringtoprint .='var arraynotparents = '.json_encode($arraycodenotparent).';';
|
||||
$stringtoprint .='if (arraynotparents.includes($("#groupticket")[0].value)){$("#groupticket_child").hide()}
|
||||
else{';
|
||||
foreach ($tabscript as $script) {
|
||||
$stringtoprint .= $script;
|
||||
};
|
||||
$stringtoprint .='}
|
||||
$("#groupticket").change(function() {
|
||||
$("#groupticket_child")[0].value = ""
|
||||
if (!arraynotparents.includes(this.value)) {
|
||||
$("#groupticket_child").show()
|
||||
$sql = substr($sql, 0, -2);
|
||||
$sql .= ")";
|
||||
} else {
|
||||
$("#groupticket_child").hide()
|
||||
}
|
||||
';
|
||||
foreach ($tabscript as $script) {
|
||||
$stringtoprint .= $script;
|
||||
};
|
||||
$stringtoprint .='})';
|
||||
$stringtoprint .='</script>';
|
||||
$sql .= $this->db->order('ctc.pos', 'ASC');
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
$arrayidused=array();
|
||||
while ($i < $num_rows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$grouprowid = $obj->rowid;
|
||||
$groupvalue = $obj->code;
|
||||
$grouplabel = $obj->label;
|
||||
$isparent = $obj->isparent;
|
||||
$fatherid = $obj->fk_parent;
|
||||
$arrayidused[] = $grouprowid;
|
||||
$groupcodefather = $obj->codefather;
|
||||
if ($isparent == 'NOTPARENT') {
|
||||
$arraycodenotparent[] = $groupvalue;
|
||||
}
|
||||
$iselected = $groupticketchild == $obj->code ?'selected':'';
|
||||
$stringtoprint .= '<option '.$iselected.' class="'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
|
||||
if (empty($tabscript[$groupcodefather])) {
|
||||
$tabscript[$groupcodefather] = 'if($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value == "'.dol_escape_js($groupcodefather).'"){
|
||||
$(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show()
|
||||
console.log("We show childs tickets of '.$groupcodefather.' group ticket")
|
||||
}else{
|
||||
$(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").hide()
|
||||
console.log("We hide childs tickets of '.$groupcodefather.' group ticket")
|
||||
}';
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$stringtoprint .='</select>';
|
||||
|
||||
$stringtoprint .='<script>';
|
||||
$stringtoprint .='arraynotparents = '.json_encode($arraycodenotparent).';';
|
||||
$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value)){$("#'.$htmlname.'_child_'.$levelid.'").hide()}
|
||||
$("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").change(function() {
|
||||
child_id = this.attributes.child_id.value;
|
||||
$(".groupticketchild").each(function(){
|
||||
if(this.attributes.child_id.value > child_id){
|
||||
this.value = ""
|
||||
$(this).attr("style", "display : none;")
|
||||
}
|
||||
})
|
||||
$("#'.$htmlname.'_child_'.$levelid.'")[0].value = ""
|
||||
if (!arraynotparents.includes(this.value)) {
|
||||
$("#'.$htmlname.'_child_'.$levelid.'").show()
|
||||
} else {
|
||||
$("#'.$htmlname.'_child_'.$levelid.'").hide()
|
||||
}
|
||||
';
|
||||
$levelid++;
|
||||
foreach ($tabscript as $script) {
|
||||
$stringtoprint .= $script;
|
||||
};
|
||||
$stringtoprint .='})';
|
||||
$stringtoprint .='</script>';
|
||||
}
|
||||
return $stringtoprint;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1306,6 +1306,13 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break
|
||||
}
|
||||
|
||||
$restrictBefore = null;
|
||||
|
||||
if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
|
||||
}
|
||||
|
||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
for ($i = 0; $i < $numlines; $i++) {
|
||||
if ($parent == 0) {
|
||||
@ -1551,6 +1558,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$disabledtask = 1;
|
||||
}
|
||||
|
||||
if ($restrictBefore && $preselectedday < $restrictBefore) {
|
||||
$disabledtask = 1;
|
||||
}
|
||||
|
||||
// Form to add new time
|
||||
print '<td class="nowrap leftborder center">';
|
||||
$tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask);
|
||||
@ -1699,6 +1710,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break
|
||||
}
|
||||
|
||||
$restrictBefore = null;
|
||||
|
||||
if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $numlines; $i++) {
|
||||
if ($parent == 0) {
|
||||
$level = 0;
|
||||
@ -1977,6 +1995,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
|
||||
$disabledtaskday = $disabledtask;
|
||||
|
||||
if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
|
||||
$disabledtaskday = 1;
|
||||
}
|
||||
|
||||
$tableCell = '<td class="center hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">';
|
||||
//$tableCell .= 'idw='.$idw.' '.$conf->global->MAIN_START_WEEK.' '.$numstartworkingday.'-'.$numendworkingday;
|
||||
$placeholder = '';
|
||||
@ -1985,7 +2009,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
//$placeholder=' placeholder="00:00"';
|
||||
//$tableCell.='+';
|
||||
}
|
||||
$tableCell .= '<input type="text" alt="'.($disabledtask ? '' : $alttitle).'" title="'.($disabledtask ? '' : $alttitle).'" '.($disabledtask ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
||||
$tableCell .= '<input type="text" alt="'.($disabledtaskday ? '' : $alttitle).'" title="'.($disabledtaskday ? '' : $alttitle).'" '.($disabledtaskday ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
||||
$tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||
$tableCell .= ' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"';
|
||||
$tableCell .= ' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
||||
@ -2079,6 +2103,13 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break
|
||||
}
|
||||
|
||||
$restrictBefore = null;
|
||||
|
||||
if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $numlines; $i++) {
|
||||
if ($parent == 0) {
|
||||
$level = 0;
|
||||
@ -2231,10 +2262,11 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
||||
$modeinput = 'hours';
|
||||
$TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
|
||||
$TFirstDay[reset($TWeek)] = 1;
|
||||
foreach ($TFirstDay as &$fday) {
|
||||
$fday--;
|
||||
}
|
||||
foreach ($TWeek as $weekNb) {
|
||||
|
||||
$firstdaytoshowarray = dol_getdate($firstdaytoshow);
|
||||
$year = $firstdaytoshowarray['year'];
|
||||
$month = $firstdaytoshowarray['mon'];
|
||||
foreach ($TWeek as $weekIndex => $weekNb) {
|
||||
$weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id];
|
||||
$totalforeachweek[$weekNb] += $weekWorkLoad;
|
||||
|
||||
@ -2244,6 +2276,12 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
||||
}
|
||||
$alttitle = $langs->trans("AddHereTimeSpentForWeek", $weekNb);
|
||||
|
||||
$disabledtaskweek = $disabledtask;
|
||||
$firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year);
|
||||
|
||||
if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) {
|
||||
$disabledtaskweek = 1;
|
||||
}
|
||||
|
||||
$tableCell = '<td class="center hide weekend">';
|
||||
$placeholder = '';
|
||||
@ -2253,7 +2291,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
||||
//$tableCell.='+';
|
||||
}
|
||||
|
||||
$tableCell .= '<input type="text" alt="'.($disabledtask ? '' : $alttitle).'" title="'.($disabledtask ? '' : $alttitle).'" '.($disabledtask ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.((int) $weekNb).']" name="task['.$lines[$i]->id.']['.$TFirstDay[$weekNb].']" value="" cols="2" maxlength="5"';
|
||||
$tableCell .= '<input type="text" alt="'.($disabledtaskweek ? '' : $alttitle).'" title="'.($disabledtaskweek ? '' : $alttitle).'" '.($disabledtaskweek ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.((int) $weekNb).']" name="task['.$lines[$i]->id.']['.($TFirstDay[$weekNb] - 1).']" value="" cols="2" maxlength="5"';
|
||||
$tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||
$tableCell .= ' onkeyup="updateTotal('.$weekNb.',\''.$modeinput.'\')"';
|
||||
$tableCell .= ' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$weekNb.',\''.$modeinput.'\')" />';
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -36,6 +36,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'bills', 'banks', 'compta'));
|
||||
@ -48,14 +49,19 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_day = GETPOST('search_day', 'int');
|
||||
$search_month = GETPOST('search_month', 'int');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
$search_company = GETPOST('search_company', 'alpha');
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_company = GETPOST('search_company', 'alpha');
|
||||
$search_payment_type = GETPOST('search_payment_type');
|
||||
$search_cheque_num = GETPOST('search_cheque_num', 'alpha');
|
||||
$search_cheque_num = GETPOST('search_cheque_num', 'alpha');
|
||||
$search_bank_account = GETPOST('search_bank_account', 'int');
|
||||
$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x'
|
||||
$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x'
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
@ -135,9 +141,14 @@ if (empty($reshook)) {
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$search_ref = '';
|
||||
$search_day = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_company = '';
|
||||
$search_payment_type = '';
|
||||
$search_cheque_num = '';
|
||||
@ -187,7 +198,13 @@ if ($socid > 0) {
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
$sql .= dolSqlDateFilter('p.datep', $search_day, $search_month, $search_year);
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .=" AND p.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
}
|
||||
|
||||
if ($search_company) {
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
@ -254,14 +271,23 @@ if ($optioncss != '') {
|
||||
if ($search_ref) {
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
}
|
||||
if ($search_day) {
|
||||
$param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_month) {
|
||||
$param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_year) {
|
||||
$param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_company) {
|
||||
$param .= '&search_company='.urlencode($search_company);
|
||||
@ -336,11 +362,12 @@ if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
// Filter: Date
|
||||
if (!empty($arrayfields['p.datep']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
||||
}
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
||||
$formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5);
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -84,6 +84,7 @@ NumberOfBytes=Number of Bytes
|
||||
SearchString=Search string
|
||||
NotAvailableWhenAjaxDisabled=Not available when Ajax disabled
|
||||
AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party
|
||||
TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months
|
||||
JavascriptDisabled=JavaScript disabled
|
||||
UsePreviewTabs=Use preview tabs
|
||||
ShowPreview=Show preview
|
||||
|
||||
@ -140,6 +140,7 @@ NoTasks=No tasks for this project
|
||||
LinkedToAnotherCompany=Linked to other third party
|
||||
TaskIsNotAssignedToUser=Task not assigned to user. Use button '<strong>%s</strong>' to assign task now.
|
||||
ErrorTimeSpentIsEmpty=Time spent is empty
|
||||
TimeRecordingRestrictedToNMonthsBack=Time recording is restricted to %s months back
|
||||
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
|
||||
IfNeedToUseOtherObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
|
||||
CloneTasks=Clone tasks
|
||||
|
||||
@ -616,9 +616,9 @@ MonthVeryShort11=N
|
||||
MonthVeryShort12=D
|
||||
AttachedFiles=Bijgevoegde bestanden en documenten
|
||||
JoinMainDoc=Word hoofddocument
|
||||
DateFormatYYYYMM=JJJJ-MM
|
||||
DateFormatYYYYMMDD=JJJJ-MM-DD
|
||||
DateFormatYYYYMMDDHHMM=JJJJ-MM-DD HH: SS
|
||||
DateFormatYYYYMM=YYYY-MM
|
||||
DateFormatYYYYMMDD=YYYY-MM-DD
|
||||
DateFormatYYYYMMDDHHMM=YYYY-MM-DD HH: SS
|
||||
ReportName=Rapportnaam
|
||||
ReportPeriod=Periode-analyse
|
||||
ReportDescription=Omschrijving
|
||||
|
||||
@ -219,6 +219,10 @@ if ($action == 'updateMaskTask') {
|
||||
$projectToSelect = GETPOST('projectToSelect', 'alpha');
|
||||
dolibarr_set_const($db, 'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect, 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value
|
||||
}
|
||||
if (GETPOST('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) {
|
||||
$timesheetFreezeDuration = GETPOST('timesheetFreezeDuration', 'alpha');
|
||||
dolibarr_set_const($db, 'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS', intval($timesheetFreezeDuration), 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value
|
||||
}
|
||||
} elseif (preg_match('/^(set|del)_?([A-Z_]+)$/', $action, $reg)) {
|
||||
// Set boolean (on/off) constants
|
||||
if (!dolibarr_set_const($db, $reg[2], ($reg[1] === 'set' ? '1' : '0'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
@ -797,6 +801,7 @@ print '<input type="text" id="projectToSelect" name="projectToSelect" value="'.$
|
||||
print $form->textwithpicto('', $langs->trans('AllowToLinkFromOtherCompany'));
|
||||
print '<input type="submit" class="button" name="PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$key = 'PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE';
|
||||
echo '<tr class="oddeven">',
|
||||
@ -808,6 +813,14 @@ echo '<tr class="oddeven">',
|
||||
'</td>',
|
||||
'</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TimesheetPreventAfterFollowingMonths").'</td>';
|
||||
|
||||
print '<td class="right" width="60" colspan="2">';
|
||||
print '<input type="number" id="timesheetFreezeDuration" name="timesheetFreezeDuration" min="0" step="1" value="'.$conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS.'"/> ';
|
||||
print '<input type="submit" class="button" name="PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@ -1158,6 +1158,18 @@ class Task extends CommonObject
|
||||
$this->timespent_datehour = $this->timespent_date;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
|
||||
|
||||
if ($this->timespent_date < $restrictBefore) {
|
||||
$this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
|
||||
$this->errors[] = $this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time (";
|
||||
@ -1519,6 +1531,17 @@ class Task extends CommonObject
|
||||
$this->timespent_note = trim($this->timespent_note);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
|
||||
|
||||
if ($this->timespent_date < $restrictBefore) {
|
||||
$this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
|
||||
$this->errors[] = $this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
|
||||
@ -1585,6 +1608,17 @@ class Task extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
|
||||
|
||||
if ($this->timespent_date < $restrictBefore) {
|
||||
$this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
|
||||
$this->errors[] = $this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user