|
@@ -35,6 +35,8 @@ if (isModEnabled('project')) {
|
|
|
// Load translation files required by the page
|
|
|
$langs->loadLangs(array('companies', 'donations'));
|
|
|
|
|
|
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
|
|
|
+$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
|
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'sclist';
|
|
|
|
|
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|
@@ -65,9 +67,6 @@ $search_name = GETPOST('search_name', 'alpha');
|
|
|
$search_amount = GETPOST('search_amount', 'alpha');
|
|
|
$optioncss = GETPOST('optioncss', 'alpha');
|
|
|
$moreforfilter = GETPOST('moreforfilter', 'alpha');
|
|
|
-if (!$user->rights->don->lire) {
|
|
|
- accessforbidden();
|
|
|
-}
|
|
|
|
|
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers
|
|
|
$search_all = "";
|
|
@@ -80,7 +79,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|
|
}
|
|
|
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
|
-$hookmanager->initHooks(array('orderlist'));
|
|
|
+$hookmanager->initHooks(array('donationlist'));
|
|
|
|
|
|
|
|
|
// List of fields to search into when doing a "search in all"
|
|
@@ -94,6 +93,22 @@ $fieldstosearchall = array(
|
|
|
// Security check
|
|
|
$result = restrictedArea($user, 'don');
|
|
|
|
|
|
+$permissiontoread = $user->hasRight('don', 'read');
|
|
|
+$permissiontoadd = $user->hasRight('don', 'write');
|
|
|
+$permissiontodelete = $user->hasRight('don', 'delete');
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * Actions
|
|
|
+ */
|
|
|
+
|
|
|
+if (GETPOST('cancel', 'alpha')) {
|
|
|
+ $action = 'list';
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
@@ -101,20 +116,24 @@ $result = restrictedArea($user, 'don');
|
|
|
* View
|
|
|
*/
|
|
|
|
|
|
-$donationstatic = new Don($db);
|
|
|
$form = new Form($db);
|
|
|
+$donationstatic = new Don($db);
|
|
|
if (isModEnabled('project')) {
|
|
|
$projectstatic = new Project($db);
|
|
|
}
|
|
|
|
|
|
+$title = $langs->trans("Donations");
|
|
|
$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:Modul_Spenden';
|
|
|
|
|
|
-llxHeader('', $langs->trans("Donations"), $help_url);
|
|
|
|
|
|
-// Genere requete de liste des dons
|
|
|
+// Build and execute select
|
|
|
+// --------------------------------------------------------------------
|
|
|
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
|
|
|
$sql .= " d.amount, d.fk_statut as status,";
|
|
|
$sql .= " p.rowid as pid, p.ref, p.title, p.public";
|
|
|
+
|
|
|
+$sqlfields = $sql; // $sql fields to remove for count total
|
|
|
+
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
|
|
$sql .= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
|
|
|
if ($search_status != '' && $search_status != '-4') {
|
|
@@ -136,240 +155,342 @@ if ($search_amount) {
|
|
|
$sql .= natural_search('d.amount', $search_amount, 1);
|
|
|
}
|
|
|
|
|
|
-$sql .= $db->order($sortfield, $sortorder);
|
|
|
-
|
|
|
+// Count total nb of records
|
|
|
$nbtotalofrecords = '';
|
|
|
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
|
|
- $result = $db->query($sql);
|
|
|
- $nbtotalofrecords = $db->num_rows($result);
|
|
|
- if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
|
|
+ /* The fast and low memory method to get and count full list converts the sql into a sql count */
|
|
|
+ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
|
|
+ $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
|
|
+ $resql = $db->query($sqlforcount);
|
|
|
+ if ($resql) {
|
|
|
+ $objforcount = $db->fetch_object($resql);
|
|
|
+ $nbtotalofrecords = $objforcount->nbtotalofrecords;
|
|
|
+ } else {
|
|
|
+ dol_print_error($db);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
|
|
|
$page = 0;
|
|
|
$offset = 0;
|
|
|
}
|
|
|
+ $db->free($resql);
|
|
|
}
|
|
|
|
|
|
-$sql .= $db->plimit($limit + 1, $offset);
|
|
|
+// Complete request and execute it with limit
|
|
|
+$sql .= $db->order($sortfield, $sortorder);
|
|
|
+if ($limit) {
|
|
|
+ $sql .= $db->plimit($limit + 1, $offset);
|
|
|
+}
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
-if ($resql) {
|
|
|
- $num = $db->num_rows($resql);
|
|
|
- $i = 0;
|
|
|
+if (!$resql) {
|
|
|
+ dol_print_error($db);
|
|
|
+ exit;
|
|
|
+}
|
|
|
|
|
|
- $param = '';
|
|
|
- if (!empty($mode)) {
|
|
|
- $param .= '&mode='.urlencode($mode);
|
|
|
- }
|
|
|
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
- $param .= '&contextpage='.urlencode($contextpage);
|
|
|
- }
|
|
|
- if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
- $param .= '&limit='.((int) $limit);
|
|
|
- }
|
|
|
- if ($optioncss != '') {
|
|
|
- $param .= '&optioncss='.urlencode($optioncss);
|
|
|
- }
|
|
|
- if ($search_status && $search_status != -1) {
|
|
|
- $param .= '&search_status='.urlencode($search_status);
|
|
|
- }
|
|
|
- if ($search_ref) {
|
|
|
- $param .= '&search_ref='.urlencode($search_ref);
|
|
|
- }
|
|
|
- if ($search_company) {
|
|
|
- $param .= '&search_company='.urlencode($search_company);
|
|
|
- }
|
|
|
- if ($search_name) {
|
|
|
- $param .= '&search_name='.urlencode($search_name);
|
|
|
- }
|
|
|
- if ($search_amount) {
|
|
|
- $param .= '&search_amount='.urlencode($search_amount);
|
|
|
- }
|
|
|
+$num = $db->num_rows($resql);
|
|
|
|
|
|
- $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'));
|
|
|
- if ($user->rights->don->creer) {
|
|
|
- $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
|
|
|
- }
|
|
|
+// Direct jump if only one record found
|
|
|
+if ($num == 1 && !getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
|
|
|
+ $obj = $db->fetch_object($resql);
|
|
|
+ $id = $obj->rowid;
|
|
|
+ header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id);
|
|
|
+ exit;
|
|
|
+}
|
|
|
|
|
|
- print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
|
- if ($optioncss != '') {
|
|
|
- print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
- }
|
|
|
- print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
- 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="page" value="'.$page.'">';
|
|
|
- print '<input type="hidden" name="type" value="'.$type.'">';
|
|
|
- print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
|
|
|
|
+// Output page
|
|
|
+// --------------------------------------------------------------------
|
|
|
|
|
|
+llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
|
|
|
|
|
|
- print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
|
|
+// Example : Adding jquery code
|
|
|
+// print '<script type="text/javascript">
|
|
|
+// jQuery(document).ready(function() {
|
|
|
+// function init_myfunc()
|
|
|
+// {
|
|
|
+// jQuery("#myid").removeAttr(\'disabled\');
|
|
|
+// jQuery("#myid").attr(\'disabled\',\'disabled\');
|
|
|
+// }
|
|
|
+// init_myfunc();
|
|
|
+// jQuery("#mybutton").click(function() {
|
|
|
+// init_myfunc();
|
|
|
+// });
|
|
|
+// });
|
|
|
+// </script>';
|
|
|
|
|
|
- if ($search_all) {
|
|
|
- foreach ($fieldstosearchall as $key => $val) {
|
|
|
- $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
- }
|
|
|
- print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
|
|
- }
|
|
|
+$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);
|
|
|
+}
|
|
|
+if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
+ $param .= '&limit='.((int) $limit);
|
|
|
+}
|
|
|
+if ($optioncss != '') {
|
|
|
+ $param .= '&optioncss='.urlencode($optioncss);
|
|
|
+}
|
|
|
+if ($search_status && $search_status != -1) {
|
|
|
+ $param .= '&search_status='.urlencode($search_status);
|
|
|
+}
|
|
|
+if ($search_ref) {
|
|
|
+ $param .= '&search_ref='.urlencode($search_ref);
|
|
|
+}
|
|
|
+if ($search_company) {
|
|
|
+ $param .= '&search_company='.urlencode($search_company);
|
|
|
+}
|
|
|
+if ($search_name) {
|
|
|
+ $param .= '&search_name='.urlencode($search_name);
|
|
|
+}
|
|
|
+if ($search_amount) {
|
|
|
+ $param .= '&search_amount='.urlencode($search_amount);
|
|
|
+}
|
|
|
+
|
|
|
+// List of mass actions available
|
|
|
+$arrayofmassactions = array(
|
|
|
+ //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
|
|
|
+ //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
|
|
+ //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
|
|
+ //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
|
|
+);
|
|
|
+if (!empty($permissiontodelete)) {
|
|
|
+ $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
|
|
+}
|
|
|
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
|
|
+ $arrayofmassactions = array();
|
|
|
+}
|
|
|
+$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|
|
|
|
|
- print '<div class="div-table-responsive">';
|
|
|
- print '<table class="tagtable liste'.(!empty($moreforfilter) ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
|
|
|
- // Filters lines
|
|
|
- print '<tr class="liste_titre_filter">';
|
|
|
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
- print '<td class="liste_titre maxwidthsearch">';
|
|
|
- $searchpicto = $form->showFilterAndCheckAddButtons(0);
|
|
|
- print $searchpicto;
|
|
|
- print '</td>';
|
|
|
+print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
|
+if ($optioncss != '') {
|
|
|
+ print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+}
|
|
|
+print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
+print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
+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="page" value="'.$page.'">';
|
|
|
+print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
+print '<input type="hidden" name="page_y" value="">';
|
|
|
+print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
|
+print '<input type="hidden" name="type" value="'.$type.'">';
|
|
|
+
|
|
|
+$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'));
|
|
|
+if ($user->rights->don->creer) {
|
|
|
+ $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
|
|
|
+}
|
|
|
+
|
|
|
+print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
|
|
+
|
|
|
+if ($search_all) {
|
|
|
+ $setupstring = '';
|
|
|
+ foreach ($fieldstosearchall as $key => $val) {
|
|
|
+ $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ $setupstring .= $key."=".$val.";";
|
|
|
}
|
|
|
+ print '<!-- Search done like if DONATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
|
|
+ print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
|
|
+}
|
|
|
+
|
|
|
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
|
|
+$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
|
|
|
+$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
|
|
+
|
|
|
+print '<div class="div-table-responsive">';
|
|
|
+print '<table class="tagtable nobottomiftotal liste'.(!empty($moreforfilter) ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
+
|
|
|
+// Fields title search
|
|
|
+// --------------------------------------------------------------------
|
|
|
+print '<tr class="liste_titre_filter">';
|
|
|
+// Action column
|
|
|
+if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
+ print '<td class="liste_titre center maxwidthsearch">';
|
|
|
+ $searchpicto = $form->showFilterButtons('left');
|
|
|
+ print $searchpicto;
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
+print '<td class="liste_titre">';
|
|
|
+print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
|
|
|
+print '</td>';
|
|
|
+if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
|
|
print '<td class="liste_titre">';
|
|
|
- print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
|
|
|
+ print '<input class="flat" size="10" type="text" name="search_thirdparty" value="'.$search_thirdparty.'">';
|
|
|
print '</td>';
|
|
|
- if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
|
|
- print '<td class="liste_titre">';
|
|
|
- print '<input class="flat" size="10" type="text" name="search_thirdparty" value="'.$search_thirdparty.'">';
|
|
|
- print '</td>';
|
|
|
- } else {
|
|
|
- print '<td class="liste_titre">';
|
|
|
- print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
+} else {
|
|
|
print '<td class="liste_titre">';
|
|
|
- print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
|
|
|
+ print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
|
|
|
print '</td>';
|
|
|
- print '<td class="liste_titre left">';
|
|
|
+}
|
|
|
+print '<td class="liste_titre">';
|
|
|
+print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
|
|
|
+print '</td>';
|
|
|
+print '<td class="liste_titre left">';
|
|
|
+print ' ';
|
|
|
+print '</td>';
|
|
|
+if (isModEnabled('project')) {
|
|
|
+ print '<td class="liste_titre right">';
|
|
|
print ' ';
|
|
|
print '</td>';
|
|
|
- if (isModEnabled('project')) {
|
|
|
- print '<td class="liste_titre right">';
|
|
|
- print ' ';
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
|
|
- print '<td class="liste_titre right parentonrightofpage">';
|
|
|
- $liststatus = array(
|
|
|
- Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"),
|
|
|
- Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"),
|
|
|
- Don::STATUS_PAID=>$langs->trans("DonationStatusPaid"),
|
|
|
- Don::STATUS_CANCELED=>$langs->trans("Canceled")
|
|
|
- );
|
|
|
- print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth100 onrightofpage');
|
|
|
+}
|
|
|
+print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
|
|
+print '<td class="liste_titre right parentonrightofpage">';
|
|
|
+$liststatus = array(
|
|
|
+ Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"),
|
|
|
+ Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"),
|
|
|
+ Don::STATUS_PAID=>$langs->trans("DonationStatusPaid"),
|
|
|
+ Don::STATUS_CANCELED=>$langs->trans("Canceled")
|
|
|
+);
|
|
|
+print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth100 onrightofpage');
|
|
|
+print '</td>';
|
|
|
+if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
+ print '<td class="liste_titre center maxwidthsearch">';
|
|
|
+ $searchpicto = $form->showFilterButtons();
|
|
|
+ print $searchpicto;
|
|
|
print '</td>';
|
|
|
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
- print '<td class="liste_titre maxwidthsearch">';
|
|
|
- $searchpicto = $form->showFilterAndCheckAddButtons(0);
|
|
|
- print $searchpicto;
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- print "</tr>\n";
|
|
|
+}
|
|
|
+print '</tr>'."\n";
|
|
|
+
|
|
|
+$totalarray = array();
|
|
|
+$totalarray['nbfield'] = 0;
|
|
|
+
|
|
|
+// Fields title label
|
|
|
+// --------------------------------------------------------------------
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+// Action column
|
|
|
+if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
+ print_liste_field_titre('');
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+}
|
|
|
+print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
|
|
|
+$totalarray['nbfield']++;
|
|
|
+if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
|
|
+ print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder);
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+} else {
|
|
|
+ print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder);
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+}
|
|
|
+print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder);
|
|
|
+$totalarray['nbfield']++;
|
|
|
+print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+$totalarray['nbfield']++;
|
|
|
+if (isModEnabled('project')) {
|
|
|
+ $langs->load("projects");
|
|
|
+ print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder);
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+}
|
|
|
+print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
+$totalarray['nbfield']++;
|
|
|
+print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
+$totalarray['nbfield']++;
|
|
|
+if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
+ print_liste_field_titre('');
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+}
|
|
|
+print '</tr>'."\n";
|
|
|
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
- print_liste_field_titre('');
|
|
|
- }
|
|
|
- print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
|
|
|
- if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
|
|
- print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder);
|
|
|
- } else {
|
|
|
- print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder);
|
|
|
- print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
- if (isModEnabled('project')) {
|
|
|
- $langs->load("projects");
|
|
|
- print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
- print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
- print_liste_field_titre('');
|
|
|
- }
|
|
|
- print "</tr>\n";
|
|
|
-
|
|
|
- $imaxinloop = ($limit ? min($num, $limit) : $num);
|
|
|
- while ($i < $imaxinloop) {
|
|
|
- $objp = $db->fetch_object($resql);
|
|
|
- $donationstatic->setVarsFromFetchObj($objp);
|
|
|
- $company = new Societe($db);
|
|
|
- $result = $company->fetch($objp->socid);
|
|
|
-
|
|
|
- if ($mode == 'kanban') {
|
|
|
- if ($i == 0) {
|
|
|
- print '<tr><td colspan="12">';
|
|
|
- print '<div class="box-flex-container kanban">';
|
|
|
- }
|
|
|
- // Output Kanban
|
|
|
- $donationstatic->amount = $objp->amount;
|
|
|
- $donationstatic->date = $objp->datedon;
|
|
|
- $donationstatic->labelStatus = $objp->status;
|
|
|
- $donationstatic->id = $objp->rowid;
|
|
|
- $donationstatic->ref = $objp->rowid;
|
|
|
-
|
|
|
- if (!empty($objp->socid) && $company->id > 0) {
|
|
|
- $donationstatic->societe = $company->getNomUrl(1);
|
|
|
- } else {
|
|
|
- $donationstatic->societe = $objp->societe;
|
|
|
- }
|
|
|
+$i = 0;
|
|
|
+$savnbfield = $totalarray['nbfield'];
|
|
|
+$totalarray = array();
|
|
|
+$totalarray['nbfield'] = 0;
|
|
|
+$imaxinloop = ($limit ? min($num, $limit) : $num);
|
|
|
+while ($i < $imaxinloop) {
|
|
|
+ $obj = $db->fetch_object($resql);
|
|
|
|
|
|
- print $donationstatic->getKanbanView('', array('selected' => in_array($donationstatic->id, $arrayofselected)));
|
|
|
- if ($i == ($imaxinloop - 1)) {
|
|
|
- print '</div>';
|
|
|
- print '</td></tr>';
|
|
|
- }
|
|
|
+ $donationstatic->setVarsFromFetchObj($obj);
|
|
|
+
|
|
|
+ $company = new Societe($db);
|
|
|
+ $result = $company->fetch($obj->socid);
|
|
|
+
|
|
|
+ if ($mode == 'kanban') {
|
|
|
+ if ($i == 0) {
|
|
|
+ print '<tr><td colspan="'.$savnbfield.'">';
|
|
|
+ print '<div class="box-flex-container kanban">';
|
|
|
+ }
|
|
|
+ // Output Kanban
|
|
|
+ $donationstatic->amount = $obj->amount;
|
|
|
+ $donationstatic->date = $obj->datedon;
|
|
|
+ $donationstatic->labelStatus = $obj->status;
|
|
|
+ $donationstatic->id = $obj->rowid;
|
|
|
+ $donationstatic->ref = $obj->rowid;
|
|
|
+
|
|
|
+ if (!empty($obj->socid) && $company->id > 0) {
|
|
|
+ $donationstatic->societe = $company->getNomUrl(1);
|
|
|
} else {
|
|
|
- print '<tr class="oddeven">';
|
|
|
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
- print '<td></td>';
|
|
|
+ $donationstatic->societe = $obj->societe;
|
|
|
+ }
|
|
|
+
|
|
|
+ $object = $donationstatic;
|
|
|
+
|
|
|
+ $selected = -1;
|
|
|
+ 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;
|
|
|
}
|
|
|
- $donationstatic->id = $objp->rowid;
|
|
|
- $donationstatic->ref = $objp->rowid;
|
|
|
- $donationstatic->lastname = $objp->lastname;
|
|
|
- $donationstatic->firstname = $objp->firstname;
|
|
|
- print "<td>".$donationstatic->getNomUrl(1)."</td>";
|
|
|
- if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
|
|
- if (!empty($objp->socid) && $company->id > 0) {
|
|
|
- print "<td>".$company->getNomUrl(1)."</td>";
|
|
|
- } else {
|
|
|
- print "<td>".$objp->societe."</td>";
|
|
|
- }
|
|
|
+ }
|
|
|
+ print $donationstatic->getKanbanView('', array('selected' => $selected));
|
|
|
+ if ($i == ($imaxinloop - 1)) {
|
|
|
+ print '</div>';
|
|
|
+ print '</td></tr>';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ print '<tr class="oddeven">';
|
|
|
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
+ print '<td></td>';
|
|
|
+ }
|
|
|
+ $donationstatic->id = $obj->rowid;
|
|
|
+ $donationstatic->ref = $obj->rowid;
|
|
|
+ $donationstatic->lastname = $obj->lastname;
|
|
|
+ $donationstatic->firstname = $obj->firstname;
|
|
|
+ print "<td>".$donationstatic->getNomUrl(1)."</td>";
|
|
|
+ if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
|
|
+ if (!empty($obj->socid) && $company->id > 0) {
|
|
|
+ print "<td>".$company->getNomUrl(1)."</td>";
|
|
|
} else {
|
|
|
- print "<td>".$objp->societe."</td>";
|
|
|
+ print "<td>".$obj->societe."</td>";
|
|
|
}
|
|
|
- print "<td>".$donationstatic->getFullName($langs)."</td>";
|
|
|
- print '<td class="center">'.dol_print_date($db->jdate($objp->datedon), 'day').'</td>';
|
|
|
- if (isModEnabled('project')) {
|
|
|
- print "<td>";
|
|
|
- if ($objp->pid) {
|
|
|
- $projectstatic->id = $objp->pid;
|
|
|
- $projectstatic->ref = $objp->ref;
|
|
|
- $projectstatic->id = $objp->pid;
|
|
|
- $projectstatic->public = $objp->public;
|
|
|
- $projectstatic->title = $objp->title;
|
|
|
- print $projectstatic->getNomUrl(1);
|
|
|
- } else {
|
|
|
- print ' ';
|
|
|
- }
|
|
|
- print "</td>\n";
|
|
|
- }
|
|
|
- print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
|
|
- print '<td class="right">'.$donationstatic->LibStatut($objp->status, 5).'</td>';
|
|
|
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
- print '<td></td>';
|
|
|
+ } else {
|
|
|
+ print "<td>".$obj->societe."</td>";
|
|
|
+ }
|
|
|
+ print "<td>".$donationstatic->getFullName($langs)."</td>";
|
|
|
+ print '<td class="center">'.dol_print_date($db->jdate($obj->datedon), 'day').'</td>';
|
|
|
+ if (isModEnabled('project')) {
|
|
|
+ print "<td>";
|
|
|
+ if ($obj->pid) {
|
|
|
+ $projectstatic->id = $obj->pid;
|
|
|
+ $projectstatic->ref = $obj->ref;
|
|
|
+ $projectstatic->id = $obj->pid;
|
|
|
+ $projectstatic->public = $obj->public;
|
|
|
+ $projectstatic->title = $obj->title;
|
|
|
+ print $projectstatic->getNomUrl(1);
|
|
|
+ } else {
|
|
|
+ print ' ';
|
|
|
}
|
|
|
- print "</tr>";
|
|
|
+ print "</td>\n";
|
|
|
+ }
|
|
|
+ print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
|
|
+ print '<td class="right">'.$donationstatic->LibStatut($obj->status, 5).'</td>';
|
|
|
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
|
|
+ print '<td></td>';
|
|
|
}
|
|
|
- $i++;
|
|
|
+ print "</tr>";
|
|
|
}
|
|
|
- print "</table>";
|
|
|
- print '</div>';
|
|
|
- print "</form>\n";
|
|
|
- $db->free($resql);
|
|
|
-} else {
|
|
|
- dol_print_error($db);
|
|
|
+ $i++;
|
|
|
}
|
|
|
+print "</table>";
|
|
|
+print '</div>';
|
|
|
+print "</form>\n";
|
|
|
+$db->free($resql);
|
|
|
+
|
|
|
|
|
|
llxFooter();
|
|
|
$db->close();
|