Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-01-01 11:24:10 +01:00
commit eae0800021
23 changed files with 255 additions and 374 deletions

View File

@ -152,6 +152,7 @@ NEW: #4301
For Developers or integrators: For Developers or integrators:
NEW: Compatible with PHP 7.4
NEW: Code for extrafields uses the new array $extrafields->attributes NEW: Code for extrafields uses the new array $extrafields->attributes
NEW: Can set a filter on object linked in modulebuilder. NEW: Can set a filter on object linked in modulebuilder.
NEW: Can defined a position of numbering submodules for thirdparties NEW: Can defined a position of numbering submodules for thirdparties

View File

@ -691,14 +691,14 @@ if ($rowid > 0)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled))
{ {
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
} }
print "</tr>\n"; print "</tr>\n";

View File

@ -1,129 +0,0 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file bom/admin/setup.php
* \ingroup bom
* \brief Bom setup page.
*/
// Load Dolibarr environment
require '../../main.inc.php';
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/bom.lib.php';
//require_once "../class/myclass.class.php";
// Translations
$langs->loadLangs(array("admin", "mrp"));
// Access control
if (!$user->admin) accessforbidden();
// Parameters
$action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters = array(
'BILLOFMATERIALS_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
'BILLOFMATERIALS_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
);
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
/*
* View
*/
$page_name = "BomSetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom');
// Configuration header
$head = bomAdminPrepareHead();
dol_fiche_head($head, 'settings', '', -1, "bom");
// Setup page goes here
echo $langs->trans("BomSetupPage").'<br><br>';
if ($action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
}
print '</table>';
print '<br><div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br>';
}
else
{
if (!empty($arrayofparameters))
{
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>'.$conf->global->$key.'</td></tr>';
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
}
else
{
print '<br>'.$langs->trans("NothingToSetup");
}
}
// Page end
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -48,9 +48,9 @@ $langs->loadLangs(array("main","bills"));
</script> </script>
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo $_GET['facid']; ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p> <p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo GETPOST('facid', 'int'); ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
<br> <br>
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p> <p><a class="lien1" href="#" onclick="Javascript: popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>'); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
</div> </div>
</div> </div>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -238,6 +238,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>'; print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>';
@ -261,6 +262,7 @@ print '<td><input name="amount" class="flat" type="text" size="6" value="'.dol_e
print '<td style="display:none" class="multicurrency"><input name="amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>'; print '<td style="display:none" class="multicurrency"><input name="amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
print "</table>"; print "</table>";
print '</div>';
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></div>'; print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></div>';

View File

@ -456,7 +456,7 @@ if ($id)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
// Label // Label
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';

View File

@ -134,7 +134,7 @@ if ($object->id)
print '<table class="border tableforfield centpercent">'; print '<table class="border tableforfield centpercent">';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';

View File

@ -351,7 +351,7 @@ class BonPrelevement extends CommonObject
if ($this->db->begin()) if ($this->db->begin())
{ {
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
$sql .= " SET statut = 1"; $sql .= " SET statut = ".self::STATUS_TRANSFERED;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
@ -437,11 +437,11 @@ class BonPrelevement extends CommonObject
{ {
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
$sql .= " SET fk_user_credit = ".$user->id; $sql .= " SET fk_user_credit = ".$user->id;
$sql .= ", statut = 2"; $sql .= ", statut = ".self::STATUS_CREDITED;
$sql .= ", date_credit = '".$this->db->idate($date)."'"; $sql .= ", date_credit = '".$this->db->idate($date)."'";
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
$sql .= " AND statut = 1"; $sql .= " AND statut = ".self::STATUS_TRANSFERED;
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -483,7 +483,8 @@ class BonPrelevement extends CommonObject
$paiement->datepaye = $date; $paiement->datepaye = $date;
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
$paiement->paiementid = 3; // $paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref; // Set ref of direct debit note $paiement->num_payment = $this->ref; // Set ref of direct debit note
$paiement->num_paiement = $this->ref; // For bacward compatibility
$paiement->id_prelevement = $this->id; $paiement->id_prelevement = $this->id;
$paiement_id = $paiement->create($user); $paiement_id = $paiement->create($user);
@ -530,7 +531,7 @@ class BonPrelevement extends CommonObject
if ($error == 0) if ($error == 0)
{ {
$this->date_credit = $date; $this->date_credit = $date;
$this->statut = 1; $this->statut = self::STATUS_CREDITED;
$this->db->commit(); $this->db->commit();
return 0; return 0;

View File

@ -108,6 +108,10 @@ class ChargeSociales extends CommonObject
public $fk_project; public $fk_project;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
/** /**
* Constructor * Constructor
* *
@ -495,43 +499,23 @@ class ChargeSociales extends CommonObject
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("customers","bills")); $langs->loadLangs(array("customers","bills"));
if ($mode == 0 || $mode == 1) if (empty($this->labelStatus) || empty($this->labelStatusShort))
{ {
if ($status == 0) return $langs->trans("Unpaid"); global $langs;
elseif ($status == 1) return $langs->trans("Paid"); //$langs->load("mymodule");
} $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid');
elseif ($mode == 2) $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid');
{ if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft');
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled');
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
}
elseif ($mode == 3)
{
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 4)
{
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
elseif ($mode == 5)
{
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 6)
{
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
} }
else return "Error, mode/status not found"; $statusType = 'status1';
if ($status == 0 && $alreadypaid > 0) $statusType = 'status3';
if ($status == 1) $statusType = 'status6';
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }

View File

@ -1260,12 +1260,14 @@ class pdf_einstein extends ModelePDFCommandes
{ {
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{ {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small; $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} }
else { else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; $logo = $logodir.'/logos/'.$this->emetteur->logo;
} }
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -1393,12 +1393,14 @@ class pdf_eratosthene extends ModelePDFCommandes
{ {
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{ {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small; $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} }
else { else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; $logo = $logodir.'/logos/'.$this->emetteur->logo;
} }
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -1618,12 +1618,14 @@ class pdf_crabe extends ModelePDFFactures
{ {
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{ {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small; $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} }
else { else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; $logo = $logodir.'/logos/'.$this->emetteur->logo;
} }
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -1834,12 +1834,14 @@ class pdf_sponge extends ModelePDFFactures
{ {
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{ {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small; $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} }
else { else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; $logo = $logodir.'/logos/'.$this->emetteur->logo;
} }
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -1467,12 +1467,14 @@ class pdf_azur extends ModelePDFPropales
{ {
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{ {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small; $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} }
else { else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; $logo = $logodir.'/logos/'.$this->emetteur->logo;
} }
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -1503,12 +1503,14 @@ class pdf_cyan extends ModelePDFPropales
{ {
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{ {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small; $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} }
else { else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; $logo = $logodir.'/logos/'.$this->emetteur->logo;
} }
if (is_readable($logo)) if (is_readable($logo))
{ {

View File

@ -251,9 +251,9 @@ ShowListTicketWithTrackId=Display ticket list from track ID
ShowTicketWithTrackId=Display ticket from track ID ShowTicketWithTrackId=Display ticket from track ID
TicketPublicDesc=You can create a support ticket or check from an existing ID. TicketPublicDesc=You can create a support ticket or check from an existing ID.
YourTicketSuccessfullySaved=Ticket has been successfully saved! YourTicketSuccessfullySaved=Ticket has been successfully saved!
MesgInfosPublicTicketCreatedWithTrackId=A new ticket has been created with ID %s. MesgInfosPublicTicketCreatedWithTrackId=A new ticket has been created with ID %s and Ref %s.
PleaseRememberThisId=Please keep the tracking number that we might ask you later. PleaseRememberThisId=Please keep the tracking number that we might ask you later.
TicketNewEmailSubject=Ticket creation confirmation TicketNewEmailSubject=Ticket creation confirmation - Ref %s
TicketNewEmailSubjectCustomer=New support ticket TicketNewEmailSubjectCustomer=New support ticket
TicketNewEmailBody=This is an automatic email to confirm you have registered a new ticket. TicketNewEmailBody=This is an automatic email to confirm you have registered a new ticket.
TicketNewEmailBodyCustomer=This is an automatic email to confirm a new ticket has just been created into your account. TicketNewEmailBodyCustomer=This is an automatic email to confirm a new ticket has just been created into your account.
@ -272,7 +272,7 @@ Subject=Subject
ViewTicket=View ticket ViewTicket=View ticket
ViewMyTicketList=View my ticket list ViewMyTicketList=View my ticket list
ErrorEmailMustExistToCreateTicket=Error: email address not found in our database ErrorEmailMustExistToCreateTicket=Error: email address not found in our database
TicketNewEmailSubjectAdmin=New ticket created TicketNewEmailSubjectAdmin=New ticket created - Ref %s
TicketNewEmailBodyAdmin=<p>Ticket has just been created with ID #%s, see information:</p> TicketNewEmailBodyAdmin=<p>Ticket has just been created with ID #%s, see information:</p>
SeeThisTicketIntomanagementInterface=See ticket in management interface SeeThisTicketIntomanagementInterface=See ticket in management interface
TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled

View File

@ -105,6 +105,10 @@ class Loan extends CommonObject
public $fk_project; public $fk_project;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
/** /**
* Constructor * Constructor
* *
@ -427,45 +431,27 @@ class Loan extends CommonObject
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
// Load translation files required by the page
$langs->loadLangs(array("customers","bills")); $langs->loadLangs(array("customers","bills"));
if ($mode == 0 || $mode == 1) if (empty($this->labelStatus) || empty($this->labelStatusShort))
{ {
if ($status == 0) return $langs->trans("Unpaid"); global $langs;
elseif ($status == 1) return $langs->trans("Paid"); //$langs->load("mymodule");
} $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid');
elseif ($mode == 2) $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid');
{ if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft');
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled');
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
}
elseif ($mode == 3)
{
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 4)
{
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
elseif ($mode == 5)
{
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 6)
{
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
} }
else return "Error, mode/status not found"; $statusType = 'status1';
if ($status == 0 && $alreadypaid > 0) $statusType = 'status3';
if ($status == 1) $statusType = 'status6';
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }

View File

@ -49,7 +49,8 @@ if (!$sortorder) $sortorder = "DESC";
$search_ref = GETPOST('search_ref', 'int'); $search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$filtre = GETPOST("filtre");
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
// Purge search criteria // Purge search criteria
@ -77,10 +78,6 @@ $sql .= " WHERE l.entity = ".$conf->entity;
if ($search_amount) $sql .= natural_search("l.capital", $search_amount, 1); if ($search_amount) $sql .= natural_search("l.capital", $search_amount, 1);
if ($search_ref) $sql .= " AND l.rowid = ".$db->escape($search_ref); if ($search_ref) $sql .= " AND l.rowid = ".$db->escape($search_ref);
if ($search_label) $sql .= natural_search("l.label", $search_label); if ($search_label) $sql .= natural_search("l.label", $search_label);
if ($filtre) {
$filtre = str_replace(":", "=", $filtre);
$sql .= " AND ".$filtre;
}
$sql .= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend"; $sql .= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend";
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
@ -108,10 +105,10 @@ if ($resql)
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_ref) $param.="&amp;search_ref=".urlencode($search_ref); if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
if ($search_label) $param.="&amp;search_label=".urlencode($search_user); if ($search_label) $param.="&search_label=".urlencode($search_label);
if ($search_amount) $param.="&amp;search_amount=".urlencode($search_amount_ht); if ($search_amount) $param.="&search_amount=".urlencode($search_amount);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
$newcardbutton=''; $newcardbutton='';
if ($user->rights->loan->write) if ($user->rights->loan->write)
@ -130,6 +127,8 @@ if ($resql)
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit); print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
$moreforfilter = '';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -157,7 +156,7 @@ if ($resql)
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
while ($i < min($num, $limit)) while ($i < ($limit ? min($num, $limit) : $num))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$loan_static->id = $obj->rowid; $loan_static->id = $obj->rowid;
@ -190,6 +189,14 @@ if ($resql)
$i++; $i++;
} }
// If no record found
if ($num == 0)
{
$colspan = 7;
//foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";

View File

@ -48,17 +48,17 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Ref loan // Ref loan
$morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
{ {
$langs->loadLangs(array("projects")); $langs->loadLangs(array("projects"));
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
if ($user->rights->loan->write) if ($user->rights->loan->write)
{ {
if ($action != 'classify') if ($action != 'classify')
$morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; //$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
@ -83,6 +83,9 @@ if (!empty($conf->projet->enabled))
} }
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
if ($action == 'createecheancier') { if ($action == 'createecheancier') {
@ -140,8 +143,6 @@ if ($action == 'updateecheancier') {
$echeance = new LoanSchedule($db); $echeance = new LoanSchedule($db);
$echeance->fetchAll($object->id); $echeance->fetchAll($object->id);
$var = !$var;
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
@ -187,6 +188,8 @@ if (count($echeance->lines) > 0)
} else { } else {
print '<input type="hidden" name="action" value="createecheancier">'; print '<input type="hidden" name="action" value="createecheancier">';
} }
print '<div class="div-table-responsive-no-min">';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$colspan = 6; $colspan = 6;
@ -197,12 +200,12 @@ print '</th>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th width="5%" class="center">'.$langs->trans("Term").'</th>'; print '<th class="center">'.$langs->trans("Term").'</th>';
print '<th width="5%" class="center">'.$langs->trans("Date").'</th>'; print '<th class="center">'.$langs->trans("Date").'</th>';
print '<th width="15%" class="center">'.$langs->trans("Insurance"); print '<th class="center">'.$langs->trans("Insurance");
print '<th width="15%" class="center">'.$langs->trans("InterestAmount").'</th>'; print '<th class="center">'.$langs->trans("InterestAmount").'</th>';
print '<th width="10%" class="center">'.$langs->trans("Amount").'</th>'; print '<th class="center">'.$langs->trans("Amount").'</th>';
print '<th width="40%" class="center">'.$langs->trans("CapitalRemain"); print '<th class="center">'.$langs->trans("CapitalRemain");
print '<br>('.price($object->capital, 0, '', 1, -1, -1, $conf->currency).')'; print '<br>('.price($object->capital, 0, '', 1, -1, -1, $conf->currency).')';
print '<input type="hidden" name="hi_capital0" id ="hi_capital0" value="'.$object->capital.'">'; print '<input type="hidden" name="hi_capital0" id ="hi_capital0" value="'.$object->capital.'">';
print '</th>'; print '</th>';
@ -276,8 +279,11 @@ elseif (count($echeance->lines) > 0)
} }
print '</table>'; print '</table>';
print '</div>';
print '</br>'; print '</br>';
print '</br>';
if (count($echeance->lines) == 0) $label = $langs->trans("Create"); if (count($echeance->lines) == 0) $label = $langs->trans("Create");
else $label = $langs->trans("Save"); else $label = $langs->trans("Save");
print '<div class="center"><input class="button" type="submit" value="'.$label.'"></div>'; print '<div class="center"><input class="button" type="submit" value="'.$label.'"></div>';

View File

@ -1877,6 +1877,9 @@ class Product extends CommonObject
if (empty($newnpr)) { if (empty($newnpr)) {
$newnpr = 0; $newnpr = 0;
} }
if (empty($newminprice)) {
$newminprice = 0;
}
// Check parameters // Check parameters
if ($newvat == '') { if ($newvat == '') {

View File

@ -471,8 +471,9 @@ if ($ispaymentok)
if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link
{ {
dol_syslog("No stripe profile found, so we add it", LOG_DEBUG, 0, '_payment'); dol_syslog("No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0, '_payment');
try {
$ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id $ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id
$stripecu = $ch->customer; // value 'cus_....' $stripecu = $ch->customer; // value 'cus_....'
@ -487,6 +488,13 @@ if ($ispaymentok)
$ispostactionok = -1; $ispostactionok = -1;
} }
} }
catch(Exception $e) {
$error++;
$errmsg='Failed to save customer stripe id in database ; '.$e->getMessage();
$postactionmessages[] = $errmsg;
$ispostactionok = -1;
}
}
} }
} }

View File

@ -203,7 +203,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
// Send email to customer // Send email to customer
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject'); $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref);
$message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n";
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n";
@ -245,7 +245,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
if ($sendto) if ($sendto)
{ {
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin'); $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref);
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>'; $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
$message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>'; $message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
@ -314,7 +314,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
// Make a redirect to avoid to have ticket submitted twice if we make back // Make a redirect to avoid to have ticket submitted twice if we make back
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>'), null, 'warnings'); setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>', '<strong>' . $object->ref . '</strong>'), null, 'warnings');
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
header("Location: index.php"); header("Location: index.php");
exit; exit;