Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9671810d13
@ -12,6 +12,7 @@ php:
|
|||||||
- '5.5'
|
- '5.5'
|
||||||
- '5.6'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
|
- '7.1'
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
@ -96,7 +97,7 @@ install:
|
|||||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
||||||
composer -n require phpunit/phpunit ^4
|
composer -n require phpunit/phpunit ^4
|
||||||
fi
|
fi
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
composer -n require phpunit/phpunit ^5
|
composer -n require phpunit/phpunit ^5
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
@ -136,7 +137,7 @@ before_script:
|
|||||||
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
echo
|
echo
|
||||||
echo "Enabling Memcached for PHP <= 5.4"
|
echo "Enabling Memcached for PHP <= 5.4"
|
||||||
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly!
|
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
|
||||||
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
fi
|
fi
|
||||||
phpenv rehash
|
phpenv rehash
|
||||||
@ -208,7 +209,7 @@ before_script:
|
|||||||
echo "Setting up Apache + FPM"
|
echo "Setting up Apache + FPM"
|
||||||
# enable php-fpm
|
# enable php-fpm
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
# Copy the included pool
|
# Copy the included pool
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
||||||
fi
|
fi
|
||||||
|
|||||||
61
htdocs/cashdesk/css/ticket.css
Normal file
61
htdocs/cashdesk/css/ticket.css
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* TPV ticket.css
|
||||||
|
*/
|
||||||
|
body {
|
||||||
|
font-size: 1.5em;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entete { /* position: relative; */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.address { /* float: left; */
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date_heure {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infos {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.liste_articles {
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.liste_articles tr.titres th {
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.liste_articles td.total {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totaux {
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 30%;
|
||||||
|
float: right;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lien {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.lien {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -28,130 +28,84 @@ $object->fetch($facid);
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><?php echo $langs->trans('PrintTicket') ?></title>
|
<title><?php echo $langs->trans('PrintTicket') ?></title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT;?>/cashdesk/css/ticket.css">
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
font-size: 1.5em;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entete { /* position: relative; */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.address { /* float: left; */
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.date_heure {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.infos {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.liste_articles {
|
|
||||||
width: 100%;
|
|
||||||
border-bottom: 1px solid #000;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.liste_articles tr.titres th {
|
|
||||||
border-bottom: 1px solid #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.liste_articles td.total {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.totaux {
|
|
||||||
margin-top: 20px;
|
|
||||||
width: 30%;
|
|
||||||
float: right;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lien {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
.lien {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="entete">
|
<div class="entete">
|
||||||
<div class="logo"><?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?>
|
<div class="logo">
|
||||||
</div>
|
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?>
|
||||||
<div class="infos">
|
</div>
|
||||||
<p class="address"><?php echo $mysoc->name; ?><br>
|
<div class="infos">
|
||||||
<?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
|
<p class="address"><?php echo $mysoc->name; ?><br>
|
||||||
</p>
|
<?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p class="date_heure"><?php
|
<p class="date_heure"><?php
|
||||||
// Recuperation et affichage de la date et de l'heure
|
// Recuperation et affichage de la date et de l'heure
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
print dol_print_date($now,'dayhourtext').'<br>';
|
print dol_print_date($now,'dayhourtext').'<br>';
|
||||||
print $object->ref;
|
print $object->ref;
|
||||||
?></p>
|
?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<table class="liste_articles">
|
<table class="liste_articles">
|
||||||
|
<thead>
|
||||||
<tr class="titres">
|
<tr class="titres">
|
||||||
<th><?php print $langs->trans("Code"); ?></th>
|
<th><?php print $langs->trans("Code"); ?></th>
|
||||||
<th><?php print $langs->trans("Label"); ?></th>
|
<th><?php print $langs->trans("Label"); ?></th>
|
||||||
<th><?php print $langs->trans("Qty"); ?></th>
|
<th><?php print $langs->trans("Qty"); ?></th>
|
||||||
<th><?php print $langs->trans("Discount").' (%)'; ?></th>
|
<th><?php print $langs->trans("Discount").' (%)'; ?></th>
|
||||||
<th><?php print $langs->trans("TotalHT"); ?></th>
|
<th><?php print $langs->trans("TotalHT"); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
<?php
|
$tab=array();
|
||||||
|
|
||||||
$tab=array();
|
|
||||||
$tab = $_SESSION['poscart'];
|
$tab = $_SESSION['poscart'];
|
||||||
|
|
||||||
$tab_size=count($tab);
|
$tab_size=count($tab);
|
||||||
for($i=0;$i < $tab_size;$i++)
|
for($i=0;$i < $tab_size;$i++)
|
||||||
{
|
{
|
||||||
$remise = $tab[$i]['remise'];
|
$remise = $tab[$i]['remise'];
|
||||||
echo ('<tr><td>'.$tab[$i]['ref'].'</td><td>'.$tab[$i]['label'].'</td><td>'.$tab[$i]['qte'].'</td><td>'.$tab[$i]['remise_percent'].'</td><td class="total">'.price(price2num($tab[$i]['total_ht'],'MT'),0,$langs,0,0,-1,$conf->currency).'</td></tr>'."\n");
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $tab[$i]['ref'];?></td>
|
||||||
|
<td><?php echo $tab[$i]['label'];?></td>
|
||||||
|
<td><?php echo $tab[$i]['qte'];?></td>
|
||||||
|
<td><?php echo $tab[$i]['remise_percent'];?></td>
|
||||||
|
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'],'MT'),0,$langs,0,0,-1,$conf->currency);?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
?>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table class="totaux">
|
<table class="totaux">
|
||||||
<?php
|
<tr>
|
||||||
echo '<tr><th class="nowrap">'.$langs->trans("TotalHT").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalHt(),'MT'),'',$langs,0,-1,-1,$conf->currency)."</td></tr>\n";
|
<th class="nowrap"><?php echo $langs->trans("TotalHT");?></th>
|
||||||
echo '<tr><th class="nowrap">'.$langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->montantTva(),'MT'),'',$langs,0,-1,-1,$conf->currency)."</td></tr>\n";
|
<td class="nowrap"><?php echo price(price2num($obj_facturation->prixTotalHt(),'MT'),'',$langs,0,-1,-1,$conf->currency)."\n";?></td>
|
||||||
echo '<tr><th class="nowrap">'.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalTtc(),'MT'),'',$langs,0,-1,-1,$conf->currency)."</td></tr>\n";
|
</tr>
|
||||||
?>
|
<tr>
|
||||||
|
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->montantTva(),'MT'),'',$langs,0,-1,-1,$conf->currency)."\n";?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalTtc(),'MT'),'',$langs,0,-1,-1,$conf->currency)."\n";?></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.print();
|
window.print();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a class="lien" href="#"
|
<a class="lien" href="#" onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
|
||||||
onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -920,6 +920,18 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send mail
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Actions to send emails
|
||||||
|
$actiontypecode='AC_CONT';
|
||||||
|
$trigger_name='CONTRACT_SENTBYMAIL';
|
||||||
|
$paramname='id';
|
||||||
|
$mode='emailfromcontract';
|
||||||
|
$trackid='cont'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
|
||||||
{
|
{
|
||||||
if ($action == 'addcontact')
|
if ($action == 'addcontact')
|
||||||
@ -2026,37 +2038,164 @@ else
|
|||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
|
// Select mail models is same action as presend
|
||||||
|
if (GETPOST('modelselected')) {
|
||||||
|
$action = 'presend';
|
||||||
|
}
|
||||||
|
|
||||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
if ($action != 'presend')
|
||||||
|
{
|
||||||
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents generes
|
* Documents generes
|
||||||
*/
|
*/
|
||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$filedir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
$genallowed = $user->rights->contrat->creer;
|
$genallowed = $user->rights->contrat->creer;
|
||||||
$delallowed = $user->rights->contrat->supprimer;
|
$delallowed = $user->rights->contrat->supprimer;
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
||||||
|
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'contract', $socid);
|
$somethingshown = $formactions->showactions($object, 'contract', $socid);
|
||||||
|
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Action presend
|
||||||
|
*/
|
||||||
|
if ($action == 'presend')
|
||||||
|
{
|
||||||
|
$object->fetch_projet();
|
||||||
|
|
||||||
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
$fileparams = dol_most_recent_file($conf->contrat->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||||
|
$file = $fileparams['fullname'];
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
|
$newlang = $_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $object->thirdparty->default_lang;
|
||||||
|
|
||||||
|
if (!empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate('', $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
$outputlangs->load('commercial');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file)) {
|
||||||
|
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if ($result <= 0) {
|
||||||
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||||
|
$file = $fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<div class="clearboth"></div>';
|
||||||
|
print '<br>';
|
||||||
|
print load_fiche_titre($langs->trans('SendOrderByMail'));
|
||||||
|
|
||||||
|
dol_fiche_head('');
|
||||||
|
|
||||||
|
// Cree l'objet formulaire mail
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||||
|
$formmail = new FormMail($db);
|
||||||
|
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
|
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||||
|
|
||||||
|
if($formmail->fromtype === 'user'){
|
||||||
|
$formmail->fromid = $user->id;
|
||||||
|
|
||||||
|
}
|
||||||
|
$formmail->trackid='ord'.$object->id;
|
||||||
|
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||||
|
{
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||||
|
}
|
||||||
|
$formmail->withfrom = 1;
|
||||||
|
$liste = array();
|
||||||
|
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||||
|
$liste [$key] = $value;
|
||||||
|
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
|
||||||
|
$formmail->withtocc = $liste;
|
||||||
|
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||||
|
if (empty($object->ref_client)) {
|
||||||
|
$formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__');
|
||||||
|
} else if (! empty($object->ref_client)) {
|
||||||
|
$formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)');
|
||||||
|
}
|
||||||
|
$formmail->withfile = 2;
|
||||||
|
$formmail->withbody = 1;
|
||||||
|
$formmail->withdeliveryreceipt = 1;
|
||||||
|
$formmail->withcancel = 1;
|
||||||
|
// Tableau des substitutions
|
||||||
|
$formmail->setSubstitFromObject($object);
|
||||||
|
$formmail->substit ['__ORDERREF__'] = $object->ref;
|
||||||
|
|
||||||
|
$custcontact = '';
|
||||||
|
$contactarr = array();
|
||||||
|
$contactarr = $object->liste_contact(- 1, 'external');
|
||||||
|
|
||||||
|
if (is_array($contactarr) && count($contactarr) > 0)
|
||||||
|
{
|
||||||
|
foreach ($contactarr as $contact)
|
||||||
|
{
|
||||||
|
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||||
|
$contactstatic = new Contact($db);
|
||||||
|
$contactstatic->fetch($contact ['id']);
|
||||||
|
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($custcontact)) {
|
||||||
|
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tableau des parametres complementaires
|
||||||
|
$formmail->param['action'] = 'send';
|
||||||
|
$formmail->param['models'] = 'order_send';
|
||||||
|
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||||
|
$formmail->param['orderid'] = $object->id;
|
||||||
|
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||||
|
|
||||||
|
// Init list of files
|
||||||
|
if (GETPOST("mode") == 'init') {
|
||||||
|
$formmail->clear_attached_files();
|
||||||
|
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show form
|
||||||
|
print $formmail->get_form();
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1248,11 +1248,15 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
{
|
{
|
||||||
if ($issupplierline)
|
if ($issupplierline)
|
||||||
{
|
{
|
||||||
//$ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
|
if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1)
|
||||||
if (! empty($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES)) $ref_prodserv =$ref_supplier;
|
$ref_prodserv = $ref_supplier;
|
||||||
else $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
|
elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2)
|
||||||
|
$ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')';
|
||||||
|
else
|
||||||
|
$ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')';
|
||||||
}
|
}
|
||||||
else $ref_prodserv = $prodser->ref; // Show local ref only
|
else
|
||||||
|
$ref_prodserv = $prodser->ref; // Show local ref only
|
||||||
|
|
||||||
if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
|
if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,7 +281,14 @@ class modSociete extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id';
|
||||||
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')';
|
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')';
|
||||||
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id;
|
if(!$user->rights->societe->client->voir) {
|
||||||
|
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
|
||||||
|
if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) {
|
||||||
|
$subordinatesids = $user->getAllChildIds();
|
||||||
|
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : '';
|
||||||
|
}
|
||||||
|
$this->export_sql_end[$r] .=')';
|
||||||
|
}
|
||||||
|
|
||||||
// Export list of contacts and attributes
|
// Export list of contacts and attributes
|
||||||
$r++;
|
$r++;
|
||||||
@ -311,7 +318,14 @@ class modSociete extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
|
||||||
$this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity("societe", 1).')';
|
$this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity("societe", 1).')';
|
||||||
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id;
|
if(!$user->rights->societe->client->voir) {
|
||||||
|
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
|
||||||
|
if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) {
|
||||||
|
$subordinatesids = $user->getAllChildIds();
|
||||||
|
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : '';
|
||||||
|
}
|
||||||
|
$this->export_sql_end[$r] .=')';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
|
|||||||
@ -342,11 +342,11 @@ if (empty($reshook))
|
|||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = $langs->trans("ExpenseReportWaitingForApproval");
|
$subject = $langs->transnoentities("ExpenseReportWaitingForApproval");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
|
$message = $langs->transnoentities("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
|
||||||
|
|
||||||
// Rebuild pdf
|
// Rebuild pdf
|
||||||
/*
|
/*
|
||||||
@ -436,74 +436,83 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
|
// Send mail
|
||||||
{
|
|
||||||
// Send mail
|
|
||||||
|
|
||||||
// TO
|
// TO
|
||||||
$destinataire = new User($db);
|
$destinataire = new User($db);
|
||||||
$destinataire->fetch($object->fk_user_validator);
|
$destinataire->fetch($object->fk_user_validator);
|
||||||
$emailTo = $destinataire->email;
|
$emailTo = $destinataire->email;
|
||||||
|
|
||||||
if ($emailTo)
|
if ($emailTo)
|
||||||
|
{
|
||||||
|
// FROM
|
||||||
|
$expediteur = new User($db);
|
||||||
|
$expediteur->fetch($object->fk_user_author);
|
||||||
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
|
// SUBJECT
|
||||||
|
$subject = $langs->transnoentities("ExpenseReportWaitingForReApproval");
|
||||||
|
|
||||||
|
// CONTENT
|
||||||
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
|
$dateRefusEx = explode(" ",$object->date_refuse);
|
||||||
|
$message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $link);
|
||||||
|
|
||||||
|
// Rebuild pdf
|
||||||
|
/*
|
||||||
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
|
if($resultPDF)
|
||||||
|
{
|
||||||
|
// ATTACHMENT
|
||||||
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf");
|
||||||
|
array_push($mimetype,"application/pdf");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// PREPARE SEND
|
||||||
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
|
if ($mailfile)
|
||||||
{
|
{
|
||||||
// FROM
|
// SEND
|
||||||
$expediteur = new User($db);
|
$result=$mailfile->sendfile();
|
||||||
$expediteur->fetch($object->fk_user_author);
|
if ($result)
|
||||||
$emailFrom = $expediteur->email;
|
|
||||||
|
|
||||||
// SUBJECT
|
|
||||||
$subject = "' ERP - Note de frais à re-approuver";
|
|
||||||
|
|
||||||
// CONTENT
|
|
||||||
$dateRefusEx = explode(" ",$object->date_refuse);
|
|
||||||
|
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
|
||||||
$message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n";
|
|
||||||
$message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n";
|
|
||||||
$message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n";
|
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
|
||||||
$message.= "Bien cordialement,\n' SI";
|
|
||||||
|
|
||||||
// Génération du pdf avant attachement
|
|
||||||
$object->setDocModel($user,"");
|
|
||||||
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
|
||||||
|
|
||||||
if($resultPDF)
|
|
||||||
{
|
{
|
||||||
// ATTACHMENT
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf");
|
exit;
|
||||||
array_push($mimetype,"application/pdf");
|
}
|
||||||
|
else
|
||||||
// PREPARE SEND
|
{
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
$langs->load("other");
|
||||||
|
if ($mailfile->error)
|
||||||
if (! $mailfile->error)
|
|
||||||
{
|
{
|
||||||
// SEND
|
$mesg='';
|
||||||
$result=$mailfile->sendfile();
|
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||||
if ($result)
|
$mesg.='<br>'.$mailfile->error;
|
||||||
{
|
setEventMessages($mesg, null, 'errors');
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg=$mailfile->error;
|
|
||||||
setEventMessages($mesg, null, 'errors');
|
|
||||||
}
|
|
||||||
// END - Send mail
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db,$resultPDF);
|
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -542,80 +551,89 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
|
// Send mail
|
||||||
{
|
|
||||||
// Send mail
|
|
||||||
|
|
||||||
// TO
|
// TO
|
||||||
$destinataire = new User($db);
|
$destinataire = new User($db);
|
||||||
$destinataire->fetch($object->fk_user_author);
|
$destinataire->fetch($object->fk_user_author);
|
||||||
$emailTo = $destinataire->email;
|
$emailTo = $destinataire->email;
|
||||||
|
|
||||||
// CC
|
// CC
|
||||||
$emailCC = $conf->global->NDF_CC_EMAILS;
|
$emailCC = $conf->global->NDF_CC_EMAILS;
|
||||||
|
|
||||||
// FROM
|
// FROM
|
||||||
$expediteur = new User($db);
|
$expediteur = new User($db);
|
||||||
$expediteur->fetch($object->fk_user_valid);
|
$expediteur->fetch($object->fk_user_valid);
|
||||||
$emailFrom = $expediteur->email;
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = "' ERP - Note de frais validée";
|
$subject = $langs->transnoentities("ExpenseReportApproved");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être approuvé!\n";
|
$message = $langs->transnoentities("ExpenseReportApprovedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||||
$message.= "- Approbateur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
|
||||||
$message.= "Bien cordialement,\n' SI";
|
|
||||||
|
|
||||||
// Génération du pdf avant attachement
|
// Rebuilt pdf
|
||||||
$object->setDocModel($user,"");
|
/*
|
||||||
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
if($resultPDF):
|
if($resultPDF
|
||||||
// ATTACHMENT
|
{
|
||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
// ATTACHMENT
|
||||||
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
array_push($filedir, $conf->expensereport->dir_output.
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
"/".
|
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
|
||||||
dol_sanitizeFileName($object->ref) .
|
array_push($mimetype,"application/pdf");
|
||||||
"/".
|
}
|
||||||
dol_sanitizeFileName($object->ref).
|
*/
|
||||||
".pdf"
|
|
||||||
);
|
|
||||||
array_push($mimetype,"application/pdf");
|
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename,$emailCC);
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
if(!$mailfile->error):
|
if ($mailfile)
|
||||||
|
{
|
||||||
// SEND
|
// SEND
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result):
|
if ($result)
|
||||||
setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs');
|
{
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
||||||
exit;
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
else:
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
|
exit;
|
||||||
endif;
|
}
|
||||||
|
else
|
||||||
else:
|
{
|
||||||
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
|
$langs->load("other");
|
||||||
endif;
|
if ($mailfile->error)
|
||||||
// END - Send mail
|
{
|
||||||
else : // if ($resultPDF)
|
$mesg='';
|
||||||
dol_print_error($db,$resultPDF);
|
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||||
exit;
|
$mesg.='<br>'.$mailfile->error;
|
||||||
endif;
|
setEventMessages($mesg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve)
|
if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve)
|
||||||
{
|
{
|
||||||
@ -646,57 +664,86 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
|
// Send mail
|
||||||
|
|
||||||
|
// TO
|
||||||
|
$destinataire = new User($db);
|
||||||
|
$destinataire->fetch($object->fk_user_author);
|
||||||
|
$emailTo = $destinataire->email;
|
||||||
|
|
||||||
|
// FROM
|
||||||
|
$expediteur = new User($db);
|
||||||
|
$expediteur->fetch($object->fk_user_refuse);
|
||||||
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
|
// SUBJECT
|
||||||
|
$subject = $langs->transnoentities("ExpenseReportRefused");
|
||||||
|
|
||||||
|
// CONTENT
|
||||||
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
|
$message = $langs->transnoentities("ExpenseReportRefusedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_refuse'], $link);
|
||||||
|
|
||||||
|
// Rebuilt pdf
|
||||||
|
/*
|
||||||
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
|
if($resultPDF
|
||||||
|
{
|
||||||
|
// ATTACHMENT
|
||||||
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($mimetype,"application/pdf");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// PREPARE SEND
|
||||||
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
|
if ($mailfile)
|
||||||
{
|
{
|
||||||
// Send mail
|
// SEND
|
||||||
|
$result=$mailfile->sendfile();
|
||||||
// TO
|
if ($result)
|
||||||
$destinataire = new User($db);
|
|
||||||
$destinataire->fetch($object->fk_user_author);
|
|
||||||
$emailTo = $destinataire->email;
|
|
||||||
|
|
||||||
// FROM
|
|
||||||
$expediteur = new User($db);
|
|
||||||
$expediteur->fetch($object->fk_user_refuse);
|
|
||||||
$emailFrom = $expediteur->email;
|
|
||||||
|
|
||||||
// SUBJECT
|
|
||||||
$subject = "' ERP - Note de frais refusée";
|
|
||||||
|
|
||||||
// CONTENT
|
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
|
||||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être refusée.\n";
|
|
||||||
$message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Motif de refus : {$_POST['detail_refuse']}\n";
|
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
|
||||||
$message.= "Bien cordialement,\n' SI";
|
|
||||||
|
|
||||||
// PREPARE SEND
|
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message);
|
|
||||||
|
|
||||||
if(!$mailfile->error)
|
|
||||||
{
|
{
|
||||||
// SEND
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
||||||
$result=$mailfile->sendfile();
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
if ($result)
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("other");
|
||||||
|
if ($mailfile->error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs');
|
$mesg='';
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||||
exit;
|
$mesg.='<br>'.$mailfile->error;
|
||||||
|
setEventMessages($mesg, null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
|
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
||||||
}
|
}
|
||||||
// END - Send mail
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
//var_dump($user->id == $object->fk_user_validator);exit;
|
//var_dump($user->id == $object->fk_user_validator);exit;
|
||||||
if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer)
|
if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer)
|
||||||
@ -730,64 +777,85 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
|
// Send mail
|
||||||
|
|
||||||
|
// TO
|
||||||
|
$destinataire = new User($db);
|
||||||
|
$destinataire->fetch($object->fk_user_author);
|
||||||
|
$emailTo = $destinataire->email;
|
||||||
|
|
||||||
|
// FROM
|
||||||
|
$expediteur = new User($db);
|
||||||
|
$expediteur->fetch($object->fk_user_cancel);
|
||||||
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
|
// SUBJECT
|
||||||
|
$subject = $langs->transnoentities("ExpenseReportCanceled");
|
||||||
|
|
||||||
|
// CONTENT
|
||||||
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
|
$message = $langs->transnoentities("ExpenseReportCanceledMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_cancel'], $link);
|
||||||
|
|
||||||
|
// Rebuilt pdf
|
||||||
|
/*
|
||||||
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
|
if($resultPDF
|
||||||
|
{
|
||||||
|
// ATTACHMENT
|
||||||
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($mimetype,"application/pdf");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// PREPARE SEND
|
||||||
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
|
if ($mailfile)
|
||||||
{
|
{
|
||||||
// Send mail
|
// SEND
|
||||||
|
$result=$mailfile->sendfile();
|
||||||
// TO
|
if ($result)
|
||||||
$destinataire = new User($db);
|
|
||||||
$destinataire->fetch($object->fk_user_author);
|
|
||||||
$emailTo = $destinataire->email;
|
|
||||||
|
|
||||||
// FROM
|
|
||||||
$expediteur = new User($db);
|
|
||||||
$expediteur->fetch($object->fk_user_cancel);
|
|
||||||
$emailFrom = $expediteur->email;
|
|
||||||
|
|
||||||
// SUBJECT
|
|
||||||
$subject = "' ERP - Note de frais annulée";
|
|
||||||
|
|
||||||
// CONTENT
|
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
|
||||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être annulée.\n";
|
|
||||||
$message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n";
|
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
|
||||||
$message.= "Bien cordialement,\n' SI";
|
|
||||||
|
|
||||||
// PREPARE SEND
|
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message);
|
|
||||||
|
|
||||||
if(!$mailfile->error)
|
|
||||||
{
|
{
|
||||||
// SEND
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
||||||
$result=$mailfile->sendfile();
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
if ($result)
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
{
|
exit;
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg="Impossible d'envoyer l'email.";
|
|
||||||
setEventMessages($mesg, null, 'errors');
|
|
||||||
}
|
|
||||||
// END - Send mail
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($mail->error, $mail->errors, 'errors');
|
$langs->load("other");
|
||||||
|
if ($mailfile->error)
|
||||||
|
{
|
||||||
|
$mesg='';
|
||||||
|
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||||
|
$mesg.='<br>'.$mailfile->error;
|
||||||
|
setEventMessages($mesg, null, 'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("OnlyOwnerCanCancel"), '', 'errors'); // Should not happened
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,67 +932,82 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
|
// Send mail
|
||||||
|
|
||||||
|
// TO
|
||||||
|
$destinataire = new User($db);
|
||||||
|
$destinataire->fetch($object->fk_user_author);
|
||||||
|
$emailTo = $destinataire->email;
|
||||||
|
|
||||||
|
// FROM
|
||||||
|
$expediteur = new User($db);
|
||||||
|
$expediteur->fetch($user->id);
|
||||||
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
|
// SUBJECT
|
||||||
|
$subject = $langs->transnoentities("ExpenseReportPaid");
|
||||||
|
|
||||||
|
// CONTENT
|
||||||
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
|
$message = $langs->transnoentities("ExpenseReportPaidMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||||
|
|
||||||
|
// CONTENT
|
||||||
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
|
$message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n";
|
||||||
|
$message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||||
|
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
||||||
|
$message.= "Bien cordialement,\n' SI";
|
||||||
|
|
||||||
|
// Generate pdf before attachment
|
||||||
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
|
// PREPARE SEND
|
||||||
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
|
if ($mailfile)
|
||||||
{
|
{
|
||||||
// Send mail
|
|
||||||
|
|
||||||
// TO
|
|
||||||
$destinataire = new User($db);
|
|
||||||
$destinataire->fetch($object->fk_user_author);
|
|
||||||
$emailTo = $destinataire->email;
|
|
||||||
|
|
||||||
// FROM
|
|
||||||
$expediteur = new User($db);
|
|
||||||
$expediteur->fetch($user->id);
|
|
||||||
$emailFrom = $expediteur->email;
|
|
||||||
|
|
||||||
// SUBJECT
|
|
||||||
$subject = "'ERP - Note de frais payée";
|
|
||||||
|
|
||||||
// CONTENT
|
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
|
||||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n";
|
|
||||||
$message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
|
||||||
$message.= "Bien cordialement,\n' SI";
|
|
||||||
|
|
||||||
// Generate pdf before attachment
|
|
||||||
$object->setDocModel($user,"");
|
|
||||||
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
|
||||||
|
|
||||||
// PREPARE SEND
|
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message);
|
|
||||||
|
|
||||||
if(!$mailfile->error):
|
|
||||||
|
|
||||||
// SEND
|
// SEND
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result):
|
if ($result)
|
||||||
|
{
|
||||||
// Retour
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
||||||
if($result):
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
else:
|
}
|
||||||
dol_print_error($db);
|
else
|
||||||
endif;
|
{
|
||||||
|
$langs->load("other");
|
||||||
else:
|
if ($mailfile->error)
|
||||||
dol_print_error($db,$acct->error);
|
{
|
||||||
endif;
|
$mesg='';
|
||||||
|
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||||
else:
|
$mesg.='<br>'.$mailfile->error;
|
||||||
$mesg="Impossible d'envoyer l'email.";
|
setEventMessages($mesg, null, 'errors');
|
||||||
setEventMessages($mesg, null, 'errors');
|
}
|
||||||
endif;
|
else
|
||||||
// END - Send mail
|
{
|
||||||
|
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == "addline" && $user->rights->expensereport->creer)
|
if ($action == "addline" && $user->rights->expensereport->creer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,7 +21,17 @@ ListToApprove=Waiting for approval
|
|||||||
ExpensesArea=Expense reports area
|
ExpensesArea=Expense reports area
|
||||||
ClassifyRefunded=Classify 'Refunded'
|
ClassifyRefunded=Classify 'Refunded'
|
||||||
ExpenseReportWaitingForApproval=A new expense report has been submitted for approval
|
ExpenseReportWaitingForApproval=A new expense report has been submitted for approval
|
||||||
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n- User: %s\n- Period: %s\nClick here to validate: %s
|
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
|
||||||
|
ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval
|
||||||
|
ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.\nThe %s, you refused to approve the expense report for this reason: %s.\nA new version has been proposed and waiting for your approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
|
||||||
|
ExpenseReportApproved=An expense report was approved
|
||||||
|
ExpenseReportApprovedMessage=The expense report %s was approved.\n - User: %s\n - Approved by: %s\nClick here to show the expense report: %s
|
||||||
|
ExpenseReportRefused=An expense report was refused
|
||||||
|
ExpenseReportRefusedMessage=The expense report %s was refused.\n - User: %s\n - Refused by: %s\n - Motive for refusal: %s\nClick here to show the expense report: %s
|
||||||
|
ExpenseReportCanceled=An expense report was canceled
|
||||||
|
ExpenseReportCanceledMessage=The expense report %s was canceled.\n - User: %s\n - Canceled by: %s\n - Motive for cancellation: %s\nClick here to show the expense report: %s
|
||||||
|
ExpenseReportPaid=An expense report was paid
|
||||||
|
ExpenseReportPaidMessage=The expense report %s was paid.\n - User: %s\n - Paid by: %s\nClick here to show the expense report: %s
|
||||||
TripId=Id expense report
|
TripId=Id expense report
|
||||||
AnyOtherInThisListCanValidate=Person to inform for validation.
|
AnyOtherInThisListCanValidate=Person to inform for validation.
|
||||||
TripSociete=Information company
|
TripSociete=Information company
|
||||||
|
|||||||
@ -99,17 +99,7 @@ if (empty($reshook))
|
|||||||
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||||
$capital = price2num(GETPOST('capital'));
|
$capital = price2num(GETPOST('capital'));
|
||||||
|
|
||||||
if (! $datestart)
|
if (! $capital)
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
|
|
||||||
$action = 'create';
|
|
||||||
}
|
|
||||||
elseif (! $dateend)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
|
|
||||||
$action = 'create';
|
|
||||||
}
|
|
||||||
elseif (! $capital)
|
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -155,13 +145,31 @@ if (empty($reshook))
|
|||||||
if (! $cancel)
|
if (! $cancel)
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result > 0)
|
|
||||||
|
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
|
||||||
|
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||||
|
$capital = price2num(GETPOST('capital'));
|
||||||
|
|
||||||
|
if (! $capital)
|
||||||
{
|
{
|
||||||
$object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||||
$object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
$action = 'edit';
|
||||||
$object->capital = price2num(GETPOST("capital"));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$object->datestart = $datestart;
|
||||||
|
$object->dateend = $dateend;
|
||||||
|
$object->capital = $capital;
|
||||||
$object->nbterm = GETPOST("nbterm");
|
$object->nbterm = GETPOST("nbterm");
|
||||||
$object->rate = GETPOST("rate");
|
$object->rate = GETPOST("rate");
|
||||||
|
|
||||||
|
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
||||||
|
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
||||||
|
$accountancy_account_interest = GETPOST('accountancy_account_interest');
|
||||||
|
|
||||||
|
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
|
||||||
|
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
|
||||||
|
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
@ -255,21 +263,21 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Date Start
|
// Date Start
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
|
print '<td>'.$langs->trans("DateStart").'</td><td>';
|
||||||
print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1);
|
print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date End
|
// Date End
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
|
print '<td>'.$langs->trans("DateEnd").'</td><td>';
|
||||||
print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1);
|
print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Number of terms
|
// Number of terms
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Nbterms").'</td><td><input name="nbterm" size="5" value="' . GETPOST('nbterm') . '"></td></tr>';
|
print '<tr><td>'.$langs->trans("Nbterms").'</td><td><input name="nbterm" size="5" value="' . GETPOST('nbterm') . '"></td></tr>';
|
||||||
|
|
||||||
// Rate
|
// Rate
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . GETPOST("rate") . '"> %</td></tr>';
|
print '<tr><td>'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . GETPOST("rate") . '"> %</td></tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
@ -308,19 +316,19 @@ if ($action == 'create')
|
|||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
// Accountancy_account_capital
|
// Accountancy_account_capital
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccountancy->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1);
|
print $formaccountancy->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_account_insurance
|
// Accountancy_account_insurance
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccountancy->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
|
print $formaccountancy->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_account_interest
|
// Accountancy_account_interest
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1);
|
print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -328,17 +336,17 @@ if ($action == 'create')
|
|||||||
else // For external software
|
else // For external software
|
||||||
{
|
{
|
||||||
// Accountancy_account_capital
|
// Accountancy_account_capital
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
||||||
print '<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.'">';
|
print '<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_account_insurance
|
// Accountancy_account_insurance
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
||||||
print '<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.'">';
|
print '<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_account_interest
|
// Accountancy_account_interest
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
||||||
print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">';
|
print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -398,7 +406,7 @@ if ($id > 0)
|
|||||||
// 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, $user->rights->loan->write, '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, $user->rights->loan->write, 'string', '', null, null, '', 1);
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
@ -442,29 +450,10 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
/*
|
|
||||||
// Ref
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
|
||||||
print $form->showrefnav($object,'id');
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
// Label
|
|
||||||
if ($action == 'edit')
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>';
|
|
||||||
print '<input type="text" name="label" size="40" value="'.$object->label.'">';
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Capital
|
// Capital
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("LoanCapital").'</td><td>';
|
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("LoanCapital").'</td><td>';
|
||||||
print '<input name="capital" size="10" value="' . $object->capital . '"></td></tr>';
|
print '<input name="capital" size="10" value="' . $object->capital . '"></td></tr>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -500,19 +489,53 @@ if ($id > 0)
|
|||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Nbterms
|
// Nbterms
|
||||||
print '<tr><td>'.$langs->trans("Nbterms").'</td><td>'.$object->nbterm.'</td></tr>';
|
print '<tr><td">'.$langs->trans("Nbterms").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
print '<input name="nbterm" size="4" value="' . $object->nbterm . '">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $object->nbterm;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Rate
|
// Rate
|
||||||
print '<tr><td>'.$langs->trans("Rate").'</td><td>'.$object->rate.' %</td></tr>';
|
print '<tr><td">'.$langs->trans("Rate").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
print '<input name="rate" size="4" value="' . $object->rate . '">%';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $object->rate . '%';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy account capital
|
// Accountancy account capital
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print $langs->trans("LoanAccountancyCapitalCode");
|
print $langs->trans("LoanAccountancyCapitalCode");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if ($action == 'edit')
|
||||||
print length_accountg($object->account_capital);
|
{
|
||||||
} else {
|
if (! empty($conf->accounting->enabled))
|
||||||
print $object->account_capital;
|
{
|
||||||
|
print $formaccountancy->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input name="accountancy_account_capital" size="16" value="'.$object->account_capital.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($conf->accounting->enabled)) {
|
||||||
|
print length_accountg($object->account_capital);
|
||||||
|
} else {
|
||||||
|
print $object->account_capital;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -520,10 +543,24 @@ if ($id > 0)
|
|||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print $langs->trans("LoanAccountancyInsuranceCode");
|
print $langs->trans("LoanAccountancyInsuranceCode");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if ($action == 'edit')
|
||||||
print length_accountg($object->account_insurance);
|
{
|
||||||
} else {
|
if (! empty($conf->accounting->enabled))
|
||||||
print $object->account_insurance;
|
{
|
||||||
|
print $formaccountancy->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input name="accountancy_account_insurance" size="16" value="'.$object->account_insurance.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($conf->accounting->enabled)) {
|
||||||
|
print length_accountg($object->account_insurance);
|
||||||
|
} else {
|
||||||
|
print $object->account_insurance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -531,17 +568,27 @@ if ($id > 0)
|
|||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print $langs->trans("LoanAccountancyInterestCode");
|
print $langs->trans("LoanAccountancyInterestCode");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if ($action == 'edit')
|
||||||
print length_accountg($object->account_interest);
|
{
|
||||||
} else {
|
if (! empty($conf->accounting->enabled))
|
||||||
print $object->account_interest;
|
{
|
||||||
|
print $formaccountancy->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input name="accountancy_account_interest" size="16" value="'.$object->account_interest.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($conf->accounting->enabled)) {
|
||||||
|
print length_accountg($object->account_interest);
|
||||||
|
} else {
|
||||||
|
print $object->account_interest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Status
|
|
||||||
// print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user