';
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 6499db671cb..6f1e83103d5 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -228,8 +228,8 @@ if (empty($reshook) && $action == 'add')
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
- $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
- $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
+ $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
+ $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
// Check parameters
if (!$datef && $percentage == 100)
@@ -479,8 +479,8 @@ if (empty($reshook) && $action == 'update')
$object->fetch_userassigned();
$object->oldcopy = clone $object;
- $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
- $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
+ $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
+ $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml");
@@ -953,7 +953,7 @@ if ($action == 'create')
// Full day
print '
'.$langs->trans("EventOnFullDay").' ';
- $datep = ($datep ? $datep : $object->datep);
+ $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
@@ -1324,8 +1324,8 @@ if ($id > 0)
{
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
- $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
- $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
+ $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
+ $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml");
@@ -1430,23 +1430,23 @@ if ($id > 0)
// Full day event
print '
'.$langs->trans("EventOnFullDay").' fulldayevent ? ' checked' : '').'>';
-
+ print dol_print_date($object->datep, 'dayhour', 'gmt');
// Date start - end
print '
'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").' ';
if (GETPOST("afaire") == 1) {
- print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart');
+ print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} elseif (GETPOST("afaire") == 2) {
- print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
+ print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} else {
- print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
+ print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
}
print ' - ';
if (GETPOST("afaire") == 1) {
- print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
+ print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} elseif (GETPOST("afaire") == 2) {
- print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
+ print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} else {
- print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
+ print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
}
print ' ';
@@ -1884,16 +1884,16 @@ if ($id > 0)
// Date start
print '
'.$langs->trans("DateActionStart").' ';
- if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour');
- else print dol_print_date($object->datep, 'day');
+ if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour', 'tzuser');
+ else print dol_print_date($object->datep, 'day', 'tzuser');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print ' ';
print '';
// Date end
print '
'.$langs->trans("DateActionEnd").' ';
- if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour');
- else print dol_print_date($object->datef, 'day');
+ if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour', 'tzuser');
+ else print dol_print_date($object->datef, 'day', 'tzuser');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print ' ';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 5a9b0afa336..f7e0ef6acb1 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1222,13 +1222,20 @@ class ActionComm extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
+ if (!$user->rights->agenda->allactions->read) {
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".$user->id;
+ }
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " WHERE 1 = 1";
if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100";
$sql .= " AND a.entity IN (".getEntity('agenda').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid;
- if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")";
+ if (!$user->rights->agenda->allactions->read) {
+ $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id;
+ $sql .= " OR ar.fk_element = ".$user->id; // Added by PV
+ $sql .= ")";
+ }
$resql = $this->db->query($sql);
if ($resql)
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index a2e020fcb24..ed7caa173b1 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -136,9 +136,9 @@ $arrayfields = array(
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
- 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
- 'a.datec'=>array('label'=>'DateCreation', 'checked'=>0),
- 'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
+ 'a.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>510),
+ 'a.tms'=>array('label'=>'DateModification', 'checked'=>0, 'position'=>520),
+ 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@@ -739,7 +739,7 @@ if ($resql)
// Start date
if (!empty($arrayfields['a.datep']['checked'])) {
print '
';
- print dol_print_date($db->jdate($obj->dp), $formatToUse);
+ print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
$late = 0;
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
@@ -752,7 +752,7 @@ if ($resql)
// End date
if (!empty($arrayfields['a.datep2']['checked'])) {
print ' ';
- print dol_print_date($db->jdate($obj->dp2), $formatToUse);
+ print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
print ' ';
}
@@ -837,11 +837,11 @@ if ($resql)
// Date creation
if (!empty($arrayfields['a.datec']['checked'])) {
// Status/Percent
- print '
'.dol_print_date($db->jdate($obj->datec), 'dayhour').' ';
+ print '
'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').' ';
}
// Date update
if (!empty($arrayfields['a.tms']['checked'])) {
- print '
'.dol_print_date($db->jdate($obj->datem), 'dayhour').' ';
+ print '
'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').' ';
}
if (!empty($arrayfields['a.percent']['checked'])) {
// Status/Percent
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 384b88655f6..89ca2513ab2 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -161,10 +161,18 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
if ($num > 0) {
$i = 0;
+ $othernb = 0;
- while ($i < $nbofloop) {
+ while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql);
+ if ($i >= $max) {
+ $othernb += 1;
+ $i++;
+ $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
+ continue;
+ }
+
$propalstatic->id = $obj->rowid;
$propalstatic->ref = $obj->ref;
$propalstatic->ref_client = $obj->ref_client;
@@ -196,6 +204,15 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
}
+
+ if ($othernb) {
+ print '
';
+ print '';
+ print ''.$langs->trans("More").'... ('.$othernb.') ';
+ print ' ';
+ print " \n";
+ }
+
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@@ -236,10 +253,18 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
if ($num > 0) {
$i = 0;
+ $othernb = 0;
- while ($i < $nbofloop) {
+ while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql);
+ if ($i >= $max) {
+ $othernb += 1;
+ $i++;
+ $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
+ continue;
+ }
+
$supplierproposalstatic->id = $obj->rowid;
$supplierproposalstatic->ref = $obj->ref;
$supplierproposalstatic->total_ht = $obj->total_ht;
@@ -270,6 +295,15 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
}
+
+ if ($othernb) {
+ print '
';
+ print '';
+ print ''.$langs->trans("More").'... ('.$othernb.') ';
+ print ' ';
+ print " \n";
+ }
+
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@@ -310,10 +344,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
if ($num > 0) {
$i = 0;
+ $othernb = 0;
- while ($i < $nbofloop) {
+ while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql);
+ if ($i >= $max) {
+ $othernb += 1;
+ $i++;
+ $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
+ continue;
+ }
+
$orderstatic->id = $obj->rowid;
$orderstatic->ref = $obj->ref;
$orderstatic->ref_client = $obj->ref_client;
@@ -345,6 +387,15 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
}
+
+ if ($othernb) {
+ print '
';
+ print '';
+ print ''.$langs->trans("More").'... ('.$othernb.') ';
+ print ' ';
+ print " \n";
+ }
+
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@@ -385,10 +436,18 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
if ($num > 0) {
$i = 0;
+ $othernb = 0;
- while ($i < $nbofloop) {
+ while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql);
+ if ($i >= $max) {
+ $othernb += 1;
+ $i++;
+ $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
+ continue;
+ }
+
$supplierorderstatic->id = $obj->rowid;
$supplierorderstatic->ref = $obj->ref;
$supplierorderstatic->ref_supplier = $obj->ref_suppliert;
@@ -420,6 +479,15 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
}
+
+ if ($othernb) {
+ print '
';
+ print '';
+ print ''.$langs->trans("More").'... ('.$othernb.') ';
+ print ' ';
+ print " \n";
+ }
+
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 8b5054afd7f..e823ec95cdc 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -354,8 +354,8 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
- $object->remise_percent = GETPOST('remise_percent');
- $object->remise_absolue = GETPOST('remise_absolue');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
+ $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int');
@@ -812,7 +812,7 @@ if (empty($reshook))
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
- $remise_percent = GETPOST('remise_percent'.$predef);
+ $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
if (empty($remise_percent)) $remise_percent = 0;
// Extrafields
@@ -1210,7 +1210,7 @@ if (empty($reshook))
$price_min = $product->multiprices_min [$object->thirdparty->price_level];
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
- if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) {
+ if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@@ -1243,7 +1243,7 @@ if (empty($reshook))
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
- $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise);
+ $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
if ($result >= 0) {
$db->commit();
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 07ff1c64dbb..e7af582d121 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -291,7 +291,7 @@ $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'
//llxHeader('',$langs->trans('Proposal'),$help_url);
$sql = 'SELECT';
-if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
+if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,";
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 287150e6ca2..1d2f12132e5 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -607,9 +607,9 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'setremisepercent' && $usercancreate) {
- $result = $object->set_remise($user, GETPOST('remise_percent'));
+ $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
- $result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
+ $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
@@ -640,7 +640,7 @@ if (empty($reshook))
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
- $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0);
+ $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -1032,7 +1032,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
- if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) {
+ if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@@ -1060,7 +1060,7 @@ if (empty($reshook))
}
}
}
- $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
+ $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 1531dfd622e..7cbff15f1da 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -282,7 +282,7 @@ $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_P
// llxHeader('',$title,$help_url);
$sql = 'SELECT';
-if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
+if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 35d70e1edd6..01ce7cc1abd 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -451,7 +451,7 @@ if (empty($reshook))
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
- $remise_percent = GETPOST('remise_percent'.$predef);
+ $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -801,7 +801,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
- if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))))
+ if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent', 2)) / 100) < price2num($price_min))))
{
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
@@ -837,7 +837,7 @@ if (empty($reshook))
$localtax1_rate,
$localtax1_rate,
GETPOST('productid'),
- GETPOST('remise_percent'),
+ price2num(GETPOST('remise_percent'), 2),
'HT',
$info_bits,
0,
@@ -923,7 +923,8 @@ if (empty($reshook))
* View
*/
-llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec');
+$help_url = '';
+llxHeader('', $langs->trans("RepeatableInvoices"), $help_url);
$form = new Form($db);
$formother = new FormOther($db);
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 16a472d878c..c0a9a15739a 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -476,19 +476,15 @@ if (empty($reshook))
}
}
} // Set incoterm
- elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
- {
+ elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} // bank account
- elseif ($action == 'setbankaccount' && $usercancreate)
- {
+ elseif ($action == 'setbankaccount' && $usercancreate) {
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
- } elseif ($action == 'setremisepercent' && $usercancreate)
- {
+ } elseif ($action == 'setremisepercent' && $usercancreate) {
$object->fetch($id);
- $result = $object->set_remise($user, $_POST['remise_percent']);
- } elseif ($action == "setabsolutediscount" && $usercancreate)
- {
+ $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
+ } elseif ($action == "setabsolutediscount" && $usercancreate) {
// POST[remise_id] or POST[remise_id_for_payment]
// We use the credit to reduce amount of invoice
@@ -981,7 +977,7 @@ if (empty($reshook))
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -993,26 +989,25 @@ if (empty($reshook))
$action = 'create';
}
- $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
+ $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) {
// This is a replacement invoice
- $result = $object->fetch($_POST['fac_replacement']);
+ $result = $object->fetch(GETPOST('fac_replacement', 'int'));
$object->fetch_thirdparty();
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
// We do not copy the private note
- $object->ref_client = $_POST['ref_client'];
- $object->ref_int = $_POST['ref_int'];
- $object->model_pdf = $_POST['model'];
- $object->fk_project = $_POST['projectid'];
- $object->cond_reglement_id = $_POST['cond_reglement_id'];
- $object->mode_reglement_id = $_POST['mode_reglement_id'];
+ $object->ref_client = GETPOST('ref_client', 'alphanohtml');
+ $object->model_pdf = GETPOST('model', 'alphanohtml');
+ $object->fk_project = GETPOST('projectid', 'int');
+ $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
+ $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
- $object->remise_absolue = $_POST['remise_absolue'];
- $object->remise_percent = $_POST['remise_percent'];
+ $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@@ -1045,7 +1040,7 @@ if (empty($reshook))
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -1067,11 +1062,11 @@ if (empty($reshook))
$object->ref_client = GETPOST('ref_client');
$object->model_pdf = GETPOST('model');
$object->fk_project = GETPOST('projectid', 'int');
- $object->cond_reglement_id = 0;
- $object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $object->cond_reglement_id = 0; // No payment term for a credit note
+ $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
- $object->remise_absolue = GETPOST('remise_absolue');
- $object->remise_percent = GETPOST('remise_percent');
+ $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@@ -1265,7 +1260,7 @@ if (empty($reshook))
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -1289,8 +1284,8 @@ if (empty($reshook))
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount'));
- $object->remise_absolue = GETPOST('remise_absolue');
- $object->remise_percent = GETPOST('remise_percent');
+ $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@@ -1318,7 +1313,7 @@ if (empty($reshook))
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -1343,8 +1338,8 @@ if (empty($reshook))
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount'));
- $object->remise_absolue = GETPOST('remise_absolue');
- $object->remise_percent = GETPOST('remise_percent');
+ $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@@ -1742,7 +1737,7 @@ if (empty($reshook))
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors');
- } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -1837,8 +1832,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
- $object->remise_absolue = GETPOST('remise_absolue', 'int');
- $object->remise_percent = GETPOST('remise_percent', 'int');
+ $object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
// Proprietes particulieres a facture de remplacement
@@ -1923,8 +1918,8 @@ if (empty($reshook))
$tva_tx = '';
}
- $qty = GETPOST('qty'.$predef);
- $remise_percent = GETPOST('remise_percent'.$predef);
+ $qty = price2num(GETPOST('qty'.$predef), 'MS');
+ $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -2314,7 +2309,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
- if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) {
+ if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@@ -2367,7 +2362,7 @@ if (empty($reshook))
}
}
- $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent', 'alpha')),
+ $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2),
$date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type,
GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, price2num(GETPOST('progress', 'alpha')),
GETPOST('units', 'alpha'), $pu_ht_devise);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index da5bab5b47e..0a7732bf21c 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -416,7 +416,7 @@ $formcompany = new FormCompany($db);
$thirdpartystatic = new Societe($db);
$sql = 'SELECT';
-if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
+if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql .= ' f.fk_user_author,';
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 1d4d1a37354..5f5da8f83d9 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -193,11 +193,19 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$companystatic = new Societe($db);
$i = 0;
+ $othernb = 0;
$tot_ttc = 0;
- while ($i < $num)
+ while ($i < $num && $i < $conf->liste_limit)
{
$obj = $db->fetch_object($resql);
+ if ($i >= $max) {
+ $othernb += 1;
+ $i++;
+ $tot_ttc += $obj->total_ttc;
+ continue;
+ }
+
$tmpinvoice->id = $obj->rowid;
$tmpinvoice->ref = $obj->ref;
$tmpinvoice->date = $db->jdate($obj->date);
@@ -232,6 +240,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$i++;
}
+ if ($othernb) {
+ print '
';
+ print '';
+ print ''.$langs->trans("More").'... ('.$othernb.') ';
+ print ' ';
+ print " \n";
+ }
+
print '
'.$langs->trans("Total").' ';
print ''.price($tot_ttc).' ';
print '';
@@ -290,11 +306,19 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic = new Societe($db);
$i = 0;
+ $othernb = 0;
$tot_ttc = 0;
- while ($i < $num)
+ while ($i < $num && $i < $conf->liste_limit)
{
$obj = $db->fetch_object($resql);
+ if ($i >= $max) {
+ $othernb += 1;
+ $i++;
+ $tot_ttc += $obj->total_ttc;
+ continue;
+ }
+
$facturesupplierstatic->ref = $obj->ref;
$facturesupplierstatic->id = $obj->rowid;
$facturesupplierstatic->total_ht = $obj->total_ht;
@@ -328,6 +352,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++;
}
+ if ($othernb) {
+ print '
';
+ print '';
+ print ''.$langs->trans("More").'... ('.$othernb.') ';
+ print ' ';
+ print " \n";
+ }
+
print '
'.$langs->trans("Total").' ';
print ''.price($tot_ttc).' ';
print '';
diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php
index ceace76bba9..c5ec3b24968 100644
--- a/htdocs/compta/sociales/class/cchargesociales.class.php
+++ b/htdocs/compta/sociales/class/cchargesociales.class.php
@@ -46,9 +46,15 @@ class Cchargesociales
/**
* @var string Label
+ * @deprecated
*/
public $libelle;
+ /**
+ * @var string Label
+ */
+ public $label;
+
public $deductible;
public $active;
public $code;
@@ -107,7 +113,6 @@ class Cchargesociales
// Insert request
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
-
$sql .= 'libelle,';
$sql .= 'deductible,';
$sql .= 'active,';
@@ -115,10 +120,7 @@ class Cchargesociales
$sql .= 'fk_pays,';
$sql .= 'module';
$sql .= 'accountancy_code';
-
-
$sql .= ') VALUES (';
-
$sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").',';
$sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).',';
$sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).',';
@@ -126,8 +128,6 @@ class Cchargesociales
$sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).',';
$sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").',';
$sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'");
-
-
$sql .= ')';
$this->db->begin();
@@ -179,7 +179,7 @@ class Cchargesociales
$sql = 'SELECT';
$sql .= " t.id,";
- $sql .= " t.libelle,";
+ $sql .= " t.libelle as label,";
$sql .= " t.deductible,";
$sql .= " t.active,";
$sql .= " t.code,";
@@ -201,7 +201,8 @@ class Cchargesociales
$this->id = $obj->id;
- $this->libelle = $obj->libelle;
+ $this->libelle = $obj->label;
+ $this->label = $obj->label;
$this->deductible = $obj->deductible;
$this->active = $obj->active;
$this->code = $obj->code;
@@ -501,6 +502,7 @@ class Cchargesociales
$this->id = 0;
$this->libelle = '';
+ $this->label = '';
$this->deductible = '';
$this->active = '';
$this->code = '';
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 95e4bd1df77..34f58969a46 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -108,6 +108,11 @@ class ChargeSociales extends CommonObject
*/
public $fk_project;
+ /**
+ * @var int ID
+ */
+ public $fk_user;
+
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
@@ -135,7 +140,7 @@ class ChargeSociales extends CommonObject
$sql = "SELECT cs.rowid, cs.date_ech";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
$sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user";
- $sql .= ", c.libelle";
+ $sql .= ", c.libelle as type_label";
$sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
@@ -158,7 +163,7 @@ class ChargeSociales extends CommonObject
$this->lib = $obj->label;
$this->label = $obj->label;
$this->type = $obj->fk_type;
- $this->type_label = $obj->libelle;
+ $this->type_label = $obj->type_label;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index 2f4f772fca0..78cf7e1c22f 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -46,6 +46,11 @@ class PaymentSocialContribution extends CommonObject
*/
public $picto = 'payment';
+ /**
+ * @var string Label
+ */
+ public $label;
+
/**
* @var int ID
*/
@@ -679,7 +684,7 @@ class PaymentSocialContribution extends CommonObject
$result = '';
- if (empty($this->ref)) $this->ref = $this->lib;
+ if (empty($this->ref)) $this->ref = $this->label;
$label = img_picto('', $this->picto).'
'.$langs->trans("SocialContributionPayment").' ';
$label .= '
'.$langs->trans('Ref').': '.$this->ref;
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index a8a71e3e254..ce65dde989b 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -149,7 +149,7 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user, ";
-$sql .= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
+$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " c.libelle as type_label,";
$sql .= " SUM(pc.amount) as alreadypayed";
@@ -381,7 +381,7 @@ while ($i < min($num, $limit))
$chargesociale_static->id = $obj->rowid;
$chargesociale_static->ref = $obj->rowid;
- $chargesociale_static->label = $obj->libelle;
+ $chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label;
if (!empty($conf->projet->enabled)) {
$projectstatic->id = $obj->project_id;
@@ -405,7 +405,7 @@ while ($i < min($num, $limit))
// Label
if (!empty($arrayfields['cs.libelle']['checked'])) {
- print '
'.dol_trunc($obj->libelle, 42).' ';
+ print '
'.dol_trunc($obj->label, 42).' ';
if (!$i) $totalarray['nbfield']++;
}
diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index 0be6659f7b4..03c128e841f 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -44,12 +44,12 @@ $nbofyear = 4;
$year = GETPOST('year', 'int');
if (empty($year))
{
- $year_current = strftime("%Y", dol_now());
- $month_current = strftime("%m", dol_now());
+ $year_current = dol_print_date(dol_now(), "%Y");
+ $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
- $month_current = strftime("%m", dol_now());
+ $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1);
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@@ -58,12 +58,12 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
- $q = GETPOST("q") ?GETPOST("q") : 0;
+ $q = GETPOST("q") ? GETPOST("q") : 0;
if ($q == 0)
{
// We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1);
- $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
+ $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if (!GETPOST('month'))
{
if (!GETPOST("year") && $month_start > $month_current)
@@ -86,8 +86,10 @@ $userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
$tmps = dol_getdate($date_start);
+$mothn_start = $tmps['mon'];
$year_start = $tmps['year'];
$tmpe = dol_getdate($date_end);
+$month_end = $tmpe['mon'];
$year_end = $tmpe['year'];
$nbofyear = ($year_end - $year_start) + 1;
@@ -306,7 +308,7 @@ $now = dol_now();
$casenow = dol_print_date($now, "%Y-%m");
// Loop on each month
-$nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START - 1) : 0;
+$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1));
for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
{
$mois_modulo = $mois; // ajout
@@ -338,68 +340,75 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
{
if ($modecompta == 'CREANCES-DETTES') {
- // Valeur CA du mois w/o VAT
+ // Value turnover of month w/o VAT
print '
';
- if ($cum_ht[$case])
- {
- $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
- print ''.price($cum_ht[$case], 1).' ';
- } else {
- if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
+ if ($cum_ht[$case]) {
+ $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
+ print ''.price($cum_ht[$case], 1).' ';
+ } else {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ }
}
print " ";
}
- // Valeur CA du mois
+ // Value turnover of month
print '
';
- if ($cum[$case])
- {
- $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
- if ($modecompta != 'BOOKKEEPING') print '';
- print price($cum[$case], 1);
- if ($modecompta != 'BOOKKEEPING') print ' ';
- } else {
- if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
+ if ($cum[$case]) {
+ $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
+ if ($modecompta != 'BOOKKEEPING') print '';
+ print price($cum[$case], 1);
+ if ($modecompta != 'BOOKKEEPING') print ' ';
+ } else {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ }
}
print " ";
- // Pourcentage du mois
- if ($annee_decalage > $minyear && $case <= $casenow)
- {
- if ($cum[$caseprev] && $cum[$case])
+ // Percentage of month
+ print '
';
+ //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
+ if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
+ if ($annee_decalage > $minyear && $case <= $casenow)
{
- $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
- //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
- print ' '.($percent >= 0 ? "+$percent" : "$percent").'% ';
+ if ($cum[$caseprev] && $cum[$case])
+ {
+ $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
+ //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
+ print ($percent >= 0 ? "+$percent" : "$percent").'%';
+ }
+ if ($cum[$caseprev] && !$cum[$case])
+ {
+ print '-100%';
+ }
+ if (!$cum[$caseprev] && $cum[$case])
+ {
+ //print '
+Inf% ';
+ print '-';
+ }
+ if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case])
+ {
+ print '+0%';
+ }
+ if (!isset($cum[$caseprev]) && !$cum[$case])
+ {
+ print '-';
+ }
+ } else {
+ if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; }
}
- if ($cum[$caseprev] && !$cum[$case])
- {
- print '
-100% ';
- }
- if (!$cum[$caseprev] && $cum[$case])
- {
- //print '
+Inf% ';
- print '
- ';
- }
- if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case])
- {
- print '
+0% ';
- }
- if (!isset($cum[$caseprev]) && !$cum[$case])
- {
- print '
- ';
- }
- } else {
- print '
';
- if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; }
- print ' ';
}
+ print '';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print '
';
}
- $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
- $total[$annee] += $cum[$case];
+ if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
+ $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
+ $total[$annee] += $cum[$case];
+ }
}
print '';
@@ -470,34 +479,37 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
}
*/
-// Affiche total
+// Show total
print '
'.$langs->trans("Total").' ';
for ($annee = $year_start; $annee <= $year_end; $annee++)
{
if ($modecompta == 'CREANCES-DETTES') {
// Montant total HT
- if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear)))
- {
- print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0")." ";
+ if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
+ print '';
+ print ($total_ht[$annee] ?price($total_ht[$annee]) : "0");
+ print " ";
} else {
print ' ';
}
}
- // Montant total
- if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear)))
- {
- print ''.($total[$annee] ?price($total[$annee]) : "0")." ";
+ // Total amount
+ if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
+ print '';
+ print ($total[$annee] ?price($total[$annee]) : "0");
+ print " ";
} else {
print ' ';
}
// Pourcentage total
- if ($annee > $minyear && $annee <= max($nowyear, $maxyear))
- {
+ if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
if ($total[$annee - 1] && $total[$annee]) {
$percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
- print ''.($percent >= 0 ? "+$percent" : "$percent").'% ';
+ print '';
+ print ($percent >= 0 ? "+$percent" : "$percent").'%';
+ print ' ';
}
if ($total[$annee - 1] && !$total[$annee])
{
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index ca03905b834..8d78b410329 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -213,7 +213,7 @@ if (empty($reshook))
$object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha');
$object->fk_project = GETPOST('projectid', 'int');
- $object->remise_percent = GETPOST('remise_percent', 'alpha');
+ $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->ref = GETPOST('ref', 'alpha');
$object->ref_customer = GETPOST('ref_customer', 'alpha');
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
@@ -396,7 +396,7 @@ if (empty($reshook))
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
- $remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
+ $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
if ($qty == '')
{
@@ -673,10 +673,10 @@ if (empty($reshook))
$objectline->fk_product = GETPOST('idprod', 'int');
$objectline->description = GETPOST('product_desc', 'restricthtml');
- $objectline->price_ht = GETPOST('elprice');
- $objectline->subprice = GETPOST('elprice');
- $objectline->qty = GETPOST('elqty');
- $objectline->remise_percent = GETPOST('elremise_percent');
+ $objectline->price_ht = price2num(GETPOST('elprice'), 'MU');
+ $objectline->subprice = price2num(GETPOST('elprice'), 'MU');
+ $objectline->qty = price2num(GETPOST('elqty'), 'MS');
+ $objectline->remise_percent = price2num(GETPOST('elremise_percent'), 2);
$objectline->tva_tx = ($txtva ? $txtva : 0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code = $vat_src_code;
$objectline->localtax1_tx = is_numeric($localtax1_tx) ? $localtax1_tx : 0;
diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php
index 268a6861524..dbc453eced6 100644
--- a/htdocs/core/boxes/box_last_ticket.php
+++ b/htdocs/core/boxes/box_last_ticket.php
@@ -134,7 +134,7 @@ class box_last_ticket extends ModeleBoxes
$thirdparty->name = $objp->company_name;
$link = $thirdparty->getNomUrl(1);
} else {
- $link = dol_print_email($objp->origin_email);
+ $link = ''.dol_print_email($objp->origin_email).' ';
}
$r = 0;
@@ -149,15 +149,15 @@ class box_last_ticket extends ModeleBoxes
// Subject
$this->info_box_contents[$i][$r] = array(
- 'td' => '',
- 'text' => $objp->subject, // Some event have no ref
+ 'td' => 'class="tdoverflowmax200"',
+ 'text' => ''.$objp->subject.' ', // Some event have no ref
'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id,
);
$r++;
// Customer
$this->info_box_contents[$i][$r] = array(
- 'td' => '',
+ 'td' => 'class="tdoverflowmax100"',
'text' => $link,
'asis' => 1,
);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 712b0b51ef5..47bfab139d1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5428,6 +5428,7 @@ abstract class CommonObject
$mandatorypb = false;
if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb = true;
if ($this->array_options[$key] === '') $mandatorypb = true;
+ if ($attributeType == 'sellist' && $this->array_options[$key] == '0') $mandatorypb = true;
if ($mandatorypb)
{
dol_syslog("Mandatory extra field ".$key." is empty");
@@ -7042,10 +7043,10 @@ abstract class CommonObject
$labeltoshow = $langs->trans($label);
$helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]);
- if ($display_type=='card') {
- $out .= '