forked from Wavyzz/dolibarr
Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0
This commit is contained in:
@@ -2702,6 +2702,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
// Load event
|
||||
$res = $this->fetch($actionCommReminder->fk_actioncomm);
|
||||
if ($res > 0) $res = $this->fetch_thirdparty();
|
||||
if ($res > 0) {
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
|
||||
@@ -2778,6 +2778,21 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call Hook modifyTextInfo
|
||||
$parameters = array('textinfo' => $text_info);
|
||||
$reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action);
|
||||
if ($reshook == 1) {
|
||||
// for add information
|
||||
$text_info .= $hookmanager->resPrint;
|
||||
} elseif ($reshook == 0) {
|
||||
// for replace information
|
||||
$text_info = $hookmanager->resPrint;
|
||||
} elseif ($reshook == -1) {
|
||||
// for errors
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($notshippable == 0) {
|
||||
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
|
||||
$text_info = $text_icon.' '.$langs->trans('Shippable').'<br>'.$text_info;
|
||||
|
||||
@@ -4654,6 +4654,9 @@ if ($action == 'create') {
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalcreditnotes = $totalcreditnotes;
|
||||
$object->totaldeposits = $totaldeposits;
|
||||
$object->remaintopay = price2num($object->total_ttc - $object->totalpaid - $object->totalcreditnotes - $object->totaldeposits, 'MT');
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
|
||||
@@ -442,8 +442,9 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
|
||||
$paiementAmount = $facture->getSommePaiement();
|
||||
$totalcreditnotes = $facture->getSumCreditNotesUsed();
|
||||
$totaldeposits = $facture->getSumDepositsUsed();
|
||||
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facture->total_ttc - $totalpay);
|
||||
|
||||
$totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facture->total_ttc - $totalallpayments);
|
||||
|
||||
// hook to finalize the remaining amount, considering e.g. cash discount agreements
|
||||
$parameters = array('remaintopay' => $remaintopay);
|
||||
|
||||
@@ -87,11 +87,24 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-statut right">';
|
||||
$totalallpayments = 0;
|
||||
$totalcalculated = false;
|
||||
if (method_exists($objectlink, 'getSommePaiement')) {
|
||||
print $objectlink->getLibStatut(3, $objectlink->getSommePaiement());
|
||||
$totalcalculated = true;
|
||||
$totalallpayments += $objectlink->getSommePaiement();
|
||||
} else {
|
||||
print $objectlink->getLibStatut(3);
|
||||
}
|
||||
if (method_exists($objectlink, 'getSumDepositsUsed')) {
|
||||
$totalcalculated = true;
|
||||
$totalallpayments += $objectlink->getSumDepositsUsed();
|
||||
}
|
||||
if (method_exists($objectlink, 'getSumCreditNotesUsed')) {
|
||||
$totalcalculated = true;
|
||||
$totalallpayments += $objectlink->getSumCreditNotesUsed();
|
||||
}
|
||||
print $objectlink->getLibStatut(3, ($totalcalculated ? $totalallpayments : -1));
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -219,6 +219,9 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
|
||||
$thirdpartystatic->code_compta_client = $obj->code_compta;
|
||||
//$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$totalallpayments = $tmpinvoice->getSommePaiement(0);
|
||||
$totalallpayments += $tmpinvoice->getSumCreditNotesUsed(0);
|
||||
$totalallpayments += $tmpinvoice->getSumDepositsUsed(0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
@@ -251,7 +254,7 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
|
||||
|
||||
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
|
||||
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $totalallpayments).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@@ -380,6 +383,8 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
|
||||
$alreadypaid = $facstatic->getSommePaiement();
|
||||
$alreadypaid += $facstatic->getSumCreditNotesUsed();
|
||||
$alreadypaid += $facstatic->getSumDepositsUsed();
|
||||
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
|
||||
print '</tr>';
|
||||
$total_ht += $obj->total_ht;
|
||||
|
||||
@@ -1321,7 +1321,7 @@ class Paiement extends CommonObject
|
||||
$facturestatic = new Facture($this->db);
|
||||
foreach ($arraybill as $billid) {
|
||||
$facturestatic->fetch($billid);
|
||||
$label .= '<br> '.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, 1);
|
||||
$label .= '<br> '.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ print '</span></td></tr></table></div><br>';
|
||||
/*
|
||||
* Invoices waiting for withdraw
|
||||
*/
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut as status, f.paye, f.type,";
|
||||
$sql .= " pfd.date_demande, pfd.amount,";
|
||||
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
@@ -141,10 +141,13 @@ if ($resql) {
|
||||
|
||||
$invoicestatic->id = $obj->rowid;
|
||||
$invoicestatic->ref = $obj->ref;
|
||||
$invoicestatic->statut = $obj->fk_statut;
|
||||
$invoicestatic->statut = $obj->status;
|
||||
$invoicestatic->status = $obj->status;
|
||||
$invoicestatic->paye = $obj->paye;
|
||||
$invoicestatic->type = $obj->type;
|
||||
$alreadypayed = $invoicestatic->getSommePaiement();
|
||||
$totalallpayments = $invoicestatic->getSommePaiement(0);
|
||||
$totalallpayments += $invoicestatic->getSumCreditNotesUsed(0);
|
||||
$totalallpayments += $invoicestatic->getSumDepositsUsed(0);
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
@@ -177,7 +180,7 @@ if ($resql) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
print $invoicestatic->getLibStatut(3, $alreadypayed);
|
||||
print $invoicestatic->getLibStatut(3, $totalallpayments);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -159,7 +159,9 @@ if ($id > 0) {
|
||||
print $fac->error."<br>";
|
||||
continue;
|
||||
}
|
||||
$totalpaid = $fac->getSommePaiement();
|
||||
$alreadypaid = $fac->getSommePaiement();
|
||||
$alreadypaid += $fac->getSumDepositsUsed();
|
||||
$alreadypaid += $fac->getSumCreditNotesUsed();
|
||||
|
||||
$userstatic->id = $objf->userid;
|
||||
$userstatic->login = $objf->login;
|
||||
@@ -169,7 +171,7 @@ if ($id > 0) {
|
||||
'date' => $fac->date,
|
||||
'datefieldforsort' => $fac->date.'-'.$fac->ref,
|
||||
'link' => $fac->getNomUrl(1),
|
||||
'status' => $fac->getLibStatut(2, $totalpaid),
|
||||
'status' => $fac->getLibStatut(2, $alreadypaid),
|
||||
'amount' => $fac->total_ttc,
|
||||
'author' => $userstatic->getLoginUrl(1)
|
||||
);
|
||||
|
||||
@@ -745,7 +745,8 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.status']['checked'])) {
|
||||
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $obj->alreadypayed) . '</td>';
|
||||
$totalallpayments = $obj->alreadypayed;
|
||||
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $totalallpayments) . '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -2950,7 +2950,16 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
$tmptxt = $object->getLibStatut(5, $object->alreadypaid);
|
||||
}
|
||||
$morehtmlstatus .= $tmptxt;
|
||||
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid
|
||||
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier'))) { // TODO Move this to use ->alreadypaid
|
||||
$totalallpayments = $object->getSommePaiement(0);
|
||||
$totalallpayments += $object->getSumCreditNotesUsed(0);
|
||||
$totalallpayments += $object->getSumDepositsUsed(0);
|
||||
$tmptxt = $object->getLibStatut(6, $totalallpayments);
|
||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
||||
$tmptxt = $object->getLibStatut(5, $totalallpayments);
|
||||
}
|
||||
$morehtmlstatus .= $tmptxt;
|
||||
} elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid
|
||||
$tmptxt = $object->getLibStatut(6, $object->totalpaid);
|
||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
||||
$tmptxt = $object->getLibStatut(5, $object->totalpaid);
|
||||
|
||||
@@ -1835,8 +1835,8 @@ if ($resql) {
|
||||
}
|
||||
// Alias
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print $obj->alias;
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->alias).'">';
|
||||
print dol_escape_all($obj->alias);
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@@ -1844,8 +1844,8 @@ if ($resql) {
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td>';
|
||||
print $obj->town;
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).'">';
|
||||
print dol_escape_htmltag($obj->town);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@@ -1853,8 +1853,8 @@ if ($resql) {
|
||||
}
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print '<td>';
|
||||
print $obj->zip;
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).'">';
|
||||
print dol_escape_htmltag($obj->zip);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@@ -1862,7 +1862,7 @@ if ($resql) {
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).'">'.dol_escape_htmltag($obj->state_name)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -1100,6 +1100,13 @@ class Holiday extends CommonObject
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
|
||||
@@ -196,17 +196,20 @@ if ($action == 'order' && GETPOST('valid')) {
|
||||
// TODO Get desc in language of thirdparty
|
||||
}
|
||||
|
||||
$line->tva_tx = $productsupplier->vatrate_supplier;
|
||||
$tva = $line->tva_tx / 100;
|
||||
|
||||
// If we use multicurrency
|
||||
if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) {
|
||||
$line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
|
||||
$line->fk_multicurrency = $productsupplier->fourn_multicurrency_id;
|
||||
$line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice;
|
||||
$line->multicurrency_total_ht = $line->multicurrency_subprice * $qty;
|
||||
$line->multicurrency_total_tva = $line->multicurrency_total_ht * $tva;
|
||||
$line->multicurrency_total_ttc = $line->multicurrency_total_ht + $line->multicurrency_total_tva;
|
||||
}
|
||||
|
||||
$line->tva_tx = $productsupplier->vatrate_supplier;
|
||||
$line->subprice = $productsupplier->fourn_pu;
|
||||
$line->total_ht = $productsupplier->fourn_pu * $qty;
|
||||
$tva = $line->tva_tx / 100;
|
||||
$line->total_tva = $line->total_ht * $tva;
|
||||
$line->total_ttc = $line->total_ht + $line->total_tva;
|
||||
$line->remise_percent = $productsupplier->remise_percent;
|
||||
|
||||
@@ -370,7 +370,7 @@ class ProductAttribute extends CommonObject
|
||||
* Updates a product attribute
|
||||
*
|
||||
* @param User $user User who updates the attribute
|
||||
* @param int $notrigger 1 = Do not execute trigger (0 by default)
|
||||
* @param int $notrigger If 1 = Do not execute trigger (0 by default)
|
||||
* @return int Return <0 if KO, 1 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = 0)
|
||||
|
||||
@@ -64,8 +64,9 @@ if (!empty($object_rights->write) && $action != 'selectlines') {
|
||||
$coldisplay++;
|
||||
if (empty($disableedit)) { ?>
|
||||
<a class="editfielda reposition" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id.'#line_'.$line->id; ?>">
|
||||
<?php print img_edit().'</a>';
|
||||
}
|
||||
<?php print img_edit(); ?>
|
||||
</a>
|
||||
<?php }
|
||||
print '</td>';
|
||||
|
||||
print '<td class="linecoldelete center width25">';
|
||||
|
||||
Reference in New Issue
Block a user