Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into 10.0

Conflicts:
	htdocs/accountancy/bookkeeping/card.php
	htdocs/accountancy/bookkeeping/list.php
	htdocs/adherents/card.php
	htdocs/compta/sociales/list.php
	htdocs/compta/sociales/payments.php
	htdocs/core/modules/import/import_csv.modules.php
	htdocs/core/modules/import/import_xlsx.modules.php
	htdocs/holiday/class/holiday.class.php
	htdocs/viewimage.php
This commit is contained in:
Laurent Destailleur 2019-07-30 20:55:15 +02:00
commit 192fb45ce7
13 changed files with 95 additions and 74 deletions

View File

@ -641,8 +641,8 @@ if ($action == 'create')
print '<td>' . $accountingaccount->getNomUrl(0, 1, 1, '', 0) . '</td>'; print '<td>' . $accountingaccount->getNomUrl(0, 1, 1, '', 0) . '</td>';
print '<td>' . length_accounta($line->subledger_account) . '</td>'; print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_operation. '</td>'; print '<td>' . $line->label_operation. '</td>';
print '<td class="right">' . price($line->debit) . '</td>'; print '<td class="nowrap right">' . price($line->debit) . '</td>';
print '<td class="right">' . price($line->credit) . '</td>'; print '<td class="nowrap right">' . price($line->credit) . '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
@ -675,7 +675,7 @@ if ($action == 'create')
print $formaccounting->select_account('', 'accountingaccount_number', 1, array (), 1, 1, ''); print $formaccounting->select_account('', 'accountingaccount_number', 1, array (), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database. // use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{ {

View File

@ -763,7 +763,7 @@ if ($num > 0)
// Amount debit // Amount debit
if (! empty($arrayfields['t.debit']['checked'])) if (! empty($arrayfields['t.debit']['checked']))
{ {
print '<td class="right">' . ($line->debit ? price($line->debit) : ''). '</td>'; print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
$totalarray['totaldebit'] += $line->debit; $totalarray['totaldebit'] += $line->debit;
@ -772,7 +772,7 @@ if ($num > 0)
// Amount credit // Amount credit
if (! empty($arrayfields['t.credit']['checked'])) if (! empty($arrayfields['t.credit']['checked']))
{ {
print '<td class="right">' . ($line->credit ? price($line->credit) : '') . '</td>'; print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
$totalarray['totalcredit'] += $line->credit; $totalarray['totalcredit'] += $line->credit;
@ -843,8 +843,8 @@ if ($num > 0)
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>'; if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>'; else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
} }
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="right">'.price($totalarray['totaldebit']).'</td>'; elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="right">'.price($totalarray['totalcredit']).'</td>'; elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';

View File

@ -469,14 +469,15 @@ class BookKeeping extends CommonObject
*/ */
public function createStd(User $user, $notrigger = false, $mode = '') public function createStd(User $user, $notrigger = false, $mode = '')
{ {
global $conf; global $conf, $langs;
$langs->loadLangs(array("accountancy", "bills", "compta"));
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0; $error = 0;
// Clean parameters // Clean parameters
if (isset($this->doc_type)) { if (isset($this->doc_type)) {
$this->doc_type = trim($this->doc_type); $this->doc_type = trim($this->doc_type);
} }
@ -540,7 +541,7 @@ class BookKeeping extends CommonObject
$now = dol_now(); $now = dol_now();
// Check parameters // Check parameters
// Put here code to add control on parameters values $this->journal_label = $langs->trans($this->journal_label);
// Insert request // Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.' ('; $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.' (';

View File

@ -183,7 +183,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print $socialcontrib->getNomUrl(1, '20'); print $socialcontrib->getNomUrl(1, '20');
print '</td>'; print '</td>';
// Type // Type
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>'; print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
// Expected to pay // Expected to pay
print '<td class="right">'.price($obj->total).'</td>'; print '<td class="right">'.price($obj->total).'</td>';
// Ref payment // Ref payment

View File

@ -187,7 +187,7 @@ if ($resql)
if ($year) if ($year)
{ {
$center=($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":""); $center=($year?"<a href='list.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='list.php?year=".($year+1)."'>".img_next()."</a>":"");
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit); print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
} }
else else
@ -281,7 +281,7 @@ if ($resql)
print '<td align="center">'; print '<td align="center">';
if ($obj->periode) if ($obj->periode)
{ {
print '<a href="index.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>'; print '<a href="list.php?year='.strftime("%Y",$db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode),'day').'</a>';
} }
else else
{ {

View File

@ -90,7 +90,7 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($mode != 'sconly') if ($mode != 'sconly')
{ {
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":""); $center=($year?'<a href="list.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="list.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
} }
else else
@ -181,7 +181,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print $socialcontrib->getNomUrl(1, '20'); print $socialcontrib->getNomUrl(1, '20');
print '</td>'; print '</td>';
// Type // Type
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>'; print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
// Date // Date
$date=$obj->periode; $date=$obj->periode;
if (empty($date)) $date=$obj->date_ech; if (empty($date)) $date=$obj->date_ech;

View File

@ -594,16 +594,25 @@ class ImportCsv extends ModeleImports
// Test regexp // Test regexp
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != '')) if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{ {
// If test is "Must exist in a field@table" // If test is "Must exist in a field@table or field@table:..."
if (preg_match('/^(.*)@(.*)$/', $objimport->array_import_regex[0][$val], $reg)) if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{ {
$field=$reg[1]; $field=$reg[1];
$table=$reg[2]; $table=$reg[2];
$filter=!empty($reg[3])?substr($reg[3], 1):'';
$cachekey = $field.'@'.$table;
if(! empty($filter)) $cachekey.= ':'.$filter;
// Load content of field@table into cache array // Load content of field@table into cache array
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache if (! is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
{ {
$sql="SELECT ".$field." as aliasfield FROM ".$table; $sql="SELECT ".$field." as aliasfield FROM ".$table;
if(! empty($filter))
{
$sql.= ' WHERE ' . $filter;
}
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -612,7 +621,7 @@ class ImportCsv extends ModeleImports
while ($i < $num) while ($i < $num)
{ {
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield; if ($obj) $this->cachefieldtable[$cachekey][]=$obj->aliasfield;
$i++; $i++;
} }
} }
@ -623,9 +632,11 @@ class ImportCsv extends ModeleImports
} }
// Now we check cache is not empty (should not) and key is into cache // Now we check cache is not empty (should not) and key is into cache
if (! is_array($this->cachefieldtable[$field.'@'.$table]) || ! in_array($newval, $this->cachefieldtable[$field.'@'.$table])) if (! is_array($this->cachefieldtable[$cachekey]) || ! in_array($newval, $this->cachefieldtable[$cachekey]))
{ {
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $table); $tableforerror = $table;
if(! empty($filter)) $tableforerror.= ':'.$filter;
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
$this->errors[$error]['type']='FOREIGNKEY'; $this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++; $errorforthistable++;
$error++; $error++;

View File

@ -621,16 +621,25 @@ class ImportXlsx extends ModeleImports
// Test regexp // Test regexp
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != '')) if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{ {
// If test is "Must exist in a field@table" // If test is "Must exist in a field@table or field@table:..."
if (preg_match('/^(.*)@(.*)$/', $objimport->array_import_regex[0][$val], $reg)) if (preg_match('/^(.+)@([^:]+)(:.+)?$/',$objimport->array_import_regex[0][$val],$reg))
{ {
$field=$reg[1]; $field=$reg[1];
$table=$reg[2]; $table=$reg[2];
$filter=!empty($reg[3])?substr($reg[3], 1):'';
$cachekey = $field.'@'.$table;
if(! empty($filter)) $cachekey.= ':'.$filter;
// Load content of field@table into cache array // Load content of field@table into cache array
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache if (! is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
{ {
$sql="SELECT ".$field." as aliasfield FROM ".$table; $sql="SELECT ".$field." as aliasfield FROM ".$table;
if(! empty($filter))
{
$sql.= ' WHERE ' . $filter;
}
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -639,7 +648,7 @@ class ImportXlsx extends ModeleImports
while ($i < $num) while ($i < $num)
{ {
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield; if ($obj) $this->cachefieldtable[$cachekey][]=$obj->aliasfield;
$i++; $i++;
} }
} }
@ -650,9 +659,11 @@ class ImportXlsx extends ModeleImports
} }
// Now we check cache is not empty (should not) and key is into cache // Now we check cache is not empty (should not) and key is into cache
if (! is_array($this->cachefieldtable[$field.'@'.$table]) || ! in_array($newval, $this->cachefieldtable[$field.'@'.$table])) if (! is_array($this->cachefieldtable[$cachekey]) || ! in_array($newval, $this->cachefieldtable[$cachekey]))
{ {
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $table); $tableforerror = $table;
if(! empty($filter)) $tableforerror.= ':'.$filter;
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
$this->errors[$error]['type']='FOREIGNKEY'; $this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++; $errorforthistable++;
$error++; $error++;

View File

@ -425,8 +425,8 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto; $this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product');
$this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*" $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*");
); $this->import_regex_array[$r]=array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0');
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(
'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
@ -444,7 +444,10 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto; $this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*" $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*");
$this->import_regex_array[$r]=array(
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2',
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0'
); );
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(
@ -463,7 +466,10 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto; $this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*" $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*");
$this->import_regex_array[$r]=array(
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1',
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0'
); );
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(

View File

@ -1584,10 +1584,10 @@ if ($action == 'create')
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked); print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked);
print '</tr>'; print '</tr>';
} }
}
$indiceAsked++; $indiceAsked++;
} }
}
print "</table>"; print "</table>";

View File

@ -1438,45 +1438,30 @@ class Holiday extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
$typeleaves=$this->getTypes(1, 1); $typeleaves=$this->getTypes(1, 1);
foreach($typeleaves as $key => $val)
{
// On ajoute x jours à chaque utilisateurs
$nb_holiday = $val['newByMonth'];
if (empty($nb_holiday)) $nb_holiday=0;
if ($nb_holiday > 0) // Update each user counter
{ foreach ($users as $userCounter) {
dol_syslog("We update leavefor everybody for type ".$key, LOG_DEBUG); $nbDaysToAdd = $typeleaves[$userCounter['type']]['newByMonth'];
if(empty($nbDaysToAdd)) continue;
$i = 0; dol_syslog("We update leave type id ".$userCounter['type']." for user id ".$userCounter['rowid'], LOG_DEBUG);
while ($i < $nbUser)
{ $nowHoliday = $userCounter['nb_holiday'];
$now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']); $newSolde = $nowHoliday + $nbDaysToAdd;
$new_solde = $now_holiday + $nb_holiday;
// We add a log for each user // We add a log for each user
$this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']); $this->addLogCP($user->id, $userCounter['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $newSolde, $userCounter['type']);
$i++; $result = $this->updateSoldeCP($userCounter['rowid'], $newSolde, $userCounter['type'], $langs->trans('HolidaysMonthlyUpdate'));
}
// Now we update counter for all users at once if ($result < 0)
$sql2 = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET";
$sql2.= " nb_holiday = nb_holiday + ".$nb_holiday;
$sql2.= " WHERE fk_type = ".$val['rowid'];
$result= $this->db->query($sql2);
if (! $result)
{ {
dol_print_error($this->db); $error++;
break; break;
} }
} }
else dol_syslog("No change for leave of type ".$key, LOG_DEBUG);
}
if ($result) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
return 1; return 1;
@ -1635,8 +1620,8 @@ class Holiday extends CommonObject
{ {
$sql = "SELECT nb_holiday"; $sql = "SELECT nb_holiday";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users";
$sql.= " WHERE fk_user = '".$user_id."'"; $sql.= " WHERE fk_user = ".(int) $user_id;
if ($fk_type > 0) $sql.=" AND fk_type = ".$fk_type; if ($fk_type > 0) $sql.=" AND fk_type = ".(int) $fk_type;
dol_syslog(get_class($this).'::getCPforUser user_id='.$user_id.' type_id='.$fk_type, LOG_DEBUG); dol_syslog(get_class($this).'::getCPforUser user_id='.$user_id.' type_id='.$fk_type, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1799,7 +1784,7 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid; $tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated $tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname; $tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname; $tab_result[$i]['firstname'] = $obj->firstname;
@ -1807,7 +1792,7 @@ class Holiday extends CommonObject
$tab_result[$i]['status'] = $obj->statut; $tab_result[$i]['status'] = $obj->statut;
$tab_result[$i]['employee'] = $obj->employee; $tab_result[$i]['employee'] = $obj->employee;
$tab_result[$i]['photo'] = $obj->photo; $tab_result[$i]['photo'] = $obj->photo;
$tab_result[$i]['fk_user'] = $obj->fk_user; $tab_result[$i]['fk_user'] = $obj->fk_user; // rowid of manager
//$tab_result[$i]['type'] = $obj->type; //$tab_result[$i]['type'] = $obj->type;
//$tab_result[$i]['nb_holiday'] = $obj->nb_holiday; //$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
@ -1845,7 +1830,7 @@ class Holiday extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid; $tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated $tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname; $tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname; $tab_result[$i]['firstname'] = $obj->firstname;
@ -1853,7 +1838,7 @@ class Holiday extends CommonObject
$tab_result[$i]['status'] = $obj->statut; $tab_result[$i]['status'] = $obj->statut;
$tab_result[$i]['employee'] = $obj->employee; $tab_result[$i]['employee'] = $obj->employee;
$tab_result[$i]['photo'] = $obj->photo; $tab_result[$i]['photo'] = $obj->photo;
$tab_result[$i]['fk_user'] = $obj->fk_user; $tab_result[$i]['fk_user'] = $obj->fk_user; // rowid of manager
$tab_result[$i]['type'] = $obj->fk_type; $tab_result[$i]['type'] = $obj->fk_type;
$tab_result[$i]['nb_holiday'] = $obj->nb_holiday; $tab_result[$i]['nb_holiday'] = $obj->nb_holiday;

View File

@ -450,6 +450,11 @@ if ($action == "set")
$buffer=trim($buffer); $buffer=trim($buffer);
if ($buffer) if ($buffer)
{ {
// Replace the prefix in table names
if ($dolibarr_main_db_prefix != 'llx_')
{
$buffer=preg_replace('/llx_/i',$dolibarr_main_db_prefix,$buffer);
}
dolibarr_install_syslog("step2: request: " . $buffer); dolibarr_install_syslog("step2: request: " . $buffer);
print "<!-- Insert line : ".$buffer."<br>-->\n"; print "<!-- Insert line : ".$buffer."<br>-->\n";
$resql=$db->query($buffer, 0, 'dml'); $resql=$db->query($buffer, 0, 'dml');

View File

@ -170,7 +170,9 @@ if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file); else $type=dol_mimetype($original_file);
// Security: This wrapper is for images. We do not allow type/html // Security: This wrapper is for images. We do not allow type/html
if (preg_match('/html/', $type)) accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.', 0, 0, 1); if (preg_match('/html/i', $type)) accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.', 0, 0, 1);
// Security: This wrapper is for images. We do not allow files ending with .noexe
if (preg_match('/\.noexe$/i', $original_file)) accessforbidden('Error: Using the image wrapper to output a file ending with .noexe is not allowed.', 0, 0, 1);
// Security: Delete string ../ into $original_file // Security: Delete string ../ into $original_file
$original_file = str_replace("../", "/", $original_file); $original_file = str_replace("../", "/", $original_file);