Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

Conflicts:
	htdocs/comm/propal/list.php
	htdocs/compta/facture/card.php
This commit is contained in:
Laurent Destailleur 2021-07-02 16:14:12 +02:00
commit 6ae1d192e4
7 changed files with 31 additions and 14 deletions

View File

@ -2594,9 +2594,14 @@ if ($action == 'create') {
}
// Close as accepted/refused
if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=closeas'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
if ($object->statut == Propal::STATUS_VALIDATED) {
if ($usercanclose) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=closeas'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
}
}
// Clone

View File

@ -228,9 +228,6 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$permissiontoclose = $user->rights->propal->creer;
}
/*
* Actions
*/

View File

@ -5393,7 +5393,7 @@ if ($action == 'create') {
}
// Create a credit note
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) {
if (($object->type == Facture::TYPE_STANDARD || ($object->type == Facture::TYPE_DEPOSIT && empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) {
if (!$objectidnext) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;fac_avoir='.$object->id.'&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').($object->entity > 0 ? '&amp;originentity='.$object->entity : '').'">'.$langs->trans("CreateCreditNote").'</a>';
}

View File

@ -6254,10 +6254,12 @@ abstract class CommonObject
$this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
break;
case 'date':
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
break;
case 'datetime':
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
if (empty($this->array_options["options_".$key])) {
$this->array_options["options_".$key] = null;
} else {
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
}
break;
/*
case 'link':
@ -6305,7 +6307,11 @@ abstract class CommonObject
}
if ($linealreadyfound) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
if ($this->array_options["options_".$key] === null) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = null";
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
}
$sql .= " WHERE fk_object = ".$this->id;
} else {
$result = $this->insertExtraFields('', $user);

View File

@ -354,6 +354,15 @@ if ($outputalsopricetotalwithtax) {
}
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
$situationinvoicelinewithparent = 0;
if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) {
if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
// Set constant to disallow editing during a situation cycle
$situationinvoicelinewithparent = 1;
}
}
print '<td class="linecoledit center">';
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
@ -365,7 +374,7 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
print '<td class="linecoldelete center">';
$coldisplay++;
if (($line->fk_prev_id == null) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company.
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=ask_deleteline&amp;lineid='.$line->id.'">';
print img_delete();
print '</a>';

View File

@ -672,7 +672,7 @@ class Mo extends CommonObject
if ($line->qty_frozen) {
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
} else {
$moline->qty = price2num(($line->qty / $bom->qty) * $this->qty / $line->efficiency, 'MS'); // Calculate with Qty to produce and more presition
$moline->qty = price2num(($line->qty / ( ! empty($bom->qty) ? $bom->qty : 1 ) ) * $this->qty / ( ! empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and more presition
}
if ($moline->qty <= 0) {
$error++;

View File

@ -26,7 +26,7 @@ if (!is_object($form)) {
$form = new Form($db);
}
$qtytoconsumeforline = $this->tpl['qty'] / $this->tpl['efficiency'];
$qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1 );
/*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) {
$qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom'];
}*/