2
0
forked from Wavyzz/dolibarr

Debug v16

This commit is contained in:
Laurent Destailleur
2022-06-08 20:07:16 +02:00
parent 41683b9025
commit 1838baaa5c
14 changed files with 63 additions and 36 deletions

View File

@@ -1470,7 +1470,7 @@ class FormFile
print '<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->';
if ($useinecm == 1 || $useinecm == 5) { // ECM manual tree only
// $section is inside $param
$newparam .= preg_replace('/&file=.*$/', '', $param); // We don't need param file=
$newparam = preg_replace('/&file=.*$/', '', $param); // We don't need param file=
$backtopage = DOL_URL_ROOT.'/ecm/index.php?&section_dir='.urlencode($relativepath).$newparam;
print '<a class="editfielda editfilelink" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'&backtopage='.urlencode($backtopage).'" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}

View File

@@ -10045,7 +10045,7 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$dictvalues[$obj->{$rowidfield}] = $obj;
$dictvalues[$obj->{$rowidfield}] = $obj; // $obj is stdClass
}
} else {
dol_print_error($db);
@@ -10056,7 +10056,8 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
if (!empty($dictvalues[$id])) {
// Found
return $dictvalues[$id]->{$field};
$tmp = $dictvalues[$id];
return (property_exists($tmp, $field) ? $tmp->$field : '');
} else {
// Not found
return '';

View File

@@ -94,9 +94,11 @@ if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage med
print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
print '</a>';
} elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm
if (getDolGlobalInt('ECM_SHOW_GENERATE_WEBP_BUTTON')) {
print '<a id="agenerateimgwebp" href="'.$_SERVER["PHP_SELF"].'?action=confirmconvertimgwebp&token='.newToken().'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">';
print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
print '</a>';
}
}
print "<script>

View File

@@ -346,7 +346,7 @@ if ($action != 'edit') {
print $fulllink;
}
if ($action != 'edit') {
print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here.
print ' <a href="'.$fulllink.'">'.img_picto($langs->trans("Download"), 'download', 'class="opacitymedium paddingrightonly"').'</a>'; // No target here.
}
print '</td></tr>';

View File

@@ -47,6 +47,8 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$backtopage = GETPOST('backtopage', 'alpha');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');

View File

@@ -58,7 +58,7 @@ if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "fullname";
$sortfield = "name";
}
$ecmdir = new EcmDirectory($db);

View File

@@ -36,6 +36,9 @@ if (empty($conf) || !is_object($conf)) {
if (empty($module)) {
$module = 'ecm';
}
if (empty($nameforformuserfile)) {
$nameforformuserfile = '';
}
$paramwithoutsection = preg_replace('/&?section=(\d+)/', '', $param);
$openeddir = '/'; // The root directory shown

View File

@@ -178,14 +178,12 @@ $sql .= ', u.rowid as userid, u.login, u.lastname, u.firstname';
$sql .= ', c.code as paiement_type, c.libelle as paiement_libelle';
$sql .= ', ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal as accountancy_journal';
$sql .= ', SUM(pndf.amount)';
$sql .= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport AS pndf';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport AS ndf ON ndf.rowid=pndf.fk_expensereport';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON pndf.fk_typepayment = c.id';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON u.rowid = ndf.fk_user_author';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON pndf.fk_bank = b.rowid';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= ' WHERE ndf.entity IN ('.getEntity("expensereport").')';
// RESTRICT RIGHTS
@@ -226,7 +224,7 @@ if ($search_all) {
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$sql .= ' GROUP BY pndf.rowid, pndf.datep, pndf.amount, pndf.num_payment, u.login, u.lastname, u.firstname, c.code, c.libelle,';
$sql .= ' GROUP BY pndf.rowid, pndf.datep, pndf.amount, pndf.num_payment, u.rowid, u.login, u.lastname, u.firstname, c.code, c.libelle,';
$sql .= ' ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal';
$sql .= $db->order($sortfield, $sortorder);
@@ -419,6 +417,9 @@ print '</td>';
print '</tr>';
$totalarray = array();
$totalarray['nbfield'] = 0;
print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
@@ -460,8 +461,12 @@ foreach ($arrayfields as $column) {
}
}
// Loop on record
// --------------------------------------------------------------------
$i = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
@@ -563,8 +568,12 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
$totalarray['pos'][$checkedCount] = 'amount';
if (empty($totalarray['val']['amount'])) {
$totalarray['val']['amount'] = $objp->pamount;
} else {
$totalarray['val']['amount'] += $objp->pamount;
}
}
// Buttons
print '<td></td>';

View File

@@ -906,6 +906,8 @@ $help_url = 'EN:Module_Holiday';
llxHeader('', $title, $help_url);
$edit = false;
if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
// If user has no permission to create a leave
if ((in_array($fuserid, $childids) && empty($user->rights->holiday->write)) || (!in_array($fuserid, $childids) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)))) {
@@ -1563,6 +1565,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
$morehtmlright = '';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@@ -99,6 +99,10 @@ class Holiday extends CommonObject
*/
public $fk_user_valid;
/**
* @var int Date approbation
*/
public $date_approbation;
/**
* @var int Date for refuse
@@ -2202,7 +2206,7 @@ class Holiday extends CommonObject
$sql .= " f.date_create as datec,";
$sql .= " f.tms as date_modification,";
$sql .= " f.date_valid as datev,";
//$sql .= " f.date_approve as datea,";
$sql .= " f.date_approve as datea,";
$sql .= " f.date_refuse as dater,";
$sql .= " f.fk_user_create as fk_user_creation,";
$sql .= " f.fk_user_modif as fk_user_modification,";
@@ -2225,21 +2229,17 @@ class Holiday extends CommonObject
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_approbation = $this->db->jdate($obj->datea);
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
if ($obj->fk_user_creation) {
if (!empty($obj->fk_user_creation)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creation);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
if (!empty($obj->fk_user_approve_done)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$vuser->fetch($obj->fk_user_approve_done);
$this->user_validation = $vuser;
}
if ($obj->fk_user_modification) {
if (!empty($obj->fk_user_modification)) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modification);
$this->user_modification = $muser;
@@ -2252,7 +2252,7 @@ class Holiday extends CommonObject
$this->user_approve = $auser;
}
} else {
if ($obj->fk_user_approve_expected) {
if (!empty($obj->fk_user_approve_expected)) {
$auser = new User($this->db);
$auser->fetch($obj->fk_user_approve_expected);
$this->user_approve = $auser;

View File

@@ -124,6 +124,7 @@ $title = $langs->trans("Leave").' - '.$langs->trans("Files");
llxHeader('', $title);
$edit = false;
if ($object->id) {
$valideur = new User($db);

View File

@@ -489,11 +489,13 @@ while ($i < min($num, $limit)) {
// Type
if (!empty($arrayfields['cpl.fk_type']['checked'])) {
if (!empty($alltypeleaves[$holidaylogstatic->type])) {
if ($alltypeleaves[$holidaylogstatic->type]['code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']) != $alltypeleaves[$holidaylogstatic->type]['code']) {
$label = $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']);
} else {
$label = $alltypeleaves[$holidaylogstatic->type]['label'];
}
}
print '<td>';
print $label ? $label : $holidaylogstatic->type;

View File

@@ -924,29 +924,33 @@ class MyObject extends CommonObject
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if (!empty($obj->fk_user_author)) {
if (!empty($obj->fk_user_creat)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser;
}
if (!empty($obj->fk_user_modif)) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
if (!empty($obj->datev)) {
$this->date_validation = $this->db->jdate($obj->datev);
}
}
$this->db->free($result);
} else {

View File

@@ -2919,7 +2919,7 @@ class User extends CommonObject
*/
public function getLibStatut($mode = 0)
{
return $this->LibStatut(isset($this->statut) ? $this->statut : $this->status, $mode);
return $this->LibStatut(isset($this->statut) ? (int) $this->statut : (int) $this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps