mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Merge branch 'develop' into salesrepresentativeinorderandinvoicelist
This commit is contained in:
@@ -418,17 +418,18 @@ $sql = 'SELECT';
|
||||
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 .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, 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,";
|
||||
$sql .= " country.code as country_code,";
|
||||
$sql .= ' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
|
||||
$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
|
||||
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||
$sql .= " u.login,";
|
||||
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method';
|
||||
$sql .= ' ,c.fk_input_reason';
|
||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||
$sql .= ' c.fk_input_reason';
|
||||
if ($search_categ_cus) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
@@ -473,7 +474,7 @@ if ($search_user > 0) {
|
||||
$sql .= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= ' AND s.rowid = '.((int) $socid);
|
||||
@@ -494,7 +495,7 @@ if ($search_billed != '' && $search_billed >= 0) {
|
||||
$sql .= ' AND c.facture = '.((int) $search_billed);
|
||||
}
|
||||
if ($search_status <> '') {
|
||||
if ($search_status < 4 && $search_status > -3) {
|
||||
if ($search_status < 4 && $search_status > -4) {
|
||||
if ($search_status == 1 && empty($conf->expedition->enabled)) {
|
||||
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
|
||||
} else {
|
||||
@@ -513,6 +514,11 @@ if ($search_status <> '') {
|
||||
//$sql.= ' AND c.facture = 0'; // invoice not created
|
||||
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
|
||||
}
|
||||
|
||||
|
||||
if ($search_status == -4) { // "validate and in progress"
|
||||
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_datecloture_start) {
|
||||
@@ -588,7 +594,7 @@ if ($search_multicurrency_montant_ttc != '') {
|
||||
$sql .= natural_search('c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||
}
|
||||
if ($search_login) {
|
||||
$sql .= natural_search("u.login", $search_login);
|
||||
$sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login);
|
||||
}
|
||||
if ($search_project_ref != '') {
|
||||
$sql .= natural_search("p.ref", $search_project_ref);
|
||||
@@ -675,6 +681,9 @@ if ($resql) {
|
||||
if ($search_status == -3) {
|
||||
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
|
||||
}
|
||||
if ($search_status == -4) {
|
||||
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -1239,6 +1248,7 @@ if ($resql) {
|
||||
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||
-4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||
);
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
|
||||
@@ -1379,7 +1389,7 @@ if ($resql) {
|
||||
$generic_product = new Product($db);
|
||||
$userstatic = new User($db);
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@@ -1390,10 +1400,16 @@ if ($resql) {
|
||||
$nbprod = 0;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->name_alias = $obj->alias;
|
||||
$companystatic->client = $obj->client;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->email = $obj->email;
|
||||
$companystatic->phone = $obj->phone;
|
||||
$companystatic->address = $obj->address;
|
||||
$companystatic->zip = $obj->zip;
|
||||
$companystatic->town = $obj->town;
|
||||
$companystatic->country_code = $obj->country_code;
|
||||
if (!isset($getNomUrl_cache[$obj->socid])) {
|
||||
$getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer');
|
||||
}
|
||||
@@ -1490,7 +1506,7 @@ if ($resql) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Town
|
||||
// Alias name
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->alias;
|
||||
@@ -1565,7 +1581,7 @@ if ($resql) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
//Shipping Method
|
||||
// Shipping Method
|
||||
if (!empty($arrayfields['c.fk_shipping_method']['checked'])) {
|
||||
print '<td>';
|
||||
$form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
|
||||
@@ -1610,7 +1626,11 @@ if ($resql) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht';
|
||||
}
|
||||
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
||||
if (isset($totalarray['val']['c.total_ht'])) {
|
||||
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
||||
} else {
|
||||
$totalarray['val']['c.total_ht'] = $obj->total_ht;
|
||||
}
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['c.total_vat']['checked'])) {
|
||||
@@ -1676,12 +1696,23 @@ if ($resql) {
|
||||
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->statut;
|
||||
$userstatic->entity = $obj->entity;
|
||||
$userstatic->photo = $obj->photo;
|
||||
$userstatic->office_phone = $obj->office_phone;
|
||||
$userstatic->office_fax = $obj->office_fax;
|
||||
$userstatic->user_mobile = $obj->user_mobile;
|
||||
$userstatic->job = $obj->job;
|
||||
$userstatic->gender = $obj->gender;
|
||||
|
||||
// Author
|
||||
if (!empty($arrayfields['u.login']['checked'])) {
|
||||
print '<td align="center">';
|
||||
if ($userstatic->id > 0) {
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '<td class="tdoverflowmax200">';
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getNomUrl(-1);
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user