From 81ed97c9ba935bf49f9357341c3b66c7576554df Mon Sep 17 00:00:00 2001 From: javierybar <36415318+javierybar@users.noreply.github.com> Date: Sun, 25 Oct 2020 20:03:25 +0100 Subject: [PATCH 1/8] NEW Credit invoice in TakePOS --- htdocs/takepos/index.php | 26 ++++-- htdocs/takepos/invoice.php | 157 +++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8e6eb397c55..83a8fc7931b 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -25,13 +25,13 @@ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; @@ -888,6 +888,20 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { + + +
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3a67c81d4ba..00a227e8041 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -271,6 +271,154 @@ if ($action == 'valid' && $user->rights->facture->creer) } } +if ($action == 'creditnote') +{ + $creditnote = new Facture($db); + $creditnote->socid = $invoice->socid; + $creditnote->date = dol_now(); + $creditnote->type = Facture::TYPE_CREDIT_NOTE; + $creditnote->fk_facture_source = $placeid; + $creditnote->remise_absolue = $invoice->remise_absolue; + $creditnote->remise_percent = $invoice->remise_percent; + $creditnote->create($user); + + foreach ($invoice->lines as $line) + { + // Extrafields + if (method_exists($line, 'fetch_optionals')) { + // load extrafields + $line->fetch_optionals(); + } + // Reset fk_parent_line for no child products and special product + if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { + $fk_parent_line = 0; + } + if ($invoice->type == Facture::TYPE_SITUATION) + { + $source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id + $line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from + if (!empty($invoice->tab_previous_situation_invoice)) + { + // search the last standard invoice in cycle and the possible credit note between this last and invoice + // TODO Move this out of loop of $invoice->lines + $tab_jumped_credit_notes = array(); + $lineIndex = count($invoice->tab_previous_situation_invoice) - 1; + $searchPreviousInvoice = true; + while ($searchPreviousInvoice) + { + if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1) + { + $searchPreviousInvoice = false; // find, exit; + break; + } else { + if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) { + $tab_jumped_credit_notes[$lineIndex] = $invoice->tab_previous_situation_invoice[$lineIndex]->id; + } + $lineIndex--; // go to previous invoice in cycle + } + } + + $maxPrevSituationPercent = 0; + foreach ($invoice->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) + { + if ($prevLine->id == $source_fk_prev_id) + { + $maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent); + + //$line->subprice = $line->subprice - $prevLine->subprice; + $line->total_ht = $line->total_ht - $prevLine->total_ht; + $line->total_tva = $line->total_tva - $prevLine->total_tva; + $line->total_ttc = $line->total_ttc - $prevLine->total_ttc; + $line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1; + $line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2; + + $line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice; + $line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht; + $line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva; + $line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc; + } + } + + // prorata + $line->situation_percent = $maxPrevSituationPercent - $line->situation_percent; + + //print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'
'; + + // If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta) + $maxPrevSituationPercent = 0; + foreach ($tab_jumped_credit_notes as $index => $creditnoteid) { + foreach ($invoice->tab_previous_situation_invoice[$index]->lines as $prevLine) + { + if ($prevLine->fk_prev_id == $source_fk_prev_id) + { + $maxPrevSituationPercent = $prevLine->situation_percent; + + $line->total_ht -= $prevLine->total_ht; + $line->total_tva -= $prevLine->total_tva; + $line->total_ttc -= $prevLine->total_ttc; + $line->total_localtax1 -= $prevLine->total_localtax1; + $line->total_localtax2 -= $prevLine->total_localtax2; + + $line->multicurrency_subprice -= $prevLine->multicurrency_subprice; + $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht; + $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva; + $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc; + } + } + } + + // prorata + $line->situation_percent += $maxPrevSituationPercent; + + //print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'
'; + } + } + + $line->fk_facture = $creditnote->id; + $line->fk_parent_line = $fk_parent_line; + + $line->subprice = -$line->subprice; // invert price for object + $line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here + $line->total_ht = -$line->total_ht; + $line->total_tva = -$line->total_tva; + $line->total_ttc = -$line->total_ttc; + $line->total_localtax1 = -$line->total_localtax1; + $line->total_localtax2 = -$line->total_localtax2; + + $line->multicurrency_subprice = -$line->multicurrency_subprice; + $line->multicurrency_total_ht = -$line->multicurrency_total_ht; + $line->multicurrency_total_tva = -$line->multicurrency_total_tva; + $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc; + + $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked + + $creditnote->lines[] = $line; // insert new line in current object + + // Defined the new fk_parent_line + if ($result > 0 && $line->product_type == 9) { + $fk_parent_line = $result; + } + } + $creditnote->update_price(1); + + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; + if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") { + $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; + $conf->global->STOCK_CALCULATE_ON_BILL = 1; + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey); + $batch_rule = 0; + if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; + $batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST; + } + $res = $creditnote->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule); + $conf->global->STOCK_CALCULATE_ON_BILL = $savconst; + } else { + $res = $creditnote->validate($user); + } +} + if ($action == 'history') { $placeid = (int) GETPOST('placeid', 'int'); @@ -785,6 +933,11 @@ function DolibarrTakeposPrinting(id) { }); } +function CreditNote() { + $("#poslines").load("invoice.php?action=creditnote&invoiceid="+placeid, function() { + }); +} + $( document ).ready(function() { console.log("Set customer info and sales in header"); @@ -1162,6 +1315,10 @@ if ($placeid > 0) print ''; +if ($action == "valid" || $action == "history"){ + print ''; +} + if ($action == "search") { From a66be11e71dc4248191db53141accc7bdde9b28b Mon Sep 17 00:00:00 2001 From: javierybar <36415318+javierybar@users.noreply.github.com> Date: Sun, 25 Oct 2020 20:06:50 +0100 Subject: [PATCH 2/8] Update index.php --- htdocs/takepos/index.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 83a8fc7931b..a30ccc2935f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -25,13 +25,13 @@ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; From d23b6e145a9f3afa328c285e47303a2bef0fe0e6 Mon Sep 17 00:00:00 2001 From: javierybar <36415318+javierybar@users.noreply.github.com> Date: Sun, 25 Oct 2020 20:24:17 +0100 Subject: [PATCH 3/8] Fixes --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 00a227e8041..8975c7426c3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -281,7 +281,7 @@ if ($action == 'creditnote') $creditnote->remise_absolue = $invoice->remise_absolue; $creditnote->remise_percent = $invoice->remise_percent; $creditnote->create($user); - + foreach ($invoice->lines as $line) { // Extrafields @@ -400,7 +400,7 @@ if ($action == 'creditnote') } } $creditnote->update_price(1); - + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") { $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; From 557a0caa912792b1bbaa1af146e46378df6ef3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 20:10:19 +0100 Subject: [PATCH 4/8] Update interface_20_all_Logevents.class.php --- .../triggers/interface_20_all_Logevents.class.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 7fa7e32da08..d5e31c36d28 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -81,23 +81,20 @@ class InterfaceLogevents extends DolibarrTriggers $text .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg); $desc = "(UserLogged,".$object->login.")"; $desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg); - } - if ($action == 'USER_LOGIN_FAILED') { + } elseif ($action == 'USER_LOGIN_FAILED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) $text = $object->trigger_mesg; // Message direct $desc = $object->trigger_mesg; // Message direct - } - if ($action == 'USER_LOGOUT') { + } elseif ($action == 'USER_LOGOUT') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = "(UserLogoff,".$object->login.")"; $desc = "(UserLogoff,".$object->login.")"; - } - if ($action == 'USER_CREATE') { + } elseif ($action == 'USER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); @@ -136,10 +133,8 @@ class InterfaceLogevents extends DolibarrTriggers // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("UserDeleted", $object->login); $desc = $langs->transnoentities("UserDeleted", $object->login); - } - - // Groupes - elseif ($action == 'USERGROUP_CREATE') { + } elseif ($action == 'USERGROUP_CREATE') { + // Groups dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) From 0bdd6abca96aac49a9c30dd90806cfc9d8619988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 20:14:45 +0100 Subject: [PATCH 5/8] Update interface_99_modZapier_ZapierTriggers.class.php --- .../interface_99_modZapier_ZapierTriggers.class.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 9c9fffff8ae..d028cf0f59f 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2020 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,11 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceZapierTriggers extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * From 42f5fd7d5f7df201edb03d0a6a6fa8cf1088fc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 21:38:16 +0100 Subject: [PATCH 6/8] display last members like on list --- htdocs/adherents/index.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index c63bb9049ca..aa7564007a6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -285,6 +285,7 @@ print '
'; $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; +$sql .= " a.gender, a.email, a.photo, a.morphy,"; $sql .= " a.tms as datem, datefin as date_end_subscription,"; $sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; @@ -307,8 +308,13 @@ if ($resql) { $obj = $db->fetch_object($resql); print ''; $staticmember->id = $obj->rowid; + $staticmember->ref = $obj->rowid; $staticmember->lastname = $obj->lastname; $staticmember->firstname = $obj->firstname; + $staticmember->gender = $obj->gender; + $staticmember->email = $obj->email; + $staticmember->photo = $obj->photo; + $staticmember->morphy = $obj->morphy; if (!empty($obj->fk_soc)) { $staticmember->fk_soc = $obj->fk_soc; $staticmember->fetch_thirdparty(); @@ -316,10 +322,9 @@ if ($resql) { } else { $staticmember->name = $obj->company; } - $staticmember->ref = $staticmember->getFullName($langs); $statictype->id = $obj->typeid; $statictype->label = $obj->label; - print ''.$staticmember->getNomUrl(1, 32).''; + print ''.$staticmember->getNomUrl(-1, 32).''; print ''.$statictype->getNomUrl(1, 32).''; print ''.dol_print_date($db->jdate($obj->datem), 'dayhour').''; print ''.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).''; @@ -340,7 +345,8 @@ if ($resql) { $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; -$sql .= " datefin as date_end_subscription,"; +$sql .= " a.gender, a.email, a.photo, a.morphy,"; +$sql .= " a.datefin as date_end_subscription,"; $sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c"; $sql .= " WHERE a.entity IN (".getEntity('adherent').")"; @@ -364,8 +370,13 @@ if ($resql) { $subscriptionstatic->id = $obj->cid; $subscriptionstatic->ref = $obj->cid; $staticmember->id = $obj->rowid; + $staticmember->ref = $obj->rowid; $staticmember->lastname = $obj->lastname; $staticmember->firstname = $obj->firstname; + $staticmember->gender = $obj->gender; + $staticmember->email = $obj->email; + $staticmember->photo = $obj->photo; + $staticmember->morphy = $obj->morphy; if (!empty($obj->fk_soc)) { $staticmember->fk_soc = $obj->fk_soc; $staticmember->fetch_thirdparty(); @@ -373,9 +384,8 @@ if ($resql) { } else { $staticmember->name = $obj->company; } - $staticmember->ref = $staticmember->getFullName($langs); print ''.$subscriptionstatic->getNomUrl(1).''; - print ''.$staticmember->getNomUrl(1, 32, 'subscription').''; + print ''.$staticmember->getNomUrl(-1, 32, 'subscription').''; print ''.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).''; print ''.price($obj->subscription).''; //print ''.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; From d3c87dabab1c8fc2da0eae5f33729de61a858890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 21:51:17 +0100 Subject: [PATCH 7/8] display members --- htdocs/adherents/list.php | 7 +++---- htdocs/adherents/subscription/list.php | 7 +++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ef4639e4b5e..05100582ec2 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -656,6 +656,7 @@ while ($i < min($num, $limit)) { $memberstatic->datefin = $datefin; $memberstatic->socid = $obj->fk_soc; $memberstatic->photo = $obj->photo; + $memberstatic->email = $obj->email; $memberstatic->morphy = $obj->morphy; $memberstatic->note_public = $obj->note_public; $memberstatic->note_private = $obj->note_private; @@ -725,12 +726,10 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['d.morphy']['checked'])) { print ''; $s = ''; - if ($obj->morphy == 'phy') - { + if ($obj->morphy == 'phy') { $s .= ''.dol_substr($langs->trans("Physical"), 0, 1).''; } - if ($obj->morphy == 'mor') - { + if ($obj->morphy == 'mor') { $s .= ''.dol_substr($langs->trans("Moral"), 0, 1).''; } print $s; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 364a7854fb7..9b5efa214b9 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -142,6 +142,7 @@ $now = dol_now(); // List of subscriptions $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d.statut,"; +$sql .= " d.gender, d.email, d.morphy,"; $sql .= " c.rowid as crowid, c.fk_type, c.subscription,"; $sql .= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,"; $sql .= " c.fk_bank as bank, c.note,"; @@ -151,8 +152,7 @@ $sql .= " JOIN ".MAIN_DB_PREFIX."subscription as c on d.rowid = c.fk_adherent"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; -if (isset($date_select) && $date_select != '') -{ +if (isset($date_select) && $date_select != '') { $sql .= " AND c.dateadh >= '".((int) $date_select)."-01-01 00:00:00'"; $sql .= " AND c.dateadh < '".((int) $date_select + 1)."-01-01 00:00:00'"; } @@ -403,6 +403,9 @@ while ($i < min($num, $limit)) { $adherent->statut = $obj->statut; $adherent->login = $obj->login; $adherent->photo = $obj->photo; + $adherent->gender = $obj->gender; + $adherent->morphy = $obj->morphy; + $adherent->email = $obj->email; $adherent->typeid = $obj->type; $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid); From 4a0dd3b4bce9e323c3d701b58cba7d7db0033ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 22:05:40 +0100 Subject: [PATCH 8/8] add small photo in picto link --- htdocs/core/lib/functions2.lib.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index d49085ecb8e..2f859d3093a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -227,12 +227,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_creation)) { - if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0); + if ($object->user_creation->id) print $object->user_creation->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -261,12 +261,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_modification)) { - if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0); + if ($object->user_modification->id) print $object->user_modification->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -295,12 +295,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_validation)) { - if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0); + if ($object->user_validation->id) print $object->user_validation->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -329,12 +329,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_approve)) { - if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0); + if ($object->user_approve->id) print $object->user_approve->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -363,7 +363,7 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; $userstatic = new User($db); $userstatic->fetch($object->user_approve_id2); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); if ($usetable) print ''; else print '
'; @@ -392,12 +392,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_closing)) { - if ($object->user_closing->id) print $object->user_closing->getNomUrl(1, '', 0, 0, 0); + if ($object->user_closing->id) print $object->user_closing->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_closing); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -427,7 +427,7 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_rappro)) { - if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0); + if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db);