Skip to content

Commit

Permalink
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Oct 4, 2023
2 parents 40f1058 + ee4d662 commit 3700b04
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 53 deletions.
5 changes: 2 additions & 3 deletions htdocs/contrat/class/contrat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_star
}

// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0) {
if ($pa_ht == 0) {
if (($result = $this->defineBuyPrice($pu, $remise_percent)) < 0) {
return $result;
} else {
Expand Down Expand Up @@ -3303,7 +3303,6 @@ public function fetch($id, $ref = '')
$this->statut = $obj->statut;
$this->product_ref = $obj->product_ref;
$this->product_label = $obj->product_label;
$this->product_description = $obj->product_description;
$this->product_type = $obj->product_type;
$this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line
$this->description = $obj->description;
Expand Down Expand Up @@ -3440,7 +3439,7 @@ public function update($user, $notrigger = 0)
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->thirdparty, $mysoc);
$localtaxes_type = getLocalTaxesFromRate($this->tva_tx, 0, $this->thirdparty, $mysoc);

$tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type);
$this->total_ht = $tabprice[0];
Expand Down
40 changes: 39 additions & 1 deletion htdocs/core/class/html.formprojet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
* \brief Class file for html component project
*/

require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';

/**
* Class to manage building of HTML components
*/
class FormProjets
class FormProjets extends Form
{
/**
* @var DoliDB Database handler.
Expand Down Expand Up @@ -756,6 +757,43 @@ public function selectOpportunityStatus($htmlname, $preselected = '-1', $showemp
}
}

/**
* Return combo list of differents status of a orders
*
* @param string $selected Preselected value
* @param int $short Use short labels
* @param string $hmlname Name of HTML select element
* @return void
*/
public function selectProjectsStatus($selected = '', $short = 0, $hmlname = 'order_status')
{
$options = array();

// 7 is same label than 6. 8 does not exists (billed is another field)
$statustohow = array(
'0' => '0',
'1' => '1',
'2' => '2',
);

$tmpproject = new Project($this->db);

foreach ($statustohow as $key => $value) {
$tmpproject->statut = $key;
$options[$value] = $tmpproject->getLibStatut($short);
}

if (is_array($selected)) {
$selectedarray = $selected;
} elseif ($selected == 99) {
$selectedarray = array(0,1);
} else {
$selectedarray = explode(',', $selected);
}

print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, 'minwidth100');
}

/**
* Output a combo list with invoices and lines qualified for a project
*
Expand Down
11 changes: 4 additions & 7 deletions htdocs/fourn/class/api_supplier_orders.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,

// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") && !$socids) {
if (!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") && !empty($socids)) {
$search_sale = DolibarrApiAccess::$user->id;
}

$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") && !$socids) || $search_sale > 0) {
if ((!DolibarrApiAccess::$user->hasRight("societe", "client", "voir")) || $search_sale > 0) {
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
}
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur AS t LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields

if ((!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") && !$socids) || $search_sale > 0) {
if ((!DolibarrApiAccess::$user->hasRight("societe", "client", "voir")) || $search_sale > 0) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
}

Expand All @@ -132,7 +132,7 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
}

$sql .= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
if ((!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") && !$socids) || $search_sale > 0) {
if ((!DolibarrApiAccess::$user->hasRight("societe", "client", "voir")) || $search_sale > 0) {
$sql .= " AND t.fk_soc = sc.fk_soc";
}
if (!empty($product_ids)) {
Expand All @@ -141,9 +141,6 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
if ($socids) {
$sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")";
}
if ($search_sale > 0) {
$sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
}

// Filter by status
if ($status == 'draft') {
Expand Down
42 changes: 21 additions & 21 deletions htdocs/install/mysql/data/llx_c_invoice_subtype.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
--
--
-- Greece (102)
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '1.1', 'Τιμολόγιο Πώλησης', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '1.2', 'Τιμολόγιο Πώλησης / Ενδοκοινοτικές Παραδόσεις', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '1.3', 'Τιμολόγιο Πώλησης / Παραδόσεις Τρίτων Χωρών', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '1.4', 'Τιμολόγιο Πώλησης / Πώληση για Λογαριασμό Τρίτων', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '1.5', 'Τιμολόγιο Πώλησης / Εκκαθάριση Πωλήσεων Τρίτων - Αμοιβή από Πωλήσεις Τρίτων', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '1.6', 'Τιμολόγιο Πώλησης / Συμπληρωματικό Παραστατικό', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '2.1', 'Τιμολόγιο Παροχής', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '2.2', 'Τιμολόγιο Παροχής / Ενδοκοινοτική Παροχή Υπηρεσιών', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '2.3', 'Τιμολόγιο Παροχής / Παροχή Υπηρεσιών σε λήπτη Τρίτης Χώρας', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '2.4', 'Τιμολόγιο Παροχής / Συμπληρωματικό Παραστατικό', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '3.1', 'Τίτλος Κτήσης (μη υπόχρεος Εκδότης)', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '3.2', 'Τίτλος Κτήσης (άρνηση έκδοσης από υπόχρεο Εκδότη)', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '6.1', 'Στοιχείο Αυτοπαράδοσης', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '6.2', 'Στοιχείο Ιδιοχρησιμοποίησης', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '7.1', 'Συμβόλαιο - Έσοδο', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '8.1', 'Ενοίκια - Έσοδο', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '8.2', 'Ειδικό Στοιχείο – Απόδειξης Είσπραξης Φόρου Διαμονής', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '11.1', 'ΑΛΠ', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '11.2', 'ΑΠΥ', 1);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '11.3', 'Απλοποιημένο Τιμολόγιο', 0);
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '11.5', 'Απόδειξη Λιανικής Πώλησης για Λογ/σμό Τρίτων', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '1.1', 'Τιμολόγιο Πώλησης', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '1.2', 'Τιμολόγιο Πώλησης / Ενδοκοινοτικές Παραδόσεις', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '1.3', 'Τιμολόγιο Πώλησης / Παραδόσεις Τρίτων Χωρών', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '1.4', 'Τιμολόγιο Πώλησης / Πώληση για Λογαριασμό Τρίτων', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '1.5', 'Τιμολόγιο Πώλησης / Εκκαθάριση Πωλήσεων Τρίτων - Αμοιβή από Πωλήσεις Τρίτων', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '1.6', 'Τιμολόγιο Πώλησης / Συμπληρωματικό Παραστατικό', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '2.1', 'Τιμολόγιο Παροχής', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '2.2', 'Τιμολόγιο Παροχής / Ενδοκοινοτική Παροχή Υπηρεσιών', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '2.3', 'Τιμολόγιο Παροχής / Παροχή Υπηρεσιών σε λήπτη Τρίτης Χώρας', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '2.4', 'Τιμολόγιο Παροχής / Συμπληρωματικό Παραστατικό', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '3.1', 'Τίτλος Κτήσης (μη υπόχρεος Εκδότης)', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '3.2', 'Τίτλος Κτήσης (άρνηση έκδοσης από υπόχρεο Εκδότη)', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '6.1', 'Στοιχείο Αυτοπαράδοσης', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '6.2', 'Στοιχείο Ιδιοχρησιμοποίησης', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '7.1', 'Συμβόλαιο - Έσοδο', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '8.1', 'Ενοίκια - Έσοδο', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '8.2', 'Ειδικό Στοιχείο – Απόδειξης Είσπραξης Φόρου Διαμονής', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '11.1', 'ΑΛΠ', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '11.2', 'ΑΠΥ', 1);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '11.3', 'Απλοποιημένο Τιμολόγιο', 0);
insert into llx_c_invoice_subtype (fk_country, code, label, active) VALUES (102, '11.5', 'Απόδειξη Λιανικής Πώλησης για Λογ/σμό Τρίτων', 0);
1 change: 1 addition & 0 deletions htdocs/install/mysql/migration/18.0.0-19.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@ ALTER TABLE llx_accounting_account MODIFY COLUMN pcg_type varchar(32);
-- VPGSQL8.2 DROP INDEX uk_links;
ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid, objecttype,label);

ALTER TABLE llx_c_invoice_subtype MODIFY COLUMN entity integer DEFAULT 1 NOT NULL;

16 changes: 9 additions & 7 deletions htdocs/install/mysql/tables/llx_c_invoice_subtype.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
--
-- ========================================================================

CREATE TABLE llx_c_invoice_subtype (
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
fk_country integer NOT NULL,
code varchar(4) NOT NULL,
label varchar(100),
active tinyint DEFAULT 1 NOT NULL
CREATE TABLE llx_c_invoice_subtype
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_country integer NOT NULL,
code varchar(4) NOT NULL,
label varchar(100),
active tinyint DEFAULT 1 NOT NULL

) ENGINE=innodb;

24 changes: 10 additions & 14 deletions htdocs/projet/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
$search_label = GETPOST("search_label", 'alpha');
$search_societe = GETPOST("search_societe", 'alpha');
$search_societe_alias = GETPOST("search_societe_alias", 'alpha');
$search_status = GETPOST("search_status", 'int');
$search_opp_status = GETPOST("search_opp_status", 'alpha');
$search_opp_percent = GETPOST("search_opp_percent", 'alpha');
$search_opp_amount = GETPOST("search_opp_amount", 'alpha');
Expand Down Expand Up @@ -163,8 +162,10 @@
$search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array");
}

if ($search_status == '') {
$search_status = -1; // -1 or 1
if (GETPOSTISARRAY('search_status')) {
$search_status = join(',', GETPOST('search_status', 'array:intcomma'));
} else {
$search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : '0,1');
}


Expand Down Expand Up @@ -528,11 +529,11 @@
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
if ($search_status >= 0) {
if ($search_status != '' && $search_status != '-1') {
if ($search_status == 99) {
$sql .= " AND p.fk_statut <> 2";
$sql .= " AND p.fk_statut IN (0,1)";
} else {
$sql .= " AND p.fk_statut = ".((int) $search_status);
$sql .= " AND p.fk_statut IN (".$db->sanitize($db->escape($search_status)).")";
}
}
if ($search_opp_status) {
Expand Down Expand Up @@ -843,8 +844,8 @@
if ($search_societe_alias != '') {
$param .= '&search_societe_alias='.urlencode($search_societe_alias);
}
if ($search_status >= 0) {
$param .= '&search_status='.urlencode($search_status);
if ($search_status != '' && $search_status != '-1') {
$param .= "&search_status=".urlencode($search_status);
}
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'openedopp', 'notopenedopp', 'none'))) {
$param .= '&search_opp_status='.urlencode($search_opp_status);
Expand Down Expand Up @@ -1245,12 +1246,7 @@
}
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print '<td class="liste_titre center parentonrightofpage">';
$arrayofstatus = array();
foreach ($object->statuts_short as $key => $val) {
$arrayofstatus[$key] = $langs->trans($val);
}
$arrayofstatus['99'] = $langs->trans("NotClosed").' ('.$langs->trans('Draft').' + '.$langs->trans('Opened').')';
print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage', 1);
$formproject->selectProjectsStatus($search_status, 1, 'search_status');
print '</td>';
}
// Action column
Expand Down

0 comments on commit 3700b04

Please sign in to comment.