Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0
Conflicts: htdocs/comm/propal/list.php htdocs/langs/en_US/projects.lang htdocs/langs/en_US/propal.lang htdocs/product/price.php htdocs/projet/card.php htdocs/reception/class/reception.class.php
This commit is contained in:
commit
32f2499c36
@ -349,9 +349,9 @@ if ($action == 'validate' && $permissiontovalidate) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == 0) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||||
if ($tmpproposal->valid($user)) {
|
if ($tmpproposal->valid($user) > 0) {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||||
@ -362,7 +362,7 @@ if ($action == 'validate' && $permissiontovalidate) {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,13 +380,14 @@ if ($action == "sign" && $permissiontoclose) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||||
|
|
||||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;;
|
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;;
|
||||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
|
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -394,7 +395,7 @@ if ($action == "sign" && $permissiontoclose) {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,3 +275,4 @@ UsageOrganizeEvent=Usage: Event Organization
|
|||||||
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
|
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
|
||||||
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100 %% progress won't be affected: you will have to close them manually. This option only affects open projects.
|
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100 %% progress won't be affected: you will have to close them manually. This option only affects open projects.
|
||||||
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
|
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
|
||||||
|
ErrorPROJECTLEADERRoleMissingRestoreIt=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types
|
||||||
|
|||||||
@ -90,6 +90,17 @@ NoSigned=set not signed
|
|||||||
CantBeNoSign=cannot be set not signed
|
CantBeNoSign=cannot be set not signed
|
||||||
ConfirmMassNoSignature=Bulk Not signed confirmation
|
ConfirmMassNoSignature=Bulk Not signed confirmation
|
||||||
ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ?
|
ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ?
|
||||||
|
IsNotADraft=is not a draft
|
||||||
|
PassedInOpenStatus=has been validated
|
||||||
|
CantBeSign=cannot be signed
|
||||||
|
Sign=Sign
|
||||||
|
Signed=signed
|
||||||
|
CantBeSign=cannot be signed
|
||||||
|
CantBeValidated=cannot be validated
|
||||||
|
ConfirmMassValidation=Bulk Validate confirmation
|
||||||
|
ConfirmMassSignature=Bulk Signature confirmation
|
||||||
|
ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ?
|
||||||
|
ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ?
|
||||||
IdProposal=Proposal ID
|
IdProposal=Proposal ID
|
||||||
IdProduct=Product ID
|
IdProduct=Product ID
|
||||||
PrParentLine=Proposal Parent Line
|
PrParentLine=Proposal Parent Line
|
||||||
|
|||||||
@ -2192,7 +2192,8 @@ class Product extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
$this->error = $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -171,10 +171,15 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
if (!$error) {
|
||||||
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
||||||
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
|
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
|
||||||
$object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
|
$ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
@ -394,13 +399,21 @@ if (empty($reshook)) {
|
|||||||
if ($action == 'activate_price_by_qty') {
|
if ($action == 'activate_price_by_qty') {
|
||||||
// Activating product price by quantity add a new price line with price_by_qty set to 1
|
// Activating product price by quantity add a new price line with price_by_qty set to 1
|
||||||
$level = GETPOST('level', 'int');
|
$level = GETPOST('level', 'int');
|
||||||
$object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
|
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Unset Price by quantity
|
// Unset Price by quantity
|
||||||
if ($action == 'disable_price_by_qty') {
|
if ($action == 'disable_price_by_qty') {
|
||||||
// Disabling product price by quantity add a new price line with price_by_qty set to 0
|
// Disabling product price by quantity add a new price line with price_by_qty set to 0
|
||||||
$level = GETPOST('level', 'int');
|
$level = GETPOST('level', 'int');
|
||||||
$object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
|
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité
|
if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité
|
||||||
@ -1483,14 +1496,18 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
|
|||||||
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
|
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
|
||||||
// We emulate the change of the price from interface with the same value than the one into table llx_product
|
// We emulate the change of the price from interface with the same value than the one into table llx_product
|
||||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||||
$object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1);
|
$ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1);
|
||||||
} else {
|
} else {
|
||||||
$object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min));
|
$ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
|
} else {
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
// Default prices or
|
// Default prices or
|
||||||
|
|||||||
@ -180,9 +180,14 @@ if (empty($reshook)) {
|
|||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if (!$error && $result > 0) {
|
if (!$error && $result > 0) {
|
||||||
// Add myself as project leader
|
// Add myself as project leader
|
||||||
$typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error.
|
$typeofcontact = 'PROJECTLEADER';
|
||||||
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
|
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
|
||||||
if ($result < 0) {
|
|
||||||
|
// -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case
|
||||||
|
if ($result == -3) {
|
||||||
|
setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors');
|
||||||
|
$error++;
|
||||||
|
} elseif ($result < 0) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -565,7 +565,7 @@ class Reception extends CommonObject
|
|||||||
|
|
||||||
// Loop on each product line to add a stock movement
|
// Loop on each product line to add a stock movement
|
||||||
// TODO in future, reception lines may not be linked to order line
|
// TODO in future, reception lines may not be linked to order line
|
||||||
$sql = "SELECT cd.fk_product, cd.subprice,";
|
$sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,";
|
||||||
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
|
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
|
||||||
$sql .= " ed.eatby, ed.sellby, ed.batch";
|
$sql .= " ed.eatby, ed.sellby, ed.batch";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
|
||||||
@ -591,12 +591,19 @@ class Reception extends CommonObject
|
|||||||
$mouvS = new MouvementStock($this->db);
|
$mouvS = new MouvementStock($this->db);
|
||||||
$mouvS->origin = &$this;
|
$mouvS->origin = &$this;
|
||||||
|
|
||||||
|
// get unit price with discount
|
||||||
|
$up_ht_disc = $obj->subprice;
|
||||||
|
if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) {
|
||||||
|
$up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($obj->batch)) {
|
if (empty($obj->batch)) {
|
||||||
// line without batch detail
|
// line without batch detail
|
||||||
|
|
||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||||
$inventorycode = '';
|
$inventorycode = '';
|
||||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
|
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $mouvS->error;
|
$this->errors[] = $mouvS->error;
|
||||||
@ -609,7 +616,8 @@ class Reception extends CommonObject
|
|||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||||
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
||||||
$inventorycode = '';
|
$inventorycode = '';
|
||||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
|
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $mouvS->error;
|
$this->errors[] = $mouvS->error;
|
||||||
|
|||||||
@ -536,7 +536,14 @@ class ProductCombination
|
|||||||
$new_price += $variation_price;
|
$new_price += $variation_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
|
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error = $child->error;
|
||||||
|
$this->errors = $child->errors;
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -558,7 +565,14 @@ class ProductCombination
|
|||||||
$new_price += $this->variation_price;
|
$new_price += $this->variation_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
|
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error = $child->error;
|
||||||
|
$this->errors = $child->errors;
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -567,6 +581,8 @@ class ProductCombination
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
$this->error = $child->error;
|
||||||
|
$this->errors = $child->errors;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -234,6 +234,13 @@ if (empty($modulepart)) {
|
|||||||
accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
|
accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output
|
||||||
|
// is not set on the requested entity, but they are public documents, so reset entity
|
||||||
|
if ($modulepart === 'medias' && $entity != $conf->entity) {
|
||||||
|
$conf->entity = $entity;
|
||||||
|
$conf->setValues($db);
|
||||||
|
}
|
||||||
|
|
||||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
|
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
|
||||||
$accessallowed = $check_access['accessallowed'];
|
$accessallowed = $check_access['accessallowed'];
|
||||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user