Standardize code and look and feel

This commit is contained in:
Laurent Destailleur 2020-10-16 13:30:20 +02:00
parent 7a7e1ad7cf
commit 7504f92a41
31 changed files with 256 additions and 236 deletions

View File

@ -393,7 +393,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -474,7 +474,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -386,7 +386,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -85,7 +85,7 @@ $search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val)
{
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
}
// List of fields to search into when doing a "search in all"
@ -311,6 +311,7 @@ foreach ($search as $key => $val)
}
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@ -485,7 +486,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -844,14 +844,14 @@ if ($resql)
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print '</td>';
}
// Status billed
if (!empty($arrayfields['c.facture']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
print '</td>';
}
// Action column

View File

@ -839,7 +839,7 @@ if ($resql)
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('RubriquesTransactions').' : ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1);
$moreforfilter .= $form->selectarray('search_bid', $cate_arbo, $search_bid, 1);
$moreforfilter .= $form->selectarray('search_bid', $cate_arbo, $search_bid, 1, 0, 0, '', 0, 0, 0, '', '', 1);
$moreforfilter .= '</div>';
}
}
@ -940,7 +940,7 @@ if ($resql)
if (!empty($arrayfields['b.conciliated']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1);
print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1);
print '</td>';
}
print '<td class="liste_titre" align="middle">';

View File

@ -43,9 +43,12 @@ $bankcateg = new BankCateg($db);
$categid = GETPOST('categid');
$label = GETPOST("label");
/*
* Add category
* Actions
*/
if (GETPOST('add'))
{
if ($label) {
@ -95,14 +98,17 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td><td colspan="2">'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("Ref").'</td><td>'.$langs->trans("Label").'</td>';
print '<td></td>';
print '<td></td>';
print "</tr>\n";
// Line to add category
if ($action != 'edit')
{
print '<tr class="oddeven">';
print '<td>&nbsp;</td><td><input name="label" type="text" size="45"></td>';
print '<td>&nbsp;</td><td><input name="label" type="text" class="maxwidth100"></td>';
print '<td></td>';
print '<td class="center"><input type="submit" name="add" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
}
@ -111,7 +117,7 @@ if ($action != 'edit')
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_categ";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " ORDER BY label";
$sql .= " ORDER BY rowid";
$result = $db->query($sql);
if ($result)
@ -124,16 +130,19 @@ if ($result)
$objp = $db->fetch_object($result);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$objp->rowid.'</a></td>';
print '<td>'.$objp->rowid.'</td>';
if (GETPOST('action', 'aZ09') == 'edit' && GETPOST("categid") == $objp->rowid)
{
print "<td colspan=2>";
print '<td colspan="3">';
print '<input type="hidden" name="categid" value="'.$objp->rowid.'">';
print '<input name="label" type="text" size=45 value="'.$objp->label.'">';
print '<input type="submit" name="update" class="button" value="'.$langs->trans("Edit").'">';
print "</td>";
} else {
print "<td >".$objp->label."</td>";
print "<td>".$objp->label."</td>";
print '<td>';
//print '<a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$langs->trans("List").'</a>';
print '</td>';
print '<td class="center">';
print '<a class="editfielda reposition marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=edit&amp;token='.newToken().'">'.img_edit().'</a>';
print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=delete&amp;token='.newToken().'">'.img_delete().'</a>';

View File

@ -217,24 +217,21 @@ if ($resql)
$help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:M&oacute;dulo_Bancos_y_Cajas';
llxHeader('', $title, $help_url);
$link = '';
$num_rows = count($accounts);
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($search_ref != '') $param .= '&search_ref='.$search_ref;
if ($search_label != '') $param .= '&search_label='.$search_label;
if ($search_number != '') $param .= '&search_number='.$search_number;
if ($search_status != '') $param .= '&search_status='.$search_status;
if ($show_files) $param .= '&show_files='.$show_files;
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref != '') $param .= '&search_ref='.urlencode($search_ref);
if ($search_label != '') $param .= '&search_label='.urlencode($search_label);
if ($search_number != '') $param .= '&search_number='.urlencode($search_number);
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
if ($show_files) $param .= '&show_files='.urlencode($show_files);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -380,7 +377,7 @@ if (!empty($arrayfields['b.clos']['checked']))
'opened'=>$langs->trans("Opened"),
'closed'=>$langs->trans("Closed")
);
print $form->selectarray("search_status", $array, $search_status, 1);
print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '</td>';
}
// Balance
@ -419,7 +416,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
print "</tr>\n";
$total = array(); $found = 0; $i = 0; $lastcurrencycode = '';
$totalarray = array(); $found = 0; $i = 0; $lastcurrencycode = '';
foreach ($accounts as $key=>$type)
{

View File

@ -390,7 +390,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>';
}

View File

@ -1056,7 +1056,7 @@ if ($resql)
{
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '1,2'=>$langs->trans("BillShortStatusNotPaid").'+'.$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '</td>';
}
// Action column

View File

@ -322,7 +322,7 @@ if (!empty($arrayfields['cs.amount']['checked'])) {
if (!empty($arrayfields['cs.paye']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print '</td>';
}

View File

@ -3893,6 +3893,7 @@ class Form
$i++;
}
print "</select>";
print ajax_combobox('select'.$htmlname);
} else {
if ($status == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
else print '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
@ -7109,9 +7110,10 @@ class Form
* @param int $option 0 return yes/no, 1 return 1/0
* @param bool $disabled true or false
* @param int $useempty 1=Add empty line
* @param int $addjscombo 1=Add js beautifier on combo box
* @return string See option
*/
public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0)
public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0, $addjscombo = 0)
{
global $langs;
@ -7136,6 +7138,11 @@ class Form
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
}
$resultyesno .= '</select>'."\n";
if ($addjscombo) {
$resultyesno .= ajax_combobox($htmlname);
}
return $resultyesno;
}

View File

@ -65,7 +65,7 @@ class FormExpenseReport
$tmpep = new ExpenseReport($this->db);
print '<select class="flat" name="'.$htmlname.'">';
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($useempty) print '<option value="-1">&nbsp;</option>';
$arrayoflabels = $tmpep->statuts;
if ($useshortlabel) $arrayoflabels = $tmpep->statuts_short;
@ -81,6 +81,7 @@ class FormExpenseReport
print '</option>';
}
print '</select>';
print ajax_combobox($htmlname);
}
/**

View File

@ -62,7 +62,7 @@ class FormOrder extends Form
$options[$value] = $tmpsupplierorder->getLibStatut($short);
}
print Form::selectarray($hmlname, $options, $selected, 1);
print Form::selectarray($hmlname, $options, $selected, 1, 0, 0, '', 0, 0, 0, '', '', 1);
}
/**

View File

@ -102,7 +102,7 @@ class FormPropal
}
}
print '<select class="flat" name="'.$htmlname.'">';
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) print '<option value="-1">&nbsp;</option>';
foreach ($listofstatus as $key => $obj)
@ -135,5 +135,7 @@ class FormPropal
$i++;
}
print '</select>';
print ajax_combobox($htmlname);
}
}

View File

@ -977,7 +977,7 @@ if ($resql)
if (!empty($arrayfields['cf.billed']['checked']))
{
print '<td class="liste_titre center">';
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
print '</td>';
}
// Action column

View File

@ -859,7 +859,7 @@ if ($resql)
{
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '</td>';
}
// Action column

View File

@ -444,7 +444,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -92,7 +92,7 @@ $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alph
$search = array();
foreach ($object->fields as $key => $val)
{
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
}
// List of fields to search into when doing a "search in all"
@ -392,7 +392,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -595,7 +595,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="liste_titre center">';
//print '<input class="flat" type="text" size="3" name="search_type_mouvement" value="'.dol_escape_htmltag($search_type_mouvement).'">';
print '<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
print '<option value="" '.(($search_type_mouvement == "") ? 'selected="selected"' : '').'></option>';
print '<option value="" '.(($search_type_mouvement == "") ? 'selected="selected"' : '').'>&nbsp;</option>';
print '<option value="0" '.(($search_type_mouvement == "0") ? 'selected="selected"' : '').'>'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</option>';
print '<option value="1" '.(($search_type_mouvement == "1") ? 'selected="selected"' : '').'>'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</option>';
print '<option value="2" '.(($search_type_mouvement == "2") ? 'selected="selected"' : '').'>'.$langs->trans('StockDecrease').'</option>';

View File

@ -674,7 +674,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($object->table_element_line))
{
// Show object lines
//$result = $object->getLinesArray();
$object->fetchLines();
print '<div class="fichecenter">';
@ -721,6 +720,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</tr>';
}
// Lines to consume
if (!empty($object->lines))
{
$nblinetoconsume = 0;
@ -745,7 +746,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
print '<tr>';
print '<td>'.$tmpproduct->getNomUrl(1).'</td>';
print '<td>'.$tmpproduct->getNomUrl(1);
print '<br><span class="opacitymedium small">'.$tmpproduct->label.'</span>';
print '</td>';
print '<td class="right nowraponall">';
$help = '';
if ($line->qty_frozen) $help .= ($help ? '<br>' : '').'<strong>'.$langs->trans("QuantityFrozen").'</strong>: '.yn(1).' ('.$langs->trans("QuantityConsumedInvariable").')';
@ -850,6 +853,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>';
print '</div>';
// Lines to produce
print '</div>';
print '<div class="fichehalfright">';
print '<div class="clearboth"></div>';
@ -906,7 +911,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyproduced.'">';
print '<tr>';
print '<td>'.$tmpproduct->getNomUrl(1).'</td>';
print '<td>'.$tmpproduct->getNomUrl(1);
print '<br><span class="opacitymedium small">'.$tmpproduct->label.'</span>';
print '</td>';
print '<td class="right">'.$line->qty.'</td>';
print '<td class="right nowraponall">';
if ($alreadyproduced) {

View File

@ -371,7 +371,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -419,7 +419,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0 || strpos($val['type'], 'sellist:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -377,7 +377,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -109,7 +109,7 @@ if ($search_status == '') $search_status = -1; // -1 or 1
if (!empty($conf->categorie->enabled))
{
$search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_array", "array");
$search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array");
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@ -433,7 +433,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -433,7 +433,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -76,8 +76,7 @@ $stripeacc = $stripe->getStripeAccount($service);
print $langs->trans('ErrorStripeAccountNotDefined');
}*/
if (!$rowid)
{
if (!$rowid) {
$option = array('limit' => $limit + 1);
$num = 0;
@ -102,185 +101,185 @@ if (!$rowid)
//$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id;
$moreforfilter = '';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
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.'">';
$title = $langs->trans("StripeChargeList");
$title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', 'hidepaginationprevious', $limit);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("StripeCustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
print "</tr>\n";
//print $list;
$i = 0;
foreach ($list->data as $charge)
{
if ($i >= $limit) {
break;
}
if ($charge->refunded == '1') {
$status = img_picto($langs->trans("refunded"), 'statut6');
} elseif ($charge->paid == '1') {
$status = img_picto($langs->trans((string) $charge->status), 'statut4');
} else {
$label = $langs->trans("Message").": ".$charge->failure_message."<br>";
$label .= $langs->trans("Network").": ".$charge->outcome->network_status."<br>";
$label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message);
$status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1);
}
if ($charge->payment_method_details->type == 'card') {
$type = $langs->trans("card");
} elseif ($charge->source->type == 'card') {
$type = $langs->trans("card");
} elseif ($charge->payment_method_details->type == 'three_d_secure') {
$type = $langs->trans("card3DS");
} elseif ($charge->payment_method_details->type == 'sepa_debit') {
$type = $langs->trans("sepadebit");
} elseif ($charge->payment_method_details->type == 'ideal') {
$type = $langs->trans("iDEAL");
}
// Why this ?
/*if (! empty($charge->payment_intent)) {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
} else {
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
}
}*/
// The metadata FULLTAG is defined by the online payment page
$FULLTAG = $charge->metadata->FULLTAG;
// Save into $tmparray all metadata
$tmparray = dolExplodeIntoArray($FULLTAG, '.', '=');
// Load origin object according to metadata
if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0)
{
$societestatic->fetch($tmparray['CUS']);
} elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0)
{
$societestatic->fetch($charge->metadata->dol_thirdparty_id);
} else {
$societestatic->id = 0;
}
if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0)
{
$memberstatic->fetch($tmparray['MEM']);
} else {
$memberstatic->id = 0;
}
print '<tr class="oddeven">';
if (!empty($stripeacc)) $connect = $stripeacc.'/';
// Ref
$url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id;
if ($servicestatus)
{
$url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
}
print "<td>";
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
if ($charge->payment_intent) print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
print "</td>\n";
// Stripe customer
print "<td>";
if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.'/';
$url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;
if ($servicestatus)
{
$url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer;
}
if (!empty($charge->customer))
{
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
}
print "</td>\n";
// Link
print "<td>";
if ($societestatic->id > 0)
{
print $societestatic->getNomUrl(1);
} elseif ($memberstatic->id > 0)
{
print $memberstatic->getNomUrl(1);
}
print "</td>\n";
// Origin
print "<td>";
if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") {
$object = new Commande($db);
$object->fetch($charge->metadata->dol_id);
if ($object->id > 0) {
print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'object_order')." ".$object->ref."</a>";
} else {
print $FULLTAG;
}
} elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") {
print $charge->metadata->dol_type.' '.$charge->metadata->dol_id.' - ';
$object = new Facture($db);
$object->fetch($charge->metadata->dol_id);
if ($object->id > 0) {
print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</a>";
} else {
print $FULLTAG;
}
} else {
print $FULLTAG;
}
print "</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."</td>\n";
// Type
print '<td>';
print $type;
print '</td>';
// Amount
print '<td class="right">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</td>";
// Status
print '<td class="right">';
print $status;
print "</td>\n";
print "</tr>\n";
$i++;
}
print '</table>';
print '</div>';
print '</form>';
} catch (Exception $e) {
print $e->getMessage();
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
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.'">';
$title = $langs->trans("StripeChargeList");
$title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', 'hidepaginationprevious', $limit);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("StripeCustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
print "</tr>\n";
//print $list;
$i = 0;
foreach ($list->data as $charge)
{
if ($i >= $limit) {
break;
}
if ($charge->refunded == '1') {
$status = img_picto($langs->trans("refunded"), 'statut6');
} elseif ($charge->paid == '1') {
$status = img_picto($langs->trans((string) $charge->status), 'statut4');
} else {
$label = $langs->trans("Message").": ".$charge->failure_message."<br>";
$label .= $langs->trans("Network").": ".$charge->outcome->network_status."<br>";
$label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message);
$status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1);
}
if ($charge->payment_method_details->type == 'card') {
$type = $langs->trans("card");
} elseif ($charge->source->type == 'card') {
$type = $langs->trans("card");
} elseif ($charge->payment_method_details->type == 'three_d_secure') {
$type = $langs->trans("card3DS");
} elseif ($charge->payment_method_details->type == 'sepa_debit') {
$type = $langs->trans("sepadebit");
} elseif ($charge->payment_method_details->type == 'ideal') {
$type = $langs->trans("iDEAL");
}
// Why this ?
/*if (! empty($charge->payment_intent)) {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
} else {
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
}
}*/
// The metadata FULLTAG is defined by the online payment page
$FULLTAG = $charge->metadata->FULLTAG;
// Save into $tmparray all metadata
$tmparray = dolExplodeIntoArray($FULLTAG, '.', '=');
// Load origin object according to metadata
if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0)
{
$societestatic->fetch($tmparray['CUS']);
} elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0)
{
$societestatic->fetch($charge->metadata->dol_thirdparty_id);
} else {
$societestatic->id = 0;
}
if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0)
{
$memberstatic->fetch($tmparray['MEM']);
} else {
$memberstatic->id = 0;
}
print '<tr class="oddeven">';
if (!empty($stripeacc)) $connect = $stripeacc.'/';
// Ref
$url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id;
if ($servicestatus)
{
$url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
}
print "<td>";
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
if ($charge->payment_intent) print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
print "</td>\n";
// Stripe customer
print "<td>";
if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.'/';
$url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;
if ($servicestatus)
{
$url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer;
}
if (!empty($charge->customer))
{
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
}
print "</td>\n";
// Link
print "<td>";
if ($societestatic->id > 0)
{
print $societestatic->getNomUrl(1);
} elseif ($memberstatic->id > 0)
{
print $memberstatic->getNomUrl(1);
}
print "</td>\n";
// Origin
print "<td>";
if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") {
$object = new Commande($db);
$object->fetch($charge->metadata->dol_id);
if ($object->id > 0) {
print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'object_order')." ".$object->ref."</a>";
} else {
print $FULLTAG;
}
} elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") {
print $charge->metadata->dol_type.' '.$charge->metadata->dol_id.' - ';
$object = new Facture($db);
$object->fetch($charge->metadata->dol_id);
if ($object->id > 0) {
print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</a>";
} else {
print $FULLTAG;
}
} else {
print $FULLTAG;
}
print "</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."</td>\n";
// Type
print '<td>';
print $type;
print '</td>';
// Amount
print '<td class="right">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</td>";
// Status
print '<td class="right">';
print $status;
print "</td>\n";
print "</tr>\n";
$i++;
}
print '</table>';
print '</div>';
print '</form>';
}
// End of page

View File

@ -77,8 +77,7 @@ $stripeacc = $stripe->getStripeAccount($service);
if (!$rowid) {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '')
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
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">';
@ -106,8 +105,6 @@ if (!$rowid) {
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
print "</tr>\n";
print "</tr>\n";
try {
if ($stripeacc)
{

View File

@ -257,7 +257,7 @@ class Ticket extends CommonObject
'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'),
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),

View File

@ -663,7 +663,7 @@ foreach ($object->fields as $key => $val)
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
} else {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';