';
print ' | '.$langs->trans('Date').' | ';
print ' ';
- print $form->selectDate($dateinput, 'dateinput');
+ print $form->selectDate($dateinput, 'dateinput', 0, 0, 1);
print ' | ';
print ' '.$langs->trans('Currency').' | ';
- print ''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 0, " code != '".$conf->currency."'", true).' | ';
+ print ''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 1, " code != '".$conf->currency."'", true).' | ';
print ' '.$langs->trans('Rate').' | ';
- print ' | ';
+ print ' | ';
print '';
print '';
@@ -288,54 +280,7 @@ if ($action != "updateRate") {
print ' ';
}
-if ($action == "updateRate") {
- $current_rate = new CurrencyRate($db);
- $current_rate->fetch(intval($id_rate_selected));
- if ($current_rate) {
- $curr = new MultiCurrency($db);
- $resultcurrentCurrency = $curr->fetch($current_rate->fk_multicurrency);
-
- if ($resultcurrentCurrency) {
- $currency_code = $curr->code;
- } else {
- $currency_code = '';
- }
-
- print '';
- print '';
- print '| '.$langs->trans("FormUpdateRate").' | '."\n";
- print ' ';
-
- $form = new Form($db);
- print '';
- } else {
- dol_syslog("currency_rate:list:update", LOG_WARNING);
- }
-}
$sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name ';
@@ -345,18 +290,14 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr ';
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid";
-if ($sall) {
- $sql .= natural_search(array_keys($fieldstosearchall), $sall);
-}
-if ($search_date_sync) {
- $sql .= natural_search('cr.date_sync', $search_date_sync);
-}
-if ($search_rate) {
- $sql .= natural_search('cr.rate', $search_rate);
-}
-if ($search_code) {
- $sql .= natural_search('m.code', $search_code);
+if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
+if ($search_date_sync && $search_date_sync_end ) {
+ $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')";
+} elseif ($search_date_sync && !$search_date_sync_end) {
+ $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync));
}
+if ($search_rate) $sql .= natural_search('cr.rate', $search_rate);
+if ($search_code) $sql .= natural_search('m.code', $search_code);
$sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'";
// Add where from hooks
@@ -406,15 +347,10 @@ if ($resql) {
$param .= "&sall=".urlencode($sall);
}
- if ($search_date_sync) {
- $param = "&search_date_sync=".urlencode($search_date_sync);
- }
- if ($search_rate) {
- $param = "&search_rate=".urlencode($search_rate);
- }
- if ($search_code != '') {
- $param .= "&search_code=".urlencode($search_code);
- }
+ if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync;
+ if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end;
+ if ($search_rate) $param = "&search_rate=".urlencode($search_rate);
+ if ($search_code != '') $param.="&search_code=".urlencode($search_code);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -475,29 +411,30 @@ if ($resql) {
}
print '';
- print ' '."\n";
+ print ''."\n";
// Lines with input filters
print '';
// date
- if (!empty($arrayfields['cr.date_sync']['checked'])) {
- print '| ';
- print '';
- print ' | ';
- }
+if (!empty($arrayfields['cr.date_sync']['checked'])) {
+ print '';
+ print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1);
+ print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1);
+ print ' | ';
+}
// code
- if (!empty($arrayfields['m.code']['checked'])) {
- print '';
- print '';
- print ' | ';
- }
+if (!empty($arrayfields['m.code']['checked'])) {
+ print '';
+ print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true);
+ print ' | ';
+}
// rate
- if (!empty($arrayfields['cr.rate']['checked'])) {
- print '';
- print '';
- print ' | ';
- }
+if (!empty($arrayfields['cr.rate']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -532,45 +469,54 @@ if ($resql) {
$i = 0;
$totalarray = array();
- while ($i < min($num, $limit)) {
- $obj = $db->fetch_object($resql);
+while ($i < min($num, $limit)) {
+ $obj = $db->fetch_object($resql);
- print ' ';
+ print ' ';
+ // USER REQUEST UPDATE FOR THIS LINE
+ if ($action == "updateRate" && $obj->rowid == $id_rate_selected) {
+ // var_dump($obj);
+ print ' | ';
+ print '' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ' | ';
+ print ' | ';
+
+ print '';
+ print '';
+ print '';
+ print '';
+ print '';
+ print ' | ';
+ } else {
// date_sync
if (!empty($arrayfields['cr.date_sync']['checked'])) {
print '';
print $obj->date_sync;
print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
+ if (!$i) $totalarray['nbfield']++;
}
// code
- if (!empty($arrayfields['m.code']['checked'])) {
+ if (! empty($arrayfields['m.code']['checked'])) {
print '';
print $obj->code." ".$obj->name;
print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
+ if (! $i) $totalarray['nbfield']++;
}
// rate
- if (!empty($arrayfields['cr.rate']['checked'])) {
+ if (! empty($arrayfields['cr.rate']['checked'])) {
print '';
print $obj->rate;
print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
+ if (! $i) $totalarray['nbfield']++;
}
+
// Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action
@@ -604,5 +550,5 @@ if ($resql) {
}
-llxFooter();
-$db->close();
+ llxFooter();
+ $db->close();
|