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

This commit is contained in:
Laurent Destailleur 2023-01-17 23:56:38 +01:00
commit f7f8444361
22 changed files with 995 additions and 577 deletions

View File

@ -14,6 +14,7 @@ Following changes may create regressions for some external modules, but were nec
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
* Deprecated property libelle removed from entrepot class.

View File

@ -1,4 +1,4 @@
FROM php:7.3-apache
FROM php:8.1-apache-bullseye
ENV PHP_INI_DATE_TIMEZONE 'UTC'
ENV PHP_INI_MEMORY_LIMIT 256M
@ -25,7 +25,7 @@ RUN apt-get update -y \
mailutils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) ldap && \

View File

@ -25,7 +25,7 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev
http://0.0.0.0:8081

View File

@ -34,6 +34,8 @@ services:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE
PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT
volumes:
- ../../htdocs:/var/www/html/
- ../../documents:/var/documents

View File

@ -15,10 +15,10 @@ fi
echo "[docker-run] => Set Permission to www-data for /var/documents"
chown -R www-data:www-data /var/documents
if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /usr/local/etc/php/php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE
echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini"
cat <<EOF > ${PHP_INI_DIR}/conf.d/dolibarr-php.ini
date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC}
memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M}
EOF
fi
exec apache2-foreground

View File

@ -793,6 +793,15 @@ if ($resql) {
if ($search_fk_input_reason > 0) {
$param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason);
}
if (!empty($productobuy)) {
$param .= '&productobuy='.urlencode($productobuy);
}
if (!empty($productonly)) {
$param .= '&productonly='.urlencode($productonly);
}
if (!empty($disablelinefree)) {
$param .= '&disablelinefree='.urlencode($disablelinefree);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -830,10 +839,6 @@ if ($resql) {
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1);
print '<input type="checkbox" name="productobuy"'.(!empty($productobuy)?'value="productobuychecked" checked':'' ).'><label for="productobuy">'.$langs->trans("productobuy").'</label>';
print '<input type="checkbox" name="productonly"'.(!empty($productonly)?'value="productonlychecked" checked':'' ).'><label for="productonly">'.$langs->trans("productonly").'</label>';
print '<input type="checkbox" name="disablelinefree"'.(!empty($disablelinefree)?'value="disablelinefreechecked" checked':'' ).'><label for="disablelinefree">'.$langs->trans("disablelinefree").'</label>';
$topicmail = "SendOrderRef";
$modelmail = "order_send";
$objecttmp = new Commande($db);
@ -849,6 +854,11 @@ if ($resql) {
$moreforfilter = '';
$moreforfilter .= '<input type="checkbox" name="productobuy"'.(!empty($productobuy)?'value="productobuychecked" checked':'' ).'><label for="productobuy">'.$langs->trans("productobuy").'</label>';
$moreforfilter .= '<input type="checkbox" name="productonly"'.(!empty($productonly)?'value="productonlychecked" checked':'' ).'><label for="productonly">'.$langs->trans("productonly").'</label>';
$moreforfilter .= '<input type="checkbox" name="disablelinefree"'.(!empty($disablelinefree)?'value="disablelinefreechecked" checked':'' ).'><label for="disablelinefree">'.$langs->trans("disablelinefree").'</label>';
$moreforfilter .= '<br>';
// If the user can view prospects other than his'
if ($user->rights->user->user->lire) {
$langs->load("commercial");
@ -888,6 +898,8 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx');
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
@ -1402,6 +1414,7 @@ if ($resql) {
$total_ht = 0;
$total_margin = 0;
// Détail commande
$totalqty = 0;
@ -1419,6 +1432,15 @@ if ($resql) {
$text_warning = '';
$nbprod = 0;
// Print SubTotal
if (empty($i)) {
$oldref = $obj->product_ref;
}
if ($oldref != $obj->product_ref) {
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$oldref = $obj->product_ref;
}
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
@ -1509,10 +1531,7 @@ if ($resql) {
}
// Product QtyOrdered
if (!empty($arrayfields['cdet.qty']['checked'])) {
print '<td class="nowrap tdoverflowmax200">'.$obj->qty.'</td>';
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty';
}
print '<td class="nowrap right">'.$obj->qty.'</td>';
if (isset($totalarray['val']['cdet.qty'])) {
$totalarray['val']['cdet.qty'] += $obj->qty;
} else {
@ -1521,6 +1540,9 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty';
}
}
// Ref

View File

@ -957,7 +957,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$search_poste = GETPOST("search_poste", 'alpha');
$search_note_private = GETPOST('search_note_private', 'alphanohtml');
$search_roles = GETPOST("search_roles", 'array');
$search_birthday_dtstart = GETPOST("search_birthday_dtstart", 'alpha');
$search_birthday_dtend = GETPOST("search_birthday_dtend", 'alpha');
if ($search_birthday_dtstart != '' || $search_birthday_dtend != '') {
$search_birthday_dtstart = dol_mktime(0, 0, 0, GETPOST('search_birthday_dtstartmonth', 'int'), GETPOST('search_birthday_dtstartday', 'int'), GETPOST('search_birthday_dtstartyear', 'int'));
$search_birthday_dtend = dol_mktime(23, 59, 59, GETPOST('search_birthday_dtendmonth', 'int'), GETPOST('search_birthday_dtendday', 'int'), GETPOST('search_birthday_dtendyear', 'int'));
}
$socialnetworks = getArrayOfSocialNetworks();
$searchAddressPhoneDBFields = array(
@ -1007,6 +1013,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35),
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40),
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 0, 'position'=>45),
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
);
@ -1018,6 +1025,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
't.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position'=>35),
'sc.role'=>array('label'=>"ContactByDefaultFor", 'checked'=>1, 'position'=>40),
't.birthday'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>45),
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'),
);
// Extra fields
@ -1052,6 +1060,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$search_address = '';
$search_poste = '';
$search_note_private = '';
$search_birthday_dtstart = '';
$search_birthday_dtend = '';
$search = array();
$search_array_options = array();
@ -1111,6 +1121,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
if ($search_note_private != '') {
$param .= '&search_note_private='.urlencode($search_note_private);
}
if ($search_birthday != '') {
$param .= '&search_birthday='.urlencode($search_birthday);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
@ -1120,7 +1133,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
$sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,";
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
$sql .= " t.civility as civility_id, t.address, t.zip, t.town, t.birthday";
$sql .= ", t.note_private";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
@ -1144,6 +1157,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
if ($search_note_private) {
$sql .= natural_search('t.note_private', $search_note_private);
}
if ($search_birthday_dtstart != '') {
$sql .= " AND t.birthday >= '".$db->idate($search_birthday_dtstart)."'";
}
if ($search_birthday_dtend != '') {
$sql .= " AND t.birthday <= '".$db->idate($search_birthday_dtend)."'";
}
if (count($search_roles) > 0) {
$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
}
@ -1188,6 +1207,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
} elseif (in_array($key, array('role'))) {
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles, 'minwidth200 maxwidth300');
} elseif (in_array($key, array('birthday'))) {
print '<div class="nowrap">';
print $form->selectDate($search_birthday_dtstart ? $search_birthday_dtstart : '', "search_birthday_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_birthday_dtend ? $search_birthday_dtend : '', "search_birthday_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
}
@ -1342,6 +1368,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
print '</td>';
}
// Birthday
if (!empty($arrayfields['t.birthday']['checked'])) {
print '<td>';
print dol_print_date($obj->birthday);
print '</td>';
}
// Status
if (!empty($arrayfields['t.statut']['checked'])) {
print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
@ -1384,7 +1417,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$i++;
}
} else {
$colspan = 1;
$colspan = 2;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;

View File

@ -1273,7 +1273,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
$newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire'));
}
if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
$newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('societe', 'contact', 'lire'));
$newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire'));
}
$newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire'));
//$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire'));

View File

@ -2675,6 +2675,43 @@ class ExpenseReport extends CommonObject
return -1;
}
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs, $selected,$arrayofselected;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (in_array($this->id, $arrayofselected)) {
$selected = 1;
}
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_user_author') && !empty($this->id)) {
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';
}
if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) {
$return .= '<br><span class="info-box-label">'.dol_print_date($this->date_debut, 'day').'</span>';
$return .= ' <span class="opacitymedium">'.$langs->trans("To").'</span> ';
$return .= '<span class="info-box-label">'.dol_print_date($this->date_fin, 'day').'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -713,4 +713,41 @@ class PaymentExpenseReport extends CommonObject
dol_print_error($this->db);
}
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'datep')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'dayhour').'</span>';
}
if (property_exists($this, 'fk_typepayment')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span> : <span class="info-box-label">'.$this->fk_typepayment.'</span>';
}
if (property_exists($this, 'fk_bank') && !is_null($this->fk_bank)) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label">'.$this->fk_bank.'</span>';
}
if (property_exists($this, 'amount') ) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -50,6 +50,7 @@ $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'expensereportlist';
$mode = GETPOST('mode', 'alpha');
$childids = $user->getAllChildIds(1);
@ -378,6 +379,9 @@ if ($resql) {
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -471,6 +475,7 @@ if ($resql) {
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($id > 0) {
print '<input type="hidden" name="id" value="'.$id.'">';
}
@ -512,7 +517,10 @@ if ($resql) {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'trip', 0, $newcardbutton, '', $limit, 0, 0, 1);
}
@ -739,185 +747,204 @@ if ($resql) {
$expensereportstatic->note_private = $obj->note_private;
$expensereportstatic->note_public = $obj->note_public;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
$usertmp->fetch($obj->id_user);
$expensereportstatic->fk_user_author = $usertmp->getNomUrl(1);
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
// Output Kanban
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($massactionbutton || $massaction) {
$selected = 0;
print $expensereportstatic->getKanbanView('');
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print '<td>';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $expensereportstatic->getNomUrl(1);
print '</td>';
// Warning late icon and note
print '<td class="nobordernopadding nowrap">';
if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) {
print img_warning($langs->trans("Late"));
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) {
print img_warning($langs->trans("Late"));
}
if (!empty($obj->note_private) || !empty($obj->note_public)) {
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/expensereport/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
print '</span>';
}
print '</td>';
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
print '</td>';
print '</tr></table>';
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// User
if (!empty($arrayfields['user']['checked'])) {
print '<td class="left">';
$usertmp->id = $obj->id_user;
$usertmp->lastname = $obj->lastname;
$usertmp->firstname = $obj->firstname;
$usertmp->login = $obj->login;
$usertmp->statut = $obj->statut;
$usertmp->photo = $obj->photo;
$usertmp->email = $obj->email;
print $usertmp->getNomUrl(-1);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Start date
if (!empty($arrayfields['d.date_debut']['checked'])) {
print '<td class="center">'.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// End date
if (!empty($arrayfields['d.date_fin']['checked'])) {
print '<td class="center">'.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date validation
if (!empty($arrayfields['d.date_valid']['checked'])) {
print '<td class="center">'.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date approval
if (!empty($arrayfields['d.date_approve']['checked'])) {
print '<td class="center">'.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount HT
if (!empty($arrayfields['d.total_ht']['checked'])) {
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht';
}
$totalarray['val']['d.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (!empty($arrayfields['d.total_vat']['checked'])) {
print '<td class="right">'.price($obj->total_tva)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva';
}
$totalarray['val']['d.total_tva'] += $obj->total_tva;
}
// Amount TTC
if (!empty($arrayfields['d.total_ttc']['checked'])) {
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc';
}
$totalarray['val']['d.total_ttc'] += $obj->total_ttc;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['d.date_create']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_create), 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_modif), 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['d.fk_statut']['checked'])) {
print '<td class="nowrap right">'.$expensereportstatic->getLibStatut(5).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
print '</td>';
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print '<td>';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $expensereportstatic->getNomUrl(1);
print '</td>';
// Warning late icon and note
print '<td class="nobordernopadding nowrap">';
if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) {
print img_warning($langs->trans("Late"));
}
if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) {
print img_warning($langs->trans("Late"));
}
if (!empty($obj->note_private) || !empty($obj->note_public)) {
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/expensereport/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
print '</span>';
}
print '</td>';
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
print '</td>';
print '</tr></table>';
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// User
if (!empty($arrayfields['user']['checked'])) {
print '<td class="left">';
$usertmp->id = $obj->id_user;
$usertmp->lastname = $obj->lastname;
$usertmp->firstname = $obj->firstname;
$usertmp->login = $obj->login;
$usertmp->statut = $obj->statut;
$usertmp->photo = $obj->photo;
$usertmp->email = $obj->email;
print $usertmp->getNomUrl(-1);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Start date
if (!empty($arrayfields['d.date_debut']['checked'])) {
print '<td class="center">'.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// End date
if (!empty($arrayfields['d.date_fin']['checked'])) {
print '<td class="center">'.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date validation
if (!empty($arrayfields['d.date_valid']['checked'])) {
print '<td class="center">'.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date approval
if (!empty($arrayfields['d.date_approve']['checked'])) {
print '<td class="center">'.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount HT
if (!empty($arrayfields['d.total_ht']['checked'])) {
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht';
}
$totalarray['val']['d.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (!empty($arrayfields['d.total_vat']['checked'])) {
print '<td class="right">'.price($obj->total_tva)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva';
}
$totalarray['val']['d.total_tva'] += $obj->total_tva;
}
// Amount TTC
if (!empty($arrayfields['d.total_ttc']['checked'])) {
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc';
}
$totalarray['val']['d.total_ttc'] += $obj->total_ttc;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['d.date_create']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_create), 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_modif), 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['d.fk_statut']['checked'])) {
print '<td class="nowrap right">'.$expensereportstatic->getLibStatut(5).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
}
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
$total_total_ht = $total_total_ht + $obj->total_ht;
$total_total_tva = $total_total_tva + $obj->total_tva;
$total_total_ttc = $total_total_ttc + $obj->total_ttc;
$total_total_ht = $total_total_ht + $obj->total_ht;
$total_total_tva = $total_total_tva + $obj->total_tva;
$total_total_ttc = $total_total_ttc + $obj->total_ttc;
$i++;
}
} else {

View File

@ -48,6 +48,7 @@ $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist';
$mode = GETPOST('mode', 'alpha');
$socid = GETPOST('socid', 'int');
@ -254,6 +255,9 @@ $num = $db->num_rows($resql);
$i = 0;
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -315,8 +319,13 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, '', '', $limit, 0, 0, 1);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
print_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, $newcardbutton, '', $limit, 0, 0, 1);
if ($search_all) {
foreach ($fieldstosearchall as $key => $val) {
@ -473,116 +482,138 @@ while ($i < min($num, $limit)) {
$paymentexpensereportstatic->id = $objp->rowid;
$paymentexpensereportstatic->ref = $objp->ref;
$paymentexpensereportstatic->datepaye = $objp->datep;
$paymentexpensereportstatic->datep = $objp->datep;
$paymentexpensereportstatic->amount = $objp->pamount;
$paymentexpensereportstatic->fk_typepayment = $objp->paiement_type;
if ($objp->bid) {
$accountstatic->fetch($objp->bid);
$paymentexpensereportstatic->fk_bank = $accountstatic->getNomUrl(1);
} else {
$paymentexpensereportstatic->fk_bank = null;
}
$userstatic->id = $objp->userid;
$userstatic->lastname = $objp->lastname;
$userstatic->firstname = $objp->firstname;
print '<tr class="oddeven">';
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $paymentexpensereportstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref
if (!empty($arrayfields['pndf.rowid']['checked'])) {
print '<td class="nowrap">'.$paymentexpensereportstatic->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date
if (!empty($arrayfields['pndf.datep']['checked'])) {
$dateformatforpayment = 'dayhour';
print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Thirdparty
if (!empty($arrayfields['u.login']['checked'])) {
print '<td>';
if ($userstatic->id > 0) {
print $userstatic->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Pyament type
if (!empty($arrayfields['c.libelle']['checked'])) {
$payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
print '<td>'.$payment_type.' '.dol_trunc($objp->num_payment, 32).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Cheque number (fund transfer)
if (!empty($arrayfields['pndf.num_payment']['checked'])) {
print '<td>'.$objp->num_payment.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Bank account
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td>';
if ($objp->bid) {
$accountstatic->id = $objp->bid;
$accountstatic->ref = $objp->bref;
$accountstatic->label = $objp->blabel;
$accountstatic->number = $objp->number;
$accountstatic->iban = $objp->iban_prefix;
$accountstatic->bic = $objp->bic;
$accountstatic->currency_code = $objp->currency_code;
$accountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount
if (!empty($arrayfields['pndf.amount']['checked'])) {
print '<td class="right"><span class="amount">'.price($objp->pamount).'</span></td>';
if (!$i) {
$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>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>';
}
// Ref
if (!empty($arrayfields['pndf.rowid']['checked'])) {
print '<td class="nowrap">'.$paymentexpensereportstatic->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date
if (!empty($arrayfields['pndf.datep']['checked'])) {
$dateformatforpayment = 'dayhour';
print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Thirdparty
if (!empty($arrayfields['u.login']['checked'])) {
print '<td>';
if ($userstatic->id > 0) {
print $userstatic->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Pyament type
if (!empty($arrayfields['c.libelle']['checked'])) {
$payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
print '<td>'.$payment_type.' '.dol_trunc($objp->num_payment, 32).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Cheque number (fund transfer)
if (!empty($arrayfields['pndf.num_payment']['checked'])) {
print '<td>'.$objp->num_payment.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Bank account
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td>';
if ($objp->bid) {
$accountstatic->id = $objp->bid;
$accountstatic->ref = $objp->bref;
$accountstatic->label = $objp->blabel;
$accountstatic->number = $objp->number;
$accountstatic->iban = $objp->iban_prefix;
$accountstatic->bic = $objp->bic;
$accountstatic->currency_code = $objp->currency_code;
$accountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount
if (!empty($arrayfields['pndf.amount']['checked'])) {
print '<td class="right"><span class="amount">'.price($objp->pamount).'</span></td>';
if (!$i) {
$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>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>';
$i++;
}

View File

@ -1066,6 +1066,42 @@ class KnowledgeRecord extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT);
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs, $selected,$arrayofselected;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (in_array($this->id, $arrayofselected)) {
$selected = 1;
}
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'question')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans('Question').'</span> : <span class="info-box-label">'.$this->question.'</span>';
}
if (property_exists($this, 'lang') && !empty($this->lang)) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Language").'</span> : <span class="info-box-label" title="'.$langs->trans("Language_".$this->lang).'">'.$langs->trans("Language_".$this->lang, '', '', '', '', 12).'</span>';
$return .= picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"');
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -447,8 +447,12 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -636,131 +640,148 @@ while ($i < $imaxinloop) {
// Store properties in $object
$object->setVarsFromFetchObj($obj);
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container">';
}
// Output Kanban
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($massactionbutton || $massaction) {
$selected = 0;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print $object->getKanbanView('');
}
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} elseif ($key == 'fk_user_creat') {
if ($object->fk_user_creat > 0) {
if (isset($conf->cache['user'][$object->fk_user_creat])) {
$user_temp = $conf->cache['user'][$object->fk_user_creat];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_creat);
$conf->cache['user'][$object->fk_user_creat] = $user_temp;
}
print $user_temp->getNomUrl(-1);
} else {
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
} elseif ($key == 'fk_user_modif') {
if ($object->fk_user_modif > 0) {
if (isset($conf->cache['user'][$object->fk_user_modif])) {
$user_temp = $conf->cache['user'][$object->fk_user_modif];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_modif);
$conf->cache['user'][$object->fk_user_modif] = $user_temp;
}
print $user_temp->getNomUrl(-1);
}
} elseif ($key == 'fk_user_valid') {
if ($object->fk_user_valid > 0) {
if (isset($conf->cache['user'][$object->fk_user_valid])) {
$user_temp = $conf->cache['user'][$object->fk_user_valid];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_valid);
$conf->cache['user'][$object->fk_user_valid] = $user_temp;
}
print $user_temp->getNomUrl(-1);
}
} elseif ($key == 'lang') {
$labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
print $labellang;
} else {
print $object->showOutputField($val, $key, $object->$key, '');
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} elseif ($key == 'fk_user_creat') {
if ($object->fk_user_creat > 0) {
if (isset($conf->cache['user'][$object->fk_user_creat])) {
$user_temp = $conf->cache['user'][$object->fk_user_creat];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_creat);
$conf->cache['user'][$object->fk_user_creat] = $user_temp;
}
print $user_temp->getNomUrl(-1);
}
} elseif ($key == 'fk_user_modif') {
if ($object->fk_user_modif > 0) {
if (isset($conf->cache['user'][$object->fk_user_modif])) {
$user_temp = $conf->cache['user'][$object->fk_user_modif];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_modif);
$conf->cache['user'][$object->fk_user_modif] = $user_temp;
}
print $user_temp->getNomUrl(-1);
}
} elseif ($key == 'fk_user_valid') {
if ($object->fk_user_valid > 0) {
if (isset($conf->cache['user'][$object->fk_user_valid])) {
$user_temp = $conf->cache['user'][$object->fk_user_valid];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_valid);
$conf->cache['user'][$object->fk_user_valid] = $user_temp;
}
print $user_temp->getNomUrl(-1);
}
} elseif ($key == 'lang') {
$labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
print $labellang;
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
print '</td>';
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['nbfield']++;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
print '</tr>'."\n";
}
$i++;
}

View File

@ -27,6 +27,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
// load mrp libraries
require_once __DIR__.'/class/mo.class.php';

View File

@ -182,16 +182,17 @@ class Entrepot extends CommonObject
/**
* Creation d'un entrepot en base
*
* @param User $user Object user that create the warehouse
* @param User $user Object user that create the warehouse
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int >0 if OK, =<0 if KO
*/
public function create($user)
public function create($user, $notrigger = false)
{
global $conf;
$error = 0;
$this->label = trim(!empty($this->label) ? $this->label : $this->libelle);
$this->label = trim($this->label);
// Error if label not defined
if ($this->label == '') {
@ -222,14 +223,21 @@ class Entrepot extends CommonObject
// Actions on extra fields
if (!$error) {
if (!$error) {
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
}
if (!$error && !$notrigger) {
// Call triggers
$result = $this->call_trigger('WAREHOUSE_CREATE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return $id;
@ -254,11 +262,12 @@ class Entrepot extends CommonObject
/**
* Update properties of a warehouse
*
* @param int $id id of warehouse to modify
* @param User $user User object
* @param int $id id of warehouse to modify
* @param User $user User object
* @param bool $notrigger false=launch triggers after, true=disable trigge
* @return int >0 if OK, <0 if KO
*/
public function update($id, $user)
public function update($id, $user, $notrigger = false)
{
global $conf;
@ -267,9 +276,6 @@ class Entrepot extends CommonObject
if (empty($id)) {
$id = $this->id;
}
if (empty($this->label)) {
$this->label = $this->libelle; // For backward compatibility
}
// Check if new parent is already a child of current warehouse
if (!empty($this->fk_parent)) {
@ -281,7 +287,7 @@ class Entrepot extends CommonObject
}
}
$this->label = trim(!empty($this->label) ? $this->label : $this->libelle);
$this->label = trim($this->label);
$this->description = trim($this->description);
@ -324,6 +330,15 @@ class Entrepot extends CommonObject
}
}
if (!$error && !$notrigger) {
// Call triggers
$result = $this->call_trigger('WAREHOUSE_MODIFY', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return 1;
@ -461,7 +476,6 @@ class Entrepot extends CommonObject
$this->fk_project = $obj->fk_project;
$this->ref = $obj->label;
$this->label = $obj->label;
$this->libelle = $obj->label; // deprecated
$this->description = $obj->description;
$this->statut = $obj->statut;
$this->lieu = $obj->lieu;
@ -705,7 +719,7 @@ class Entrepot extends CommonObject
if (isset($this->statut)) {
$label .= ' '.$this->getLibStatut(5);
}
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref);
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.(empty($this->ref) ? $this->label : $this->ref);
if (!empty($this->lieu)) {
$label .= '<br><b>'.$langs->trans('LocationSummary').':</b> '.$this->lieu;
}
@ -742,7 +756,7 @@ class Entrepot extends CommonObject
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label));
$result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : $this->label);
}
$result .= $linkend;
@ -798,7 +812,7 @@ class Entrepot extends CommonObject
// phpcs:enable
global $user, $langs, $conf;
$TArbo = array(empty($this->label) ? $this->libelle : $this->label);
$TArbo = array($this->label);
$protection = 100; // We limit depth of warehouses to 100

View File

@ -1024,6 +1024,41 @@ class RecruitmentCandidature extends CommonObject
return $error;
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs, $selected,$arrayofselected;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (in_array($this->id, $arrayofselected)) {
$selected = 1;
}
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_recruitmentjobposition')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans('Job').'</span> : <span class="info-box-label">'.$this->fk_recruitmentjobposition.'</span>';
}
if (property_exists($this, 'phone')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("phone").'</span> : <span class="info-box-label">'.$this->phone.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -1107,4 +1107,43 @@ class RecruitmentJobPosition extends CommonObject
return $error;
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs, $selected,$arrayofselected,$obj;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (in_array($this->id, $arrayofselected)) {
$selected = 1;
}
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'date_planned')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_planned), 'day').'</span>';
}
if (property_exists($this, 'qty')) {
$return .= '<br><span class="opacitymedium" title="'.$langs->trans("NbOfEmployeesExpected").'">'.$langs->trans("NbOfEmployeesExpected", '', '', '', '', 2).'</span> : <span class="info-box-label">'.$this->qty.'</span>';
}
if (property_exists($this, 'remuneration_suggested')) {
$return .= ' | <span class="opacitymedium">'.$langs->trans("Remuneration").'</span> : <span class="info-box-label">'.$this->remuneration_suggested.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).' | <span class="opacitymedium" title="'.$langs->trans("RecruitmentCandidatures").'">'.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).'</span> : <span>'.$obj->nbapplications.'</span></div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -735,8 +735,18 @@ while ($i < $imaxinloop) {
print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container">';
}
$recuitment = new RecruitmentJobPosition($db);
$recuitment->fetch($obj->fk_recruitmentjobposition);
$object->fk_recruitmentjobposition = $recuitment->getNomUrl();
$object->phone = $obj->phone;
// Output Kanban
print $object->getKanbanView('');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($massactionbutton || $massaction) {
$selected = 0;
}
// Output Kanban
print $object->getKanbanView('');
}
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -585,14 +585,21 @@ while ($i < $imaxinloop) {
// Store properties in $object
$object->setVarsFromFetchObj($obj);
$object->date_planned = $obj->date_planned;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $object->getKanbanView('');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($massactionbutton || $massaction) {
$selected = 0;
}
// Output Kanban
print $object->getKanbanView('');
}
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -2932,6 +2932,42 @@ class Ticket extends CommonObject
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs, $selected,$arrayofselected,$obj;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (in_array($this->id, $arrayofselected)) {
$selected = 1;
}
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_user_assign') && !empty($this->fk_user_assign)) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("AssignedTo").'</span> : <span class="info-box-label">'.$this->fk_user_assign.'</span>';
}
if (property_exists($this, 'type_code') && !empty($this->type_code)) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span> : ';
$return .= $langs->getLabelFromKey($this->db, 'TicketTypeShort'.$this->type_code, 'c_ticket_type', 'code', 'label', $this->type_code);
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -629,6 +629,9 @@ if ($projectid > 0 || $project_ref) {
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -740,7 +743,10 @@ $url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write);
$picto = 'ticket';
if ($socid > 0) {
@ -999,176 +1005,199 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->setVarsFromFetchObj($obj);
$object->status = $object->fk_statut; // fk_statut is deprecated
// Show here line of result
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($key, array('ref', 'fk_project'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
}
if ($key == 'fk_statut' || $key == 'severity_code') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td';
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print ' class="';
// get infos needed from object
$userstatic = new User($db);
$userstatic->fetch($obj->fk_user_assign);
$object->fk_user_assign = $userstatic->getNomUrl(-1);
$object->type_code = $obj->type_code;
// Output Kanban
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($massactionbutton || $massaction) {
$selected = 0;
}
print $cssforfield;
if ($cssforfield && array_key_exists('css', $val) && $val['css']) {
print ' ';
}
if (array_key_exists('css', $val)) {
print $val['css'];
}
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print '"';
}
print '>';
if ($key == 'fk_statut') {
print $object->getLibStatut(5);
} elseif ($key == 'subject') {
$s = $obj->subject;
print '<span title="'.dol_escape_htmltag($s).'">';
print dol_escape_htmltag($s);
print '</span>';
} elseif ($key == 'type_code') {
$s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
print '<span title="'.dol_escape_htmltag($s).'">';
print $s;
print '</span>';
} elseif ($key == 'category_code') {
$s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
print '<span title="'.dol_escape_htmltag($s).'">';
print $s;
print '</span>';
} elseif ($key == 'severity_code') {
$s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
print '<span title="'.dol_escape_htmltag($s).'">';
print $s;
print '</span>';
} elseif ($key == 'tms') {
print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
} elseif ($key == 'fk_user_create') {
if ($object->fk_user_create > 0) {
if (isset($conf->cache['user'][$object->fk_user_create])) {
$user_temp = $conf->cache['user'][$object->fk_user_create];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_create);
$conf->cache['user'][$object->fk_user_create] = $user_temp;
}
print $user_temp->getNomUrl(-1);
print $object->getKanbanView('');
}
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
// Show here line of result
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
} elseif ($key == 'fk_user_assign') {
if ($object->fk_user_assign > 0) {
if (isset($conf->cache['user'][$object->fk_user_assign])) {
$user_temp = $conf->cache['user'][$object->fk_user_assign];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_assign);
$conf->cache['user'][$object->fk_user_assign] = $user_temp;
}
print $user_temp->getNomUrl(-1);
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($key, array('ref', 'fk_project'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
}
if ($key == 'fk_statut' || $key == 'severity_code') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td';
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print ' class="';
}
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
} elseif ($key == 'ref') {
print $object->showOutputField($val, $key, $obj->$key, '');
// display a warning on untreated tickets
$is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED );
$should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE));
if ($is_open && $should_show_warning) {
$date_last_msg_sent = (int) $object->date_last_msg_sent;
$hour_diff = ($now - $date_last_msg_sent) / 3600 ;
if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) {
$creation_date = $object->datec;
$hour_diff_creation = ($now - $creation_date) / 3600 ;
if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) {
print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', '');
print $cssforfield;
if ($cssforfield && array_key_exists('css', $val) && $val['css']) {
print ' ';
}
if (array_key_exists('css', $val)) {
print $val['css'];
}
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print '"';
}
print '>';
if ($key == 'fk_statut') {
print $object->getLibStatut(5);
} elseif ($key == 'subject') {
$s = $obj->subject;
print '<span title="'.dol_escape_htmltag($s).'">';
print dol_escape_htmltag($s);
print '</span>';
} elseif ($key == 'type_code') {
$s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
print '<span title="'.dol_escape_htmltag($s).'">';
print $s;
print '</span>';
} elseif ($key == 'category_code') {
$s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
print '<span title="'.dol_escape_htmltag($s).'">';
print $s;
print '</span>';
} elseif ($key == 'severity_code') {
$s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
print '<span title="'.dol_escape_htmltag($s).'">';
print $s;
print '</span>';
} elseif ($key == 'tms') {
print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
} elseif ($key == 'fk_user_create') {
if ($object->fk_user_create > 0) {
if (isset($conf->cache['user'][$object->fk_user_create])) {
$user_temp = $conf->cache['user'][$object->fk_user_create];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_create);
$conf->cache['user'][$object->fk_user_create] = $user_temp;
}
} elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) {
print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning');
print $user_temp->getNomUrl(-1);
}
}
} else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
$tmp = explode(':', $val['type']);
if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
// It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making.
//var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']);
if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) {
$result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']];
} elseif ($key == 'fk_user_assign') {
if ($object->fk_user_assign > 0) {
if (isset($conf->cache['user'][$object->fk_user_assign])) {
$user_temp = $conf->cache['user'][$object->fk_user_assign];
} else {
$user_temp = new User($db);
$user_temp->fetch($object->fk_user_assign);
$conf->cache['user'][$object->fk_user_assign] = $user_temp;
}
print $user_temp->getNomUrl(-1);
}
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
} elseif ($key == 'ref') {
print $object->showOutputField($val, $key, $obj->$key, '');
// display a warning on untreated tickets
$is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED );
$should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE));
if ($is_open && $should_show_warning) {
$date_last_msg_sent = (int) $object->date_last_msg_sent;
$hour_diff = ($now - $date_last_msg_sent) / 3600 ;
if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) {
$creation_date = $object->datec;
$hour_diff_creation = ($now - $creation_date) / 3600 ;
if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) {
print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', '');
}
} elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) {
print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning');
}
}
} else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
$tmp = explode(':', $val['type']);
if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
// It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making.
//var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']);
if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) {
$result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']];
} else {
$result = $object->showOutputField($val, $key, $obj->$key, '');
$cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result;
}
} else {
$result = $object->showOutputField($val, $key, $obj->$key, '');
$cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result;
}
} else {
$result = $object->showOutputField($val, $key, $obj->$key, '');
print $result;
}
print $result;
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
print '</td>';
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['nbfield']++;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
print '</tr>'."\n";
}
$i++;
}