mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9bc2a3a6bd
|
|
@ -124,6 +124,8 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd)
|
|||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
$object->description = dol_htmlcleanlastbr($desc);
|
||||
|
||||
$object->update($user);
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = $libelle;
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
|
||||
|
|
|
|||
|
|
@ -2387,7 +2387,7 @@ if ($action == 'create') {
|
|||
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
|
||||
}
|
||||
// Incomplete payment. We ask if reason = discount or other
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250, 600);
|
||||
}
|
||||
|
||||
if ($action == 'closeas') {
|
||||
|
|
|
|||
|
|
@ -827,17 +827,22 @@ class Propal extends CommonObject
|
|||
|
||||
$result = $this->line->insert();
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la propale meme
|
||||
// Update denormalized fields at the order level
|
||||
if (empty($noupdateafterinsertline)) {
|
||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,10 +218,10 @@ if (empty($reshook)) {
|
|||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('IdThirdParty')), null, 'errors');
|
||||
} else {
|
||||
if ($object->id > 0) {
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||
$orig = clone $object;
|
||||
// We clone object to avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object.
|
||||
$objectutil = dol_clone($object, 1);
|
||||
|
||||
$result = $object->createFromClone($user, $socid);
|
||||
$result = $objectutil->createFromClone($user, $socid);
|
||||
if ($result > 0) {
|
||||
$warningMsgLineList = array();
|
||||
// check all product lines are to sell otherwise add a warning message for each product line is not to sell
|
||||
|
|
@ -243,7 +243,6 @@ if (empty($reshook)) {
|
|||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$object = $orig;
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,9 +113,16 @@ class Commande extends CommonOrder
|
|||
/**
|
||||
* Status of the order
|
||||
* @var int
|
||||
* @deprecated Use status
|
||||
*/
|
||||
public $statut;
|
||||
|
||||
/**
|
||||
* Status of the order
|
||||
* @var int
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var int Status Billed or not
|
||||
*/
|
||||
|
|
@ -793,12 +800,10 @@ class Commande extends CommonOrder
|
|||
*
|
||||
* @param User $user Object user that close
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
public function cloture($user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'creer'))
|
||||
|
|
@ -1098,6 +1103,7 @@ class Commande extends CommonOrder
|
|||
$line->ref_ext,
|
||||
1
|
||||
);
|
||||
|
||||
if ($result < 0) {
|
||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
|
@ -1541,7 +1547,7 @@ class Commande extends CommonOrder
|
|||
|
||||
$logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent";
|
||||
$logtext .= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start";
|
||||
$logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext";
|
||||
$logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext rang=$rang";
|
||||
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
|
|
@ -1681,6 +1687,7 @@ class Commande extends CommonOrder
|
|||
|
||||
// Rang to use
|
||||
$ranktouse = $rang;
|
||||
|
||||
if ($ranktouse == -1) {
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$ranktouse = $rangmax + 1;
|
||||
|
|
@ -1753,24 +1760,28 @@ class Commande extends CommonOrder
|
|||
|
||||
$result = $this->line->insert($user);
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la commande meme
|
||||
// Update denormalized fields at the order level
|
||||
if (empty($noupdateafterinsertline)) {
|
||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
$this->lines[] = $this->line;
|
||||
return $this->line->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
|
@ -1899,7 +1910,7 @@ class Commande extends CommonOrder
|
|||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut';
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut as status';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.deposit_percent, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql .= ', c.fk_account';
|
||||
$sql .= ', c.date_commande, c.date_valid, c.tms';
|
||||
|
|
@ -1955,8 +1966,8 @@ class Commande extends CommonOrder
|
|||
$this->fk_project = $obj->fk_project;
|
||||
$this->project = null; // Clear if another value was already set by fetch_projet
|
||||
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->status = $obj->fk_statut;
|
||||
$this->statut = $obj->status;
|
||||
$this->status = $obj->status;
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ class OrderLine extends CommonOrderLine
|
|||
}
|
||||
|
||||
/**
|
||||
* Insert line into database
|
||||
* Insert line into database. This also set $this->id.
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 1 = disable triggers
|
||||
|
|
@ -487,7 +487,7 @@ class OrderLine extends CommonOrderLine
|
|||
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
foreach ($this->errors as $errmsg) {
|
||||
|
|
|
|||
|
|
@ -766,14 +766,16 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'validate' && $permissiontoadd && $objectclass !== null) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
/** @var Commande $objecttmp */
|
||||
$objecttmp = new $objectclass($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($objecttmp->fetch($checked)) {
|
||||
if ($objecttmp->statut == 0) {
|
||||
if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
|
||||
if (!empty($objecttmp->fk_warehouse)) {
|
||||
$idwarehouse = $objecttmp->fk_warehouse;
|
||||
} else {
|
||||
|
|
@ -804,21 +806,23 @@ if ($action == 'validate' && $permissiontoadd && $objectclass !== null) {
|
|||
}
|
||||
if ($action == 'shipped' && $permissiontoadd && $objectclass !== null) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
/** @var Commande $objecttmp */
|
||||
$objecttmp = new $objectclass($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($objecttmp->fetch($checked)) {
|
||||
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
|
||||
if ($objecttmp->cloture($user)) {
|
||||
if ($objecttmp->status == $objecttmp::STATUS_VALIDATED || $objecttmp->status == $objecttmp::STATUS_SHIPMENTONPROCESS || $objecttmp->status == $objecttmp::STATUS_CLOSED) {
|
||||
$result = $objecttmp->cloture($user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans('StatusOrderDelivered', $objecttmp->ref), null, 'mesgs');
|
||||
} else {
|
||||
} elseif ($result < 0) {
|
||||
setEventMessages($langs->trans('ErrorOrderStatusCantBeSetToDelivered'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors');
|
||||
setEventMessages($langs->trans('ErrorObjectHasWrongStatus', $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4110,21 +4110,26 @@ class Facture extends CommonInvoice
|
|||
|
||||
$result = $this->line->insert();
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la facture meme
|
||||
// Update denormalized fields at the order level
|
||||
if (empty($noupdateafterinsertline)) {
|
||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||
}
|
||||
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$this->db->commit();
|
||||
return $this->line->id;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class FormFile
|
|||
* @param string $htmlname HTML name
|
||||
* @param string $modulepart Module part
|
||||
* @param string $dirformainimage Main directory of module
|
||||
* @param string $subdirformainimage Subdirectory into main directory. Often ''.
|
||||
* @param string $subdirformainimage Subdirectory into main directory. Often '', can be 'logos/'.
|
||||
* @param string $fileformainimage File name of image to show
|
||||
* @return string HTML code to show and edit image
|
||||
*/
|
||||
|
|
@ -104,8 +104,8 @@ class FormFile
|
|||
|
||||
$maxfilesizearray = getMaxFileSizeArray();
|
||||
$maxmin = $maxfilesizearray['maxmin'];
|
||||
$fileformainimagesmall = getImageFileNameForSize($fileformainimage, '_small');
|
||||
$fileformainimagemini = getImageFileNameForSize($fileformainimage, '_mini');
|
||||
$fileformainimagesmall = getImageFileNameForSize($fileformainimage, '_small'); // This include the "thumbs/..." in path
|
||||
$fileformainimagemini = getImageFileNameForSize($fileformainimage, '_mini'); // This include the "thumbs/..." in path
|
||||
|
||||
$out = '';
|
||||
|
||||
|
|
@ -119,16 +119,16 @@ class FormFile
|
|||
$out .= '<div class="inline-block valignmiddle marginrightonly">';
|
||||
$out .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=remove'.$htmlname.'&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
$out .= '</div>';
|
||||
if (file_exists($dirformainimage.'/'.$subdirformainimage.'thumbs/'.$fileformainimagesmall)) {
|
||||
if (file_exists($dirformainimage.'/'.$subdirformainimage.$fileformainimagesmall)) {
|
||||
$out .= '<div class="inline-block valignmiddle marginrightonly">';
|
||||
$out .= '<img id="'.$htmlname.'" style="'.$max.'height: '.$imgheight.'px; '.$max.'width: '.$imgwidth.'px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($subdirformainimage.'thumbs/'.$fileformainimagesmall).'">';
|
||||
$out .= '<img id="'.$htmlname.'" style="'.$max.'height: '.$imgheight.'px; '.$max.'width: '.$imgwidth.'px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($subdirformainimage.$fileformainimagesmall).'">';
|
||||
$out .= '</div>';
|
||||
} elseif (!empty($fileformainimage)) {
|
||||
// Regenerate the thumbs
|
||||
if (!file_exists($dirformainimage.'/'.$subdirformainimage.'thumbs/'.$fileformainimagemini)) {
|
||||
if (!file_exists($dirformainimage.'/'.$subdirformainimage.$fileformainimagemini)) {
|
||||
$imgThumbMini = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
$imgThumbSmall = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthmini, $maxheightmini, '_small', $quality);
|
||||
$imgThumbSmall = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
$out .= '<div class="inline-block valignmiddle">';
|
||||
$out .= '<img id="'.$htmlname.'" style="'.$max.'height: '.$imgheight.'px; '.$max.'width: '.$imgwidth.'px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($subdirformainimage.'thumbs/'.basename($imgThumbSmall)).'">';
|
||||
$out .= '</div>';
|
||||
|
|
|
|||
|
|
@ -1941,9 +1941,9 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu
|
|||
*/
|
||||
function showModulesExludedForExternal($modules)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
$text = $langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers");
|
||||
$text = $langs->transnoentitiesnoconv("OnlyFollowingModulesAreOpenedToExternalUsers");
|
||||
$listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // List of modules qualified for external user management
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -1967,11 +1967,11 @@ function showModulesExludedForExternal($modules)
|
|||
}
|
||||
$i++;
|
||||
|
||||
$tmptext = $langs->trans('Module'.$module->numero.'Name');
|
||||
$tmptext = $langs->transnoentitiesnoconv('Module'.$module->numero.'Name');
|
||||
if ($tmptext != 'Module'.$module->numero.'Name') {
|
||||
$text .= $langs->trans('Module'.$module->numero.'Name');
|
||||
$text .= $langs->transnoentitiesnoconv('Module'.$module->numero.'Name');
|
||||
} else {
|
||||
$text .= $langs->trans($module->name);
|
||||
$text .= $langs->transnoentitiesnoconv($module->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ function productlot_prepare_head($object)
|
|||
*/
|
||||
function product_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('product');
|
||||
|
|
@ -368,24 +368,31 @@ function product_admin_prepare_head()
|
|||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductLevelExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
// Extrafields for price levels
|
||||
if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductLevelExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'levelAttributes';
|
||||
$h++;
|
||||
}
|
||||
$head[$h][2] = 'levelAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductCustomerExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_customer_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
//Extrafields for price per customer
|
||||
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductCustomerExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_customer_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'customerAttributes';
|
||||
$h++;
|
||||
}
|
||||
$head[$h][2] = 'customerAttributes';
|
||||
$h++;
|
||||
|
||||
// Supplier prices
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductSupplierExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_fournisseur_price']['count'];
|
||||
|
|
|
|||
|
|
@ -1997,7 +1997,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param ?int $date_end Date end of service
|
||||
* @param array<string,null|int|float|string> $array_options extrafields array
|
||||
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param int|string $pu_ht_devise Amount in currency
|
||||
* @param int|string $pu_ht_devise Amount in currency
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @param int $rang Rank
|
||||
|
|
@ -2006,7 +2006,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $fk_prod_fourn_price = 0, $ref_supplier = '', $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $type = 0, $info_bits = 0, $notrigger = 0, $date_start = null, $date_end = null, $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $origin = '', $origin_id = 0, $rang = -1, $special_code = 0)
|
||||
{
|
||||
global $langs, $mysoc, $conf;
|
||||
global $langs, $mysoc;
|
||||
|
||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
|
@ -2243,19 +2243,25 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
$result = $this->line->insert($notrigger);
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($this->line->fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la commande meme
|
||||
// Update denormalized fields at the order level
|
||||
$result = $this->update_price(1, 'auto', 0, $this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
|
||||
if ($result > 0) {
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($this->line->fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $this->line->id;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2303,19 +2303,25 @@ class FactureFournisseur extends CommonInvoice
|
|||
|
||||
$result = $supplierinvoiceline->insert($notrigger);
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la facture meme
|
||||
// Update denormalized fields at the order level
|
||||
$result = $this->update_price(1, 'auto', 0, $this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||
|
||||
if ($result > 0) {
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $supplierinvoiceline;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $supplierinvoiceline->id;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2062,7 +2062,11 @@ if ($resql) {
|
|||
}
|
||||
// Billed
|
||||
if (!empty($arrayfields['cf.billed']['checked'])) {
|
||||
print '<td class="center">'.yn($obj->billed).'</td>';
|
||||
print '<td class="center">';
|
||||
if ($obj->billed) {
|
||||
print yn($obj->billed, $langs->trans("Billed"));
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source'
|
|||
ErrorTooManyErrorsProcessStopped=Too many errors. Process was stopped.
|
||||
ErrorMassValidationNotAllowedWhenStockIncreaseOnAction=Mass validation is not possible when option to increase/decrease stock is set on this action (you must validate one by one so you can define the warehouse to increase/decrease)
|
||||
ErrorObjectMustHaveStatusDraftToBeValidated=Object %s must have status 'Draft' to be validated.
|
||||
ErrorObjectHasWrongStatus=Object %s must have another status for this operation.
|
||||
ErrorObjectMustHaveLinesToBeValidated=Object %s must have lines to be validated.
|
||||
ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Only validated invoices can be sent using the "Send by email" mass action.
|
||||
ErrorChooseBetweenFreeEntryOrPredefinedProduct=You must choose if article is a predefined product or not
|
||||
|
|
|
|||
|
|
@ -122,9 +122,11 @@ if ($action == 'other') {
|
|||
if ($tmprule == $princingrules) { // We are on selected rule, we enable it
|
||||
if ($princingrules == 'PRODUCT_PRICE_UNIQ') { // For this case, we disable entries manually
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$multirule = explode('&', $princingrules);
|
||||
|
|
|
|||
|
|
@ -1513,7 +1513,7 @@ if (!empty($arrayfields['s.name_alias']['checked'])) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['co.country_code']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "co.country_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "country.code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['commercial']['checked'])) {
|
||||
|
|
@ -1889,7 +1889,7 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
// Country code
|
||||
if (!empty($arrayfields['co.country_code']['checked'])) {
|
||||
print '<td class="tdoverflowmax125">';
|
||||
print '<td class="tdoverflowmax125 center">';
|
||||
print $obj->country_code;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user