Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0
Conflicts: htdocs/comm/propal/list.php htdocs/langs/en_US/projects.lang htdocs/product/price.php htdocs/reception/class/reception.class.php
This commit is contained in:
commit
c620757dbc
@ -349,9 +349,9 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->statut == 0) {
|
||||
if ($tmpproposal->valid($user)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||
if ($tmpproposal->valid($user) > 0) {
|
||||
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
||||
} else {
|
||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||
@ -363,7 +363,7 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -381,13 +381,13 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$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');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -395,7 +395,7 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -406,27 +406,28 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "nosign" && $permissiontoclose) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
$tmpproposal = new Propal($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) {
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,3 +285,4 @@ SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, th
|
||||
ProjectTasksWithoutTimeSpent=Project tasks without time spent
|
||||
FormForNewLeadDesc=Thanks to fill the following form to contact us. You can also send us an email directly to <b>%s</b>.
|
||||
StartDateCannotBeAfterEndDate=End date cannot be before start date
|
||||
ErrorPROJECTLEADERRoleMissingRestoreIt=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types
|
||||
|
||||
@ -85,6 +85,22 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature
|
||||
ProposalsStatisticsSuppliers=Vendor proposals statistics
|
||||
CaseFollowedBy=Case followed by
|
||||
SignedOnly=Signed only
|
||||
NoSign=Set not signed
|
||||
NoSigned=set not signed
|
||||
CantBeNoSign=cannot be set not signed
|
||||
ConfirmMassNoSignature=Bulk Not signed confirmation
|
||||
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
|
||||
IdProduct=Product ID
|
||||
PrParentLine=Proposal Parent Line
|
||||
|
||||
@ -2212,7 +2212,8 @@ class Product extends CommonObject
|
||||
$this->db->commit();
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -191,12 +191,17 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
if (!$error) {
|
||||
// Force the update of the price of the product to 0 if error
|
||||
|
||||
//$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.
|
||||
$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) {
|
||||
@ -463,13 +468,21 @@ if (empty($reshook)) {
|
||||
if ($action == 'activate_price_by_qty') {
|
||||
// Activating product price by quantity add a new price line with price_by_qty set to 1
|
||||
$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
|
||||
if ($action == 'disable_price_by_qty') {
|
||||
// Disabling product price by quantity add a new price line with price_by_qty set to 0
|
||||
$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é
|
||||
@ -1603,13 +1616,17 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
|
||||
// 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
|
||||
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 {
|
||||
$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));
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
}
|
||||
|
||||
if ($num > 0) {
|
||||
|
||||
@ -197,9 +197,14 @@ if (empty($reshook)) {
|
||||
$result = $object->create($user);
|
||||
if (!$error && $result > 0) {
|
||||
// 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');
|
||||
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");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
|
||||
@ -565,7 +565,7 @@ class Reception extends CommonObject
|
||||
|
||||
// Loop on each product line to add a stock movement
|
||||
// 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.eatby, ed.sellby, ed.batch,";
|
||||
$sql .= " ed.cost_price";
|
||||
@ -592,6 +592,12 @@ class Reception extends CommonObject
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
$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)) {
|
||||
// line without batch detail
|
||||
|
||||
@ -600,8 +606,9 @@ class Reception extends CommonObject
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
|
||||
} else {
|
||||
$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) {
|
||||
$error++;
|
||||
$this->errors[] = $mouvS->error;
|
||||
@ -617,8 +624,9 @@ class Reception extends CommonObject
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
|
||||
} else {
|
||||
$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) {
|
||||
$error++;
|
||||
$this->errors[] = $mouvS->error;
|
||||
|
||||
@ -542,7 +542,14 @@ class ProductCombination
|
||||
$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 {
|
||||
@ -564,7 +571,14 @@ class ProductCombination
|
||||
$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();
|
||||
@ -573,6 +587,8 @@ class ProductCombination
|
||||
}
|
||||
|
||||
$this->db->rollback();
|
||||
$this->error = $child->error;
|
||||
$this->errors = $child->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -239,6 +239,13 @@ if (empty($modulepart)) {
|
||||
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);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user