Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
e08bf0c567
8 changed files with 49 additions and 42 deletions
1
.github/workflows/pre-commit.yml
vendored
1
.github/workflows/pre-commit.yml
vendored
|
|
@ -16,6 +16,7 @@ jobs:
|
|||
if: false
|
||||
|
||||
# The next uses the git API because there is no clone yet.
|
||||
# It sets the variable steps.changed-php.outputs.all_changed_files for other steps
|
||||
# This is faster for a big repo.
|
||||
- name: Get all changed php files (if PR)
|
||||
id: changed-php
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ repos:
|
|||
# Only for translations with specialised exceptions
|
||||
# -D contains predefined conversion dictionaries
|
||||
# -L is to ignore some words
|
||||
id: codespell
|
||||
id: codespell-lang-en_US
|
||||
files: ^htdocs/langs/en_US/.*$
|
||||
args:
|
||||
- -D
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ class Bookmark extends CommonObject
|
|||
public $picto = 'bookmark';
|
||||
|
||||
/**
|
||||
* Last error code on a local method
|
||||
* @var int Error number
|
||||
* @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ...
|
||||
*/
|
||||
public $errno;
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
$fk_accountancy_journal = GETPOSTINT('fk_accountancy_journal');
|
||||
if ($fk_accountancy_journal <= 0) {
|
||||
$object->fk_accountancy_journal = '';
|
||||
$object->fk_accountancy_journal = 0;
|
||||
} else {
|
||||
$object->fk_accountancy_journal = $fk_accountancy_journal;
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
$fk_accountancy_journal = GETPOSTINT('fk_accountancy_journal');
|
||||
if ($fk_accountancy_journal <= 0) {
|
||||
$object->fk_accountancy_journal = '';
|
||||
$object->fk_accountancy_journal = 0;
|
||||
} else {
|
||||
$object->fk_accountancy_journal = $fk_accountancy_journal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,19 +134,19 @@ if (empty($reshook)) {
|
|||
|
||||
// Ajout entrepot
|
||||
if ($action == 'add' && $user->hasRight('stock', 'creer')) {
|
||||
$object->ref = (string) GETPOST("ref", "alpha");
|
||||
$object->fk_parent = (int) GETPOST("fk_parent", "int");
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
$object->label = (string) GETPOST("libelle", "alpha");
|
||||
$object->description = (string) GETPOST("desc", "alpha");
|
||||
$object->statut = GETPOST("statut", "int");
|
||||
$object->lieu = (string) GETPOST("lieu", "alpha");
|
||||
$object->address = (string) GETPOST("address", "alpha");
|
||||
$object->zip = (string) GETPOST("zipcode", "alpha");
|
||||
$object->town = (string) GETPOST("town", "alpha");
|
||||
$object->country_id = GETPOST("country_id");
|
||||
$object->phone = (string) GETPOST("phone", "alpha");
|
||||
$object->fax = (string) GETPOST("fax", "alpha");
|
||||
$object->ref = (string) GETPOST("ref", "alpha");
|
||||
$object->fk_parent = GETPOSTINT("fk_parent");
|
||||
$object->fk_project = GETPOSTINT('projectid');
|
||||
$object->label = (string) GETPOST("libelle", "alpha");
|
||||
$object->description = (string) GETPOST("desc", "alpha");
|
||||
$object->statut = GETPOSTINT("statut");
|
||||
$object->lieu = (string) GETPOST("lieu", "alpha");
|
||||
$object->address = (string) GETPOST("address", "alpha");
|
||||
$object->zip = (string) GETPOST("zipcode", "alpha");
|
||||
$object->town = (string) GETPOST("town", "alpha");
|
||||
$object->country_id = GETPOSTINT("country_id");
|
||||
$object->phone = (string) GETPOST("phone", "alpha");
|
||||
$object->fax = (string) GETPOST("fax", "alpha");
|
||||
|
||||
if (!empty($object->label)) {
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
|
|
|||
|
|
@ -207,23 +207,23 @@ if (empty($reshook)) {
|
|||
|
||||
$db->begin();
|
||||
|
||||
$object->ref = GETPOST('ref', 'alphanohtml');
|
||||
$object->fk_project = GETPOST('fk_project', 'int');
|
||||
$object->title = GETPOST('title', 'alphanohtml');
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->description = GETPOST('description', 'restricthtml'); // Do not use 'alpha' here, we want field as it is
|
||||
$object->public = GETPOST('public', 'alphanohtml');
|
||||
$object->opp_amount = price2num(GETPOST('opp_amount', 'alphanohtml'));
|
||||
$object->budget_amount = price2num(GETPOST('budget_amount', 'alphanohtml'));
|
||||
$object->date_c = dol_now();
|
||||
$object->date_start = $date_start;
|
||||
$object->date_end = $date_end;
|
||||
$object->date_start_event = $date_start_event;
|
||||
$object->date_end_event = $date_end_event;
|
||||
$object->location = $location;
|
||||
$object->statut = $status;
|
||||
$object->opp_status = $opp_status;
|
||||
$object->opp_percent = $opp_percent;
|
||||
$object->ref = GETPOST('ref', 'alphanohtml');
|
||||
$object->fk_project = GETPOSTINT('fk_project');
|
||||
$object->title = GETPOST('title', 'alphanohtml');
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->description = GETPOST('description', 'restricthtml'); // Do not use 'alpha' here, we want field as it is
|
||||
$object->public = GETPOST('public', 'alphanohtml');
|
||||
$object->opp_amount = GETPOSTFLOAT('opp_amount');
|
||||
$object->budget_amount = GETPOSTFLOAT('budget_amount');
|
||||
$object->date_c = dol_now();
|
||||
$object->date_start = $date_start;
|
||||
$object->date_end = $date_end;
|
||||
$object->date_start_event = $date_start_event;
|
||||
$object->date_end_event = $date_end_event;
|
||||
$object->location = $location;
|
||||
$object->statut = $status;
|
||||
$object->opp_status = $opp_status;
|
||||
$object->opp_percent = $opp_percent;
|
||||
$object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha') == 'on' ? 1 : 0);
|
||||
$object->usage_task = (GETPOST('usage_task', 'alpha') == 'on' ? 1 : 0);
|
||||
$object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha') == 'on' ? 1 : 0);
|
||||
|
|
|
|||
|
|
@ -283,16 +283,23 @@ class ProductCombination
|
|||
/**
|
||||
* Retrieves all product combinations by the product parent row id
|
||||
*
|
||||
* @param int $fk_product_parent Rowid of parent product
|
||||
* @return int|ProductCombination[] Return integer <0 KO
|
||||
* @param int $fk_product_parent Rowid of parent product
|
||||
* @param bool $sort_by_ref Sort result by product child reference
|
||||
* @return int|ProductCombination[] Return integer <0 KO
|
||||
*/
|
||||
public function fetchAllByFkProductParent($fk_product_parent)
|
||||
public function fetchAllByFkProductParent($fk_product_parent, $sort_by_ref = false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_ref_ext, variation_weight";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_attribute_combination";
|
||||
$sql.= " WHERE fk_product_parent = ".((int) $fk_product_parent)." AND entity IN (".getEntity('product').")";
|
||||
$sql = "SELECT pac.rowid, pac.fk_product_parent, pac.fk_product_child, pac.variation_price, pac.variation_price_percentage, pac.variation_ref_ext, pac.variation_weight";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_attribute_combination AS pac";
|
||||
if ($sort_by_ref) {
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product AS p ON p.rowid = pac.fk_product_child";
|
||||
}
|
||||
$sql.= " WHERE pac.fk_product_parent = ".((int) $fk_product_parent)." AND pac.entity IN (".getEntity('product').")";
|
||||
if ($sort_by_ref) {
|
||||
$sql.= $this->db->order('p.ref', 'ASC');
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
|
|||
|
||||
|
||||
// Reload variants
|
||||
$productCombinations = $prodcomb->fetchAllByFkProductParent($object->id);
|
||||
$productCombinations = $prodcomb->fetchAllByFkProductParent($object->id, true);
|
||||
|
||||
if ($action === 'confirm_deletecombination') {
|
||||
if ($prodcomb->fetch($valueid) > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue