Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c556f60c89
@ -2542,6 +2542,11 @@ if ($action == 'create' && $usercancreate)
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
|
||||
if (empty($reshook)) {
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
if ($usercansend) {
|
||||
@ -2619,11 +2624,6 @@ if ($action == 'create' && $usercancreate)
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Set to shipped
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
|
||||
|
||||
@ -103,7 +103,9 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
if ($action != 'add') {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -134,6 +136,7 @@ if ($user->socid) $socid = $user->socid;
|
||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -941,11 +944,13 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!($_POST['fac_replacement'] > 0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -992,6 +997,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@ -999,6 +1005,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -1181,6 +1188,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -1223,6 +1231,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@ -1230,6 +1239,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -1642,6 +1652,7 @@ if (empty($reshook))
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -2123,7 +2134,7 @@ if (empty($reshook))
|
||||
if (!GETPOST('qty')) $special_code = 3;
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
$line->fetch(GETPOST('lineid', 'int'));
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0)
|
||||
@ -2283,17 +2294,17 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier'))
|
||||
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice
|
||||
{
|
||||
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||
if (GETPOST('all_progress') != "")
|
||||
{
|
||||
$all_progress = GETPOST('all_progress', 'int');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
if (floatval($all_progress) < floatval($percent)) {
|
||||
$mesg = $langs->trans("Line").' '.$i.' '.$line->ref.' : '.$langs->trans("CantBeLessThanMinPercent");
|
||||
$mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent");
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else
|
||||
@ -2303,7 +2314,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -2939,7 +2950,7 @@ if ($action == 'create')
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount'), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit', 'int').'"/>';
|
||||
@ -2992,14 +3003,16 @@ if ($action == 'create')
|
||||
exit();
|
||||
}
|
||||
$options = "";
|
||||
foreach ($facids as $facparam)
|
||||
{
|
||||
$options .= '<option value="'.$facparam ['id'].'"';
|
||||
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||
$options .= ' selected';
|
||||
$options .= '>'.$facparam ['ref'];
|
||||
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
|
||||
$options .= '</option>';
|
||||
if (is_array($facids)) {
|
||||
foreach ($facids as $facparam)
|
||||
{
|
||||
$options .= '<option value="'.$facparam ['id'].'"';
|
||||
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||
$options .= ' selected';
|
||||
$options .= '>'.$facparam ['ref'];
|
||||
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
|
||||
$options .= '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<!-- replacement line -->';
|
||||
@ -4240,7 +4253,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
if (!$displayWarranty) {
|
||||
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
|
||||
}
|
||||
@ -4557,7 +4570,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Payments already done (from payment on this invoice)
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
||||
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
||||
$sql .= ' pf.amount,';
|
||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
||||
@ -4583,7 +4596,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
$paymentstatic->id = $objp->rowid;
|
||||
$paymentstatic->datepaye = $db->jdate($objp->dp);
|
||||
$paymentstatic->ref = $objp->ref;
|
||||
$paymentstatic->num_paiement = $objp->num_paiement;
|
||||
$paymentstatic->num_payment = $objp->num_payment;
|
||||
$paymentstatic->payment_code = $objp->payment_code;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
@ -4591,7 +4604,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>';
|
||||
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
|
||||
print '<td>'.$label.' '.$objp->num_paiement.'</td>';
|
||||
print '<td>'.$label.' '.$objp->num_payment.'</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
@ -5082,21 +5095,6 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
|
||||
{
|
||||
if (!$objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate)
|
||||
{
|
||||
@ -5123,6 +5121,21 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
|
||||
{
|
||||
if (!$objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Remove situation from cycle
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
|
||||
@ -637,7 +637,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
|
||||
|
||||
print '<td class="nowraponall">';
|
||||
print $invoice->getNomUrl(1, '');
|
||||
@ -715,7 +715,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
// Price
|
||||
print '<td class="right" '.(($invoice->id == $facid) ? ' style="font-weight: bold" ' : '').'>'.price($sign * $objp->total_ttc).'</td>';
|
||||
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
|
||||
|
||||
// Received or paid back
|
||||
print '<td class="right">'.price($sign * $paiement);
|
||||
|
||||
@ -309,7 +309,7 @@ class Conf
|
||||
{
|
||||
if (!empty($this->$module->enabled))
|
||||
{
|
||||
foreach ($dirs as $type => $name)
|
||||
foreach ($dirs as $type => $name) // $type is 'output' or 'temp'
|
||||
{
|
||||
$subdir = ($type == 'temp' ? '/temp' : '');
|
||||
// For multicompany sharings
|
||||
|
||||
@ -4515,7 +4515,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
||||
|
||||
/**
|
||||
* Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user.
|
||||
* Function to use on each input amount before any numeric test or database insert
|
||||
* Function to use on each input amount before any numeric test or database insert. A better name for this function
|
||||
* should be text2num().
|
||||
*
|
||||
* @param float $amount Amount to convert/clean
|
||||
* @param string $rounding ''=No rounding
|
||||
|
||||
@ -135,7 +135,13 @@ else
|
||||
echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
|
||||
} else {
|
||||
if (!empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
if (preg_match('/^\(DEPOSIT\)/', $line->description)) {
|
||||
$newdesc = preg_replace('/^\(DEPOSIT\)/', $langs->trans("Deposit"), $line->description);
|
||||
echo $text.' '.dol_htmlentitiesbr($newdesc);
|
||||
}
|
||||
else {
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1845,7 +1845,7 @@ if ($action == 'create')
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
|
||||
@ -606,7 +606,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$multicurrency_remaintopay = price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT');
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowraponall">';
|
||||
@ -619,7 +619,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
// Date
|
||||
if ($objp->df > 0)
|
||||
{
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($db->jdate($objp->df), 'day').'</td>';
|
||||
}
|
||||
else
|
||||
@ -630,7 +630,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
// Date Max Payment
|
||||
if ($objp->dlr > 0)
|
||||
{
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($db->jdate($objp->dlr), 'day');
|
||||
|
||||
if ($invoice->hasDelay())
|
||||
|
||||
@ -1766,6 +1766,7 @@ GoOntoUserCardToAddMore=Go to the tab "Notifications" of a user to add or remove
|
||||
GoOntoContactCardToAddMore=Go to the tab "Notifications" of a third party to add or remove notifications for contacts/addresses
|
||||
Threshold=Threshold
|
||||
BackupDumpWizard=Wizard to build the backup file
|
||||
BackupZipWizard=Wizard to archive the documents
|
||||
SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason:
|
||||
SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is a manual process only a privileged user may perform.
|
||||
InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file <strong>%s</strong> to allow this feature.
|
||||
|
||||
@ -416,7 +416,7 @@ PaymentConditionShort14D=14 days
|
||||
PaymentCondition14D=14 days
|
||||
PaymentConditionShort14DENDMONTH=14 days of month-end
|
||||
PaymentCondition14DENDMONTH=Within 14 days following the end of the month
|
||||
FixAmount=Fixed amount
|
||||
FixAmount=Fixed amount - 1 line with label '%s'
|
||||
VarAmount=Variable amount (%% tot.)
|
||||
VarAmountOneLine=Variable amount (%% tot.) - 1 line with label '%s'
|
||||
# PaymentType
|
||||
|
||||
Loading…
Reference in New Issue
Block a user