develop_dict
This commit is contained in:
Regis Houssin 2017-06-14 12:16:10 +02:00
commit cd095e99c9
60 changed files with 1027 additions and 662 deletions

View File

@ -865,6 +865,7 @@ if ($mode == 'deploy')
print '<br>'; print '<br>';
} }
print '<br>';
if ($allowfromweb >= 0) if ($allowfromweb >= 0)
{ {
@ -885,12 +886,20 @@ if ($mode == 'deploy')
if ($allowfromweb == 1) if ($allowfromweb == 1)
{ {
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>'; print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">'; print '<input type="hidden" name="action" value="install">';
print '<input type="hidden" name="mode" value="deploy">'; print '<input type="hidden" name="mode" value="deploy">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> '; print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">'; print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>'; print '</form>';
print '<br>';
print '<br>';
print '<div class="center"><div class="logo_setup"></div></div>';
} }
else else
{ {

View File

@ -34,6 +34,9 @@ $langs->load("blockedlog");
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$showonlyerrors = GETPOST('showonlyerrors','int');
$block_static = new BlockedLog($db);
if($action === 'downloadblockchain') { if($action === 'downloadblockchain') {
@ -49,14 +52,57 @@ if($action === 'downloadblockchain') {
exit; exit;
} }
else if($action === 'downloadcsv') {
$res = $db->query("SELECT rowid,tms,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user
FROM ".MAIN_DB_PREFIX."blockedlog ORDER BY rowid ASC");
if($res) {
$signature = $block_static->getSignature();
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" .$signature. ".csv\"");
print $langs->transnoentities('Id')
.';'.$langs->transnoentities('Timestamp')
.';'.$langs->transnoentities('Action')
.';'.$langs->transnoentities('Amounts')
.';'.$langs->transnoentities('Element')
.';'.$langs->transnoentities('ObjectId')
.';'.$langs->transnoentities('Date')
.';'.$langs->transnoentities('Ref')
.';'.$langs->transnoentities('Fingerprint')
.';'.$langs->transnoentities('User')."\n";
while($obj = $db->fetch_object($res)) {
print $obj->rowid
.';'.$obj->tms
.';'.$obj->action
.';'.$obj->amounts
.';'.$obj->element
.';'.$obj->fk_object
.';'.$obj->date_object
.';'.$obj->ref_object
.';'.$obj->signature
.';'.$obj->fk_user."\n";
}
exit;
}
else{
setEventMessage($db->lasterror, 'errors');
}
}
/* /*
* View * View
*/ */
$block_static = new BlockedLog($db);
$blocks = $block_static->getLog('all', 0, GETPOST('all') ? 0 : 50); $blocks = $block_static->getLog('all', 0, GETPOST('all') ? 0 : 50);
$form=new Form($db); $form=new Form($db);
@ -74,8 +120,13 @@ print $langs->trans("FingerprintsDesc")."<br>\n";
print '<br>'; print '<br>';
echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a> | <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a></div>'; print '<div align="right">';
print ' <a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a>';
print ' | <a href="?all=1&showonlyerrors=1">'.$langs->trans('ShowAllFingerPrintsErrorsMightBeTooLong').'</a>';
print ' | <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a>';
print ' | <a href="?action=downloadcsv">'.$langs->trans('DownloadLogCSV').'</a>';
print ' </div>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -92,24 +143,30 @@ print '<td><span id="blockchainstatus"></span></td>';
print '</tr>'; print '</tr>';
foreach($blocks as &$block) { foreach($blocks as &$block) {
$checksignature = $block->checkSignature();
$object_link = $block->getObjectLink();
print '<tr class="oddeven">'; if(!$showonlyerrors || $block->error>0) {
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
print '<td>'.$block->ref_object.'</td>'; print '<tr class="oddeven">';
print '<td>'.$langs->trans('log'.$block->action).'</td>'; print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
print '<td>'.$block->getObject().'<a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>'; print '<td>'.$block->ref_object.'</td>';
print '<td align="right">'.price($block->amounts).'</td>'; print '<td>'.$langs->trans('log'.$block->action).'</td>';
print '<td>'.$block->getUser().'</td>'; print '<td>'.$object_link.'<a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
print '<td>'.$block->signature.'</td>'; print '<td align="right">'.price($block->amounts).'</td>';
print '<td>'; print '<td>'.$block->getUser().'</td>';
print '<td>'.$block->signature.'</td>';
print $block->checkSignature() ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off'); print '<td>';
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') ); print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off');
} if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
print '</td>'; print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
print '</tr>'; }
print '</td>';
print '</tr>';
}
} }
print '</table>'; print '</table>';
@ -121,7 +178,7 @@ $('a[rel=show-info]').click(function() {
$pop = $('<div id="pop-info"><table width="100%" class="border"><thead><th width="25%"><?php echo $langs->trans('Field') ?></th><th><?php echo $langs->trans('Value') ?></th></thead><tbody></tbody></table></div>'); $pop = $('<div id="pop-info"><table width="100%" class="border"><thead><th width="25%"><?php echo $langs->trans('Field') ?></th><th><?php echo $langs->trans('Value') ?></th></thead><tbody></tbody></table></div>');
$pop.dialog({ $pop.dialog({
title:"<?php echo $langs->trans('BlockedlogInfoDialog'); ?>" title:"<?php echo $langs->transnoentities('BlockedlogInfoDialog'); ?>"
,modal:true ,modal:true
,width:'80%' ,width:'80%'
}); });

View File

@ -78,6 +78,7 @@ class BlockedLog
public $object_data = null; public $object_data = null;
public $error = 0;
/** /**
* Constructor * Constructor
@ -91,9 +92,9 @@ class BlockedLog
} }
/** /**
* try to retrieve logged object * try to retrieve logged object link
*/ */
public function getObject() { public function getObjectLink() {
global $langs; global $langs;
if($this->element === 'facture') { if($this->element === 'facture') {
@ -103,6 +104,9 @@ class BlockedLog
if($object->fetch($this->fk_object)>0) { if($object->fetch($this->fk_object)>0) {
return $object->getNomUrl(1); return $object->getNomUrl(1);
} }
else{
$this->error++;
}
} }
else if($this->element === 'payment') { else if($this->element === 'payment') {
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
@ -111,6 +115,9 @@ class BlockedLog
if($object->fetch($this->fk_object)>0) { if($object->fetch($this->fk_object)>0) {
return $object->getNomUrl(1); return $object->getNomUrl(1);
} }
else{
$this->error++;
}
} }
return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object); return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object);
@ -388,8 +395,13 @@ class BlockedLog
$this->getSignatureRecursive(); $this->getSignatureRecursive();
return ($signature_to_test=== $this->signature); $res = ($signature_to_test === $this->signature);
if(!$res) {
$this->error++;
}
return $res;
} }
/** /**
@ -490,8 +502,7 @@ class BlockedLog
*/ */
private function getCurrentValue() { private function getCurrentValue() {
if($this->action === 'PAYMENT_CUSTOMER_CREATE' if($this->element === 'payment') {
|| $this->action === 'PAYMENT_ADD_TO_BANK') {
$sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiement WHERE rowid=".$this->fk_object; $sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiement WHERE rowid=".$this->fk_object;
$res = $this->db->query($sql); $res = $this->db->query($sql);
@ -500,7 +511,15 @@ class BlockedLog
$this->amounts = (double) $obj->amount; $this->amounts = (double) $obj->amount;
} }
} }
elseif($this->element === 'facture') {
$sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object;
$res = $this->db->query($sql);
if($res && $obj = $this->db->fetch_object($res)) {
$this->amounts = (double) $obj->total_ttc;
}
}
} }
/** /**

View File

@ -27,6 +27,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php';
$error=GETPOST('error');
// Test if already logged // Test if already logged
if ( $_SESSION['uid'] <= 0 ) if ( $_SESSION['uid'] <= 0 )
{ {
@ -54,9 +56,7 @@ print '<body>'."\n";
if (!empty($error)) if (!empty($error))
{ {
print $error; dol_htmloutput_events();
print '</body></html>';
exit;
} }
print '<div class="conteneur">'."\n"; print '<div class="conteneur">'."\n";

View File

@ -106,6 +106,14 @@ p {
padding-right: 5px; padding-right: 5px;
} }
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
.menu_choix0 {
max-width: 180px;
}
}
.menu_choix0 a { .menu_choix0 a {
font-weight: normal; font-weight: normal;
text-decoration: none; text-decoration: none;
@ -259,7 +267,6 @@ p.titre {
/* --------------------- Combo lists ------------------- */ /* --------------------- Combo lists ------------------- */
.select_design { .select_design {
width: 370px;
overflow: auto; overflow: auto;
} }

View File

@ -38,7 +38,7 @@ $langs->load("cashdesk");
<input type="hidden" name="hdnSource" value="NULL" /> <input type="hidden" name="hdnSource" value="NULL" />
<table> <table class="center">
<tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
<tr> <tr>
<!-- Affichage de la reference et de la designation --> <!-- Affichage de la reference et de la designation -->
@ -89,42 +89,32 @@ $langs->load("cashdesk");
</select> </select>
</td> </td>
</tr> </tr>
<tr><td><div id="resultats_dhtml"></div></td></tr>
</table> </table>
</form> </form>
<form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();"> <form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<table> <table class="center">
<tr><th><?php echo $langs->trans("Qty"); ?></th> <tr>
<th><?php echo $langs->trans("Stock"); ?></th> <th><?php echo $langs->trans("Qty"); ?></th>
<th><?php echo $langs->trans("PriceUHT"); ?></th> <th><?php echo $langs->trans("PriceUHT"); ?></th>
<th></th>
<th><?php echo $langs->trans("Discount"); ?> (%)</th> <th><?php echo $langs->trans("Discount"); ?> (%)</th>
<th><?php echo $langs->trans("TotalHT"); ?></th>
<th>&nbsp;</th>
<th><?php echo $langs->trans("VATRate"); ?></th> <th><?php echo $langs->trans("VATRate"); ?></th>
<th></th>
</tr> </tr>
<tr> <tr>
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" /> <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtQte", "frmQte");?> <?php print genkeypad("txtQte", "frmQte");?>
</td>
<!-- Affichage du stock pour l'article courant -->
<td>
<input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
</td> </td>
<!-- Show unit price --> <!-- Show unit price -->
<?php // TODO Remove the disabled and use this value when adding product into cart ?> <?php // TODO Remove the disabled and use this value when adding product into cart ?>
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td> <td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
<td></td>
<!-- Choix de la remise --> <!-- Choix de la remise -->
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/> <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
<?php print genkeypad("txtRemise", "frmQte");?> <?php print genkeypad("txtRemise", "frmQte");?>
</td> </td>
<!-- Affichage du total HT -->
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
<!-- Choix du taux de TVA --> <!-- Choix du taux de TVA -->
<td class="select_tva"> <td class="select_tva center">
<?php <?php
$vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected $vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
@ -133,7 +123,20 @@ $langs->load("cashdesk");
echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1); echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
?> ?>
</td> </td>
<td></td>
</tr> </tr>
<tr>
<!-- Affichage du stock pour l'article courant -->
<tr>
<td><?php echo $langs->trans("Stock"); ?></td>
<td>
<input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
</td>
<td><?php echo $langs->trans("TotalHT"); ?></td>
<!-- Affichage du total HT -->
<td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
</tr>
</table> </table>
<input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" /> <input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
@ -149,13 +152,13 @@ $langs->load("cashdesk");
<tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr>
<tr> <tr>
<!-- Affichage du montant du --> <!-- Affichage du montant du -->
<td><input class="texte2_off maxwidthonsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled /></td> <td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled /></td>
<!-- Choix du montant encaisse --> <!-- Choix du montant encaisse -->
<td><input class="texte2 maxwidthonsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" /> <td><input class="texte2 maxwidth100onsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtEncaisse", "frmDifference");?> <?php print genkeypad("txtEncaisse", "frmDifference");?>
</td> </td>
<!-- Affichage du montant rendu --> <!-- Affichage du montant rendu -->
<td><input class="texte2_off maxwidthonsmartphone" type="text" name="txtRendu" value="0" disabled /></td> <td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtRendu" value="0" disabled /></td>
</tr> </tr>
<tr> <tr>
</table> </table>

View File

@ -79,10 +79,11 @@ print '</form>';
/*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>'; /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>'; print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/ print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/
print '<div class="clearboth">';
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
{ {
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink; print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
} }
print '</li></ul>'; print '</div></li></ul>';
print '</div>'; print '</div>';
print "\n".'<!-- menu.tpl.php end -->'."\n"; print "\n".'<!-- menu.tpl.php end -->'."\n";

View File

@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$obj_facturation = unserialize($_SESSION['serObjFacturation']); $obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset ($_SESSION['serObjFacturation']);
$action =GETPOST('action','aZ09'); $action =GETPOST('action','aZ09');
$bankaccountid=GETPOST('cashdeskbank'); $bankaccountid=GETPOST('cashdeskbank');
@ -129,7 +128,7 @@ switch ($action)
exit; exit;
} }
switch ( $obj_facturation->getSetPaymentMode() ) switch ($obj_facturation->getSetPaymentMode() )
{ {
case 'DIF': case 'DIF':
$mode_reglement_id = 0; $mode_reglement_id = 0;
@ -159,7 +158,6 @@ switch ($action)
$note .= $_POST['txtaNotes']; $note .= $_POST['txtaNotes'];
dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id); dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
$error=0; $error=0;
@ -255,14 +253,15 @@ switch ($action)
} }
else else
{ {
$error++; setEventMessage($invoice->error, $invoice->errors, 'errors');
$error++;
} }
$id = $invoice->id; $id = $invoice->id;
} }
else else
{ {
$resultcreate=$invoice->create($user,0,0); $resultcreate=$invoice->create($user,0,0);
if ($resultcreate > 0) if ($resultcreate > 0)
{ {
$warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0);
@ -287,7 +286,8 @@ switch ($action)
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref));
else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref));
if ($result < 0) { if ($result < 0) {
$error++; setEventMessages($mouvP->error, $mouvP->errors, 'errors');
$error++;
} }
} }
} }
@ -331,15 +331,18 @@ switch ($action)
} }
else else
{ {
$error++; setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
} }
} }
else else
{ {
$error++; setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
} }
} }
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
@ -348,14 +351,14 @@ switch ($action)
else else
{ {
$db->rollback(); $db->rollback();
$redirection = 'affIndex.php?facid='.$id.'&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr $redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
} }
break; break;
// End of case: valide_facture // End of case: valide_facture
} }
unset ($_SESSION['serObjFacturation']);
$_SESSION['serObjFacturation'] = serialize($obj_facturation); $_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -161,7 +161,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
} }
} }
$object = new Propal($db); // To be passed as parameter of executeHooks that need $object = new Propal($db); // To be passed as parameter of executeHooks that need
/* /*
@ -359,12 +359,12 @@ if ($resql)
else else
{ {
$title = $langs->trans('ListOfProposals'); $title = $langs->trans('ListOfProposals');
} }
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param='&viewstatut='.$viewstatut; $param='&viewstatut='.$viewstatut;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@ -389,7 +389,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
@ -398,7 +398,7 @@ if ($resql)
if ($user->rights->propal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->propal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -408,13 +408,13 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails"); $langs->load("mails");
if (! GETPOST('cancel')) if (! GETPOST('cancel'))
{ {
$objecttmp=new Propal($db); $objecttmp=new Propal($db);
@ -433,17 +433,17 @@ if ($resql)
} }
} }
} }
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
dol_fiche_head(null, '', ''); dol_fiche_head(null, '', '');
$topicmail="SendSupplierProposalRef"; $topicmail="SendSupplierProposalRef";
$modelmail="supplier_proposal_send"; $modelmail="supplier_proposal_send";
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
@ -496,25 +496,25 @@ if ($resql)
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']=''; $formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param['action']=$action; $formmail->param['action']=$action;
$formmail->param['models']=$modelmail; $formmail->param['models']=$modelmail;
$formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['id']=join(',',$arrayofselected); $formmail->param['id']=join(',',$arrayofselected);
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form(); print $formmail->get_form();
dol_fiche_end(); dol_fiche_end();
} }
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
$i = 0; $i = 0;
$moreforfilter=''; $moreforfilter='';
@ -525,7 +525,7 @@ if ($resql)
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -533,7 +533,7 @@ if ($resql)
{ {
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view products // If the user can view products
@ -550,7 +550,7 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
@ -561,12 +561,12 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
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";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
@ -608,7 +608,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Date // Date
if (! empty($arrayfields['p.date']['checked'])) if (! empty($arrayfields['p.date']['checked']))
{ {
print '<td class="liste_titre" colspan="1" align="center">'; print '<td class="liste_titre" colspan="1" align="center">';
//print $langs->trans('Month').': '; //print $langs->trans('Month').': ';
@ -620,7 +620,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Date end // Date end
if (! empty($arrayfields['p.fin_validite']['checked'])) if (! empty($arrayfields['p.fin_validite']['checked']))
{ {
print '<td class="liste_titre" colspan="1">&nbsp;</td>'; print '<td class="liste_titre" colspan="1">&nbsp;</td>';
} }
@ -703,10 +703,10 @@ if ($resql)
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
// Fields title // Fields title
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
@ -726,9 +726,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -744,24 +744,24 @@ if ($resql)
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>'."\n"; print '</tr>'."\n";
$now = dol_now(); $now = dol_now();
$i=0; $i=0;
$totalarray=array(); $totalarray=array();
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$objectstatic->id=$obj->rowid; $objectstatic->id=$obj->rowid;
$objectstatic->ref=$obj->ref; $objectstatic->ref=$obj->ref;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
@ -790,11 +790,11 @@ if ($resql)
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['p.ref_client']['checked'])) if (! empty($arrayfields['p.ref_client']['checked']))
{ {
// Customer ref // Customer ref
@ -803,12 +803,12 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
$companystatic->id=$obj->socid; $companystatic->id=$obj->socid;
$companystatic->name=$obj->name; $companystatic->name=$obj->name;
$companystatic->client=$obj->client; $companystatic->client=$obj->client;
$companystatic->code_client=$obj->code_client; $companystatic->code_client=$obj->code_client;
// Thirdparty // Thirdparty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -817,7 +817,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Town // Town
if (! empty($arrayfields['s.town']['checked'])) if (! empty($arrayfields['s.town']['checked']))
{ {
@ -858,7 +858,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date proposal // Date proposal
if (! empty($arrayfields['p.date']['checked'])) if (! empty($arrayfields['p.date']['checked']))
{ {
@ -867,7 +867,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date end validity // Date end validity
if (! empty($arrayfields['p.fin_validite']['checked'])) if (! empty($arrayfields['p.fin_validite']['checked']))
{ {
@ -882,7 +882,7 @@ if ($resql)
} }
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Amount HT // Amount HT
if (! empty($arrayfields['p.total_ht']['checked'])) if (! empty($arrayfields['p.total_ht']['checked']))
{ {
@ -907,7 +907,7 @@ if ($resql)
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc; $totalarray['totalttc'] += $obj->total_ttc;
} }
$userstatic->id=$obj->fk_user_author; $userstatic->id=$obj->fk_user_author;
$userstatic->login=$obj->login; $userstatic->login=$obj->login;
@ -920,7 +920,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
@ -1008,16 +1008,16 @@ if ($resql)
} }
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</table>'."\n"; print '</table>'."\n";
print '</div>'."\n"; print '</div>'."\n";
print '</form>'."\n"; print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{ {
/* /*
@ -1025,18 +1025,18 @@ if ($resql)
*/ */
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->propal->lire; $genallowed=$user->rights->propal->lire;
$delallowed=$user->rights->propal->lire; $delallowed=$user->rights->propal->lire;
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'',''); print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
} }
else else
{ {
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
} }
} }
else else
{ {

View File

@ -803,7 +803,7 @@ if ($resql)
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view other users // If the user can view other users
@ -811,7 +811,7 @@ if ($resql)
{ {
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -821,7 +821,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();

View File

@ -3429,7 +3429,7 @@ else if ($id > 0 || ! empty($ref))
print $object->situation_counter; print $object->situation_counter;
print '</td>'; print '</td>';
print '<td align="right" class="nowrap">'; print '<td class="nowrap">';
$prevsits_total_amount = 0; $prevsits_total_amount = 0;
foreach ($prevsits as $situation) { foreach ($prevsits as $situation) {
@ -3437,9 +3437,9 @@ else if ($id > 0 || ! empty($ref))
} }
$prevsits_total_amount += $object->total_ht; $prevsits_total_amount += $object->total_ht;
print price($prevsits_total_amount); print price($prevsits_total_amount, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
print '</td>';
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>'; print '</td></tr>';
// Previous situation(s) deduction(s) // Previous situation(s) deduction(s)
for ($i = 0; $i < $cprevsits; $i++) { for ($i = 0; $i < $cprevsits; $i++) {
@ -3450,10 +3450,9 @@ else if ($id > 0 || ! empty($ref))
print $prevsits[$i]->situation_counter; print $prevsits[$i]->situation_counter;
print '</a></td>'; print '</a></td>';
print '<td align="right" class="nowrap">'; print '<td class="nowrap">';
print '- ' . price($prevsits[$i]->total_ht); print '- ' . price($prevsits[$i]->total_ht, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
print '</td>'; print '</td></tr>';
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
} }
} }
} }

View File

@ -191,7 +191,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Do we click on purge search criteria ? // Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // All tests are required to be compatible with all browsers
{ {
$search_user=''; $search_user='';
$search_sale=''; $search_sale='';
@ -213,7 +213,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
$search_state=""; $search_state="";
$search_type=''; $search_type='';
$search_country=''; $search_country='';
$search_type_thirdparty=''; $search_type_thirdparty='';
$day=''; $day='';
$year=''; $year='';
$month=''; $month='';
@ -239,17 +239,17 @@ if (empty($reshook))
if ($massaction == 'withdrawrequest') if ($massaction == 'withdrawrequest')
{ {
$langs->load("withdrawals"); $langs->load("withdrawals");
if (!$user->rights->prelevement->bons->creer) if (!$user->rights->prelevement->bons->creer)
{ {
$error++; $error++;
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
} }
else else
{ {
//Checking error //Checking error
$error = 0; $error = 0;
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$listofbills=array(); $listofbills=array();
foreach($arrayofselected as $toselectid) foreach($arrayofselected as $toselectid)
@ -274,7 +274,7 @@ if ($massaction == 'withdrawrequest')
$error++; $error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors'); setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');
} }
$rsql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; $rsql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$rsql .= " , pfd.date_traite as date_traite"; $rsql .= " , pfd.date_traite as date_traite";
$rsql .= " , pfd.amount"; $rsql .= " , pfd.amount";
@ -291,7 +291,7 @@ if ($massaction == 'withdrawrequest')
{ {
$numprlv = $db->num_rows($result_sql); $numprlv = $db->num_rows($result_sql);
} }
if($numprlv>0){ if($numprlv>0){
$error++; $error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'errors'); setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'errors');
@ -300,7 +300,7 @@ if ($massaction == 'withdrawrequest')
$error++; $error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors'); setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors');
} }
} }
} }
@ -327,13 +327,13 @@ if ($massaction == 'withdrawrequest')
if ($nbwithdrawrequestok > 0) if ($nbwithdrawrequestok > 0)
{ {
setEventMessages($langs->trans("WithdrawRequestsDone", $nbwithdrawrequestok), null, 'mesgs'); setEventMessages($langs->trans("WithdrawRequestsDone", $nbwithdrawrequestok), null, 'mesgs');
} }
} }
} }
} }
/* /*
* View * View
@ -350,7 +350,7 @@ llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factur
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.rowid as id, f.facnumber as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
@ -360,7 +360,7 @@ $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name"; $sql.= " state.code_departement as state_code, state.nom as state_name";
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed'; if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks // Add fields from hooks
@ -424,7 +424,7 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1); if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1);
if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1); if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '' && $search_status >= 0) if ($search_status != '' && $search_status >= 0)
{ {
@ -577,7 +577,7 @@ if ($resql)
$langs->load("withdrawals"); $langs->load("withdrawals");
$arrayofmassactions['withdrawrequest']=$langs->trans("MakeWithdrawRequest"); $arrayofmassactions['withdrawrequest']=$langs->trans("MakeWithdrawRequest");
} }
if ($user->rights->facture->supprimer) if ($user->rights->facture->supprimer)
{ {
//if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) //if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
@ -608,8 +608,8 @@ if ($resql)
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails"); $langs->load("mails");
if (! GETPOST('cancel')) if (! GETPOST('cancel'))
{ {
$objecttmp=new Facture($db); $objecttmp=new Facture($db);
$listofselectedid=array(); $listofselectedid=array();
@ -618,7 +618,7 @@ if ($resql)
foreach($arrayofselected as $toselectid) foreach($arrayofselected as $toselectid)
{ {
$result=$objecttmp->fetch($toselectid); $result=$objecttmp->fetch($toselectid);
if ($result > 0) if ($result > 0)
{ {
$listofselectedid[$toselectid]=$toselectid; $listofselectedid[$toselectid]=$toselectid;
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
@ -629,10 +629,10 @@ if ($resql)
} }
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
dol_fiche_head(null, '', ''); dol_fiche_head(null, '', '');
$topicmail="SendBillRef"; $topicmail="SendBillRef";
@ -700,7 +700,7 @@ if ($resql)
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form(); print $formmail->get_form();
dol_fiche_end(); dol_fiche_end();
} }
@ -709,7 +709,7 @@ if ($resql)
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
$moreforfilter=''; $moreforfilter='';
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
@ -717,7 +717,7 @@ if ($resql)
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -725,7 +725,7 @@ if ($resql)
{ {
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -735,7 +735,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
@ -753,7 +753,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
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";
@ -788,7 +788,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Date invoice // Date invoice
if (! empty($arrayfields['f.date']['checked'])) if (! empty($arrayfields['f.date']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
@ -797,7 +797,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Date due // Date due
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">';
@ -812,7 +812,7 @@ if ($resql)
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_project" value="'.$search_project.'"></td>'; print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_project" value="'.$search_project.'"></td>';
} }
// Thirpdarty // Thirpdarty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>'; print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
} }
@ -842,7 +842,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Payment mode // Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10); $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
@ -987,8 +987,8 @@ if ($resql)
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
if ($num > 0) if ($num > 0)
{ {
$i=0; $i=0;
@ -998,8 +998,8 @@ if ($resql)
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$datelimit=$db->jdate($obj->datelimite); $datelimit=$db->jdate($obj->datelimite);
$facturestatic->id=$obj->facid; $facturestatic->id=$obj->id;
$facturestatic->ref=$obj->facnumber; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut; $facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
@ -1011,28 +1011,28 @@ if ($resql)
$totaldeposits = $facturestatic->getSumDepositsUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits; $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay; $remaintopay = $obj->total_ttc - $totalpay;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.facnumber']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $facturestatic->getNomUrl(1,'',200,0,'',0,1); print $facturestatic->getNomUrl(1,'',200,0,'',0,1);
print empty($obj->increment)?'':' ('.$obj->increment.')'; print empty($obj->increment)?'':' ('.$obj->increment.')';
print '</td>'; print '</td>';
print '<td style="min-width: 20px" class="nobordernopadding nowrap">'; print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
$filename=dol_sanitizeFileName($obj->facnumber); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->facid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->id;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -1089,7 +1089,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -1256,18 +1256,18 @@ if ($resql)
print "</td>"; print "</td>";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Action column // Action column
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{ {
$selected=0; $selected=0;
if (in_array($obj->facid, $arrayofselected)) $selected=1; if (in_array($obj->id, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>'; print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected?' checked="checked"':'').'>';
} }
print '</td>' ; print '</td>' ;
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
@ -1303,31 +1303,31 @@ if ($resql)
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }
} }
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{ {
// Show list of available documents // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire; $genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->lire;
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
} }
else else

View File

@ -305,7 +305,7 @@ if ($resql)
$i = 0; $i = 0;
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@ -323,7 +323,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
@ -332,7 +332,7 @@ if ($resql)
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -341,7 +341,7 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit); print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
if ($sall) if ($sall)
@ -349,16 +349,16 @@ if ($resql)
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
$moreforfilter=''; $moreforfilter='';
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
{ {
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user,0,1,'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user,0,1,'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view other users // If the user can view other users
@ -366,7 +366,7 @@ if ($resql)
{ {
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view categories of products // If the user can view categories of products
@ -376,15 +376,15 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
@ -395,7 +395,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
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";
@ -514,7 +514,7 @@ if ($resql)
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder); if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder); if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
@ -530,9 +530,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -558,12 +558,12 @@ if ($resql)
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$contracttmp->ref=$obj->ref; $contracttmp->ref=$obj->ref;
$contracttmp->id=$obj->rowid; $contracttmp->id=$obj->rowid;
$contracttmp->ref_customer=$obj->ref_customer; $contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier; $contracttmp->ref_supplier=$obj->ref_supplier;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
@ -578,15 +578,15 @@ if ($resql)
} }
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['c.ref_customer']['checked'])) if (! empty($arrayfields['c.ref_customer']['checked']))
{ {
print '<td>'.$obj->ref_customer.'</td>'; print '<td>'.$obj->ref_customer.'</td>';
} }
if (! empty($arrayfields['c.ref_supplier']['checked'])) if (! empty($arrayfields['c.ref_supplier']['checked']))
{ {
print '<td>'.$obj->ref_supplier.'</td>'; print '<td>'.$obj->ref_supplier.'</td>';
} }
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>'; print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
} }
@ -629,7 +629,7 @@ if ($resql)
print $typenArray[$obj->typent_code]; print $typenArray[$obj->typent_code];
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['sale_representative']['checked'])) if (! empty($arrayfields['sale_representative']['checked']))
{ {
// Sales representatives // Sales representatives
@ -713,7 +713,7 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Status // Status
if (! empty($arrayfields['status']['checked'])) if (! empty($arrayfields['status']['checked']))
{ {
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>'; print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>'; print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
@ -730,7 +730,7 @@ if ($resql)
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
@ -738,7 +738,7 @@ if ($resql)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} }
else else

View File

@ -309,10 +309,11 @@ class FormOther
* @param string $htmlname Name of combo list * @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized" * @param int $nocateg Show also an entry "Not categorized"
* @param int $showempty Add also an empty line * @param int $showempty Add also an empty line
* @return string Html combo list code * @param string $morecss More CSS
* @return string Html combo list code
* @see select_all_categories * @see select_all_categories
*/ */
function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0,$showempty=1) function select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='')
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@ -328,18 +329,16 @@ class FormOther
$tab_categs = $static_categs->get_full_arbo($type); $tab_categs = $static_categs->get_full_arbo($type);
$moreforfilter = ''; $moreforfilter = '';
$nodatarole = '';
// Enhance with select2 // Enhance with select2
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox('select_categ_'.$htmlname); $comboenhancement = ajax_combobox('select_categ_'.$htmlname);
$moreforfilter.=$comboenhancement; $moreforfilter.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
// Print a select with each of them // Print a select with each of them
$moreforfilter.='<select class="flat minwidth100" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $moreforfilter.='<select class="flat minwidth100'.($morecss?' '.$morecss:'').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $moreforfilter.='<option value="0">&nbsp;</option>'; // Should use -1 to say nothing if ($showempty) $moreforfilter.='<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs)) if (is_array($tab_categs))
@ -379,7 +378,6 @@ class FormOther
$langs->load('users'); $langs->load('users');
$out = ''; $out = '';
$nodatarole = '';
// Enhance with select2 // Enhance with select2
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
@ -389,11 +387,10 @@ class FormOther
if ($comboenhancement) if ($comboenhancement)
{ {
$out.=$comboenhancement; $out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
} }
// Select each sales and print them in a select input // Select each sales and print them in a select input
$out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $out.='<option value="0">&nbsp;</option>'; if ($showempty) $out.='<option value="0">&nbsp;</option>';
// Get list of users allowed to be viewed // Get list of users allowed to be viewed

View File

@ -39,8 +39,11 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php'; require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
$langs->load("main"); $langs->load("main");
$langs->load("agenda"); $langs->load("agenda");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');

View File

@ -8,7 +8,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
} }
// Add extra fields // Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')'; $sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')';
//print $sql; //print $sql;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
@ -42,10 +42,23 @@ if ($resql) // This can fail when class is used on old database (during migra
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
break; break;
} }
if ($obj->type!='separate') { if ($obj->type!='separate')
$this->export_fields_array[$r][$fieldname]=$fieldlabel; {
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter; // If not a computed field
$this->export_entities_array[$r][$fieldname]=$keyforelement; if (empty($obj->fieldcomputed))
{
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]=$keyforelement;
}
// If this is a computed field
else
{
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter.'Compute';
$this->export_special_array[$r][$fieldname]=$obj->fieldcomputed;
$this->export_entities_array[$r][$fieldname]=$keyforelement;
}
} }
} }
} }

View File

@ -47,6 +47,8 @@ if (! defined('DISABLE_SELECT2')) define('DISABLE_SELECT2',1);
require_once '../main.inc.php'; require_once '../main.inc.php';
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
$langs->load("main"); $langs->load("main");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
@ -123,7 +125,7 @@ print '
} }
li.lilevel3:last-child { li.lilevel3:last-child {
padding-bottom: 10px; padding-bottom: 10px;
} }
a.alilevel0, li.lilevel1 a { a.alilevel0, li.lilevel1 a {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
@ -131,7 +133,7 @@ print '
display: block; display: block;
} }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("body ul").click(function(){ $("body ul").click(function(){
@ -145,12 +147,12 @@ $(document).ready(function(){
$(\'html, body\').animate({ $(\'html, body\').animate({
scrollTop: target.offset().top scrollTop: target.offset().top
}, 300); }, 300);
}) })
}); });
</script> </script>
'; ';
if (empty($user->societe_id)) // If internal user or not defined if (empty($user->societe_id)) // If internal user or not defined
{ {

View File

@ -1891,6 +1891,12 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed=1; if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed=1;
$original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu supplier invoice
elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output))
{
if ($fuser->rights->expensereport->{$lire}) $accessallowed=1;
$original_file=$conf->expensereport->dir_output.'/'.$original_file;
}
// Wrapping pour les images des stats propales // Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp))
{ {

View File

@ -414,6 +414,9 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
case 'intcomma': case 'intcomma':
if (preg_match('/[^0-9,]+/i',$out)) $out=''; if (preg_match('/[^0-9,]+/i',$out)) $out='';
break; break;
case 'intcomma':
if (preg_match('/[^0-9,]+/i',$out)) $out='';
break;
case 'alpha': case 'alpha':
$out=trim($out); $out=trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
@ -758,7 +761,7 @@ function dol_string_unaccent($str)
*/ */
function dol_string_nospecial($str,$newstr='_',$badcharstoreplace='') function dol_string_nospecial($str,$newstr='_',$badcharstoreplace='')
{ {
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); $forbidden_chars_to_replace=array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=");
$forbidden_chars_to_remove=array(); $forbidden_chars_to_remove=array();
if (is_array($badcharstoreplace)) $forbidden_chars_to_replace=$badcharstoreplace; if (is_array($badcharstoreplace)) $forbidden_chars_to_replace=$badcharstoreplace;
//$forbidden_chars_to_remove=array("(",")"); //$forbidden_chars_to_remove=array("(",")");
@ -1158,14 +1161,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (class_exists("Imagick")) if (class_exists("Imagick"))
{ {
if ($object->element == 'propal') $modulepart='propal'; if ($object->element == 'propal') $modulepart='propal';
if ($object->element == 'commande') $modulepart='commande'; if ($object->element == 'commande') $modulepart='commande';
if ($object->element == 'facture') $modulepart='facture'; if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter'; if ($object->element == 'fichinter') $modulepart='ficheinter';
if ($object->element == 'contrat') $modulepart='contract'; if ($object->element == 'contrat') $modulepart='contract';
if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal'; if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal';
if ($object->element == 'order_supplier') $modulepart='supplier_order'; if ($object->element == 'order_supplier') $modulepart='supplier_order';
if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice'; if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice';
if ($object->element == 'expensereport') $modulepart='expensereport';
} }
if ($object->element == 'product') if ($object->element == 'product')
@ -1195,7 +1199,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{ {
$phototoshow=''; $phototoshow='';
// Check if a preview file is available // Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice')) && class_exists("Imagick")) if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick"))
{ {
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->$modulepart->dir_output . "/"; $dir_output = $conf->$modulepart->dir_output . "/";

View File

@ -166,8 +166,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Accountancy - Supplier invoice -- Accountancy - Supplier invoice
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'accountancy', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'accountancy', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&amp;leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&amp;leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/impayees.php?leftmenu=suppliers_bills', 'Unpaid', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'List', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'accountancy', '', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
-- Accountancy - Customer invoice -- Accountancy - Customer invoice
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
@ -275,9 +276,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Account - Categories -- Bank - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2650__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2650__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?leftmenu=bank&amp;type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2651__+MAX_llx_menu__, 'accountancy', '', 2650__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2651__+MAX_llx_menu__, 'accountancy', '', 2650__+MAX_llx_menu__, '/categories/card.php?leftmenu=bank&amp;action=create&amp;type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Project -- Project
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&amp;action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&amp;action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
@ -287,8 +288,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
-- Project - Categories -- Project - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);

View File

@ -54,20 +54,20 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
if (empty($noout)) print_start_menu_array_auguria(); if (empty($noout)) print_start_menu_array_auguria();
$usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)); $usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
// Show/Hide vertical menu // Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$showmode=1; $showmode=1;
$classname = 'class="tmenu menuhider"'; $classname = 'class="tmenu menuhider"';
$idsel='menu'; $idsel='menu';
if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry_auguria('', 1, '#', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry_auguria('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry_auguria($showmode); if (empty($noout)) print_end_menu_entry_auguria($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", ''); $menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
} }
$num = count($newTabMenu); $num = count($newTabMenu);
for($i = 0; $i < $num; $i++) for($i = 0; $i < $num; $i++)
{ {
@ -77,7 +77,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
if ($showmode == 1) if ($showmode == 1)
{ {
$url = $shorturl = $newTabMenu[$i]['url']; $url = $shorturl = $newTabMenu[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
{ {
$tmp=explode('?',$newTabMenu[$i]['url'],2); $tmp=explode('?',$newTabMenu[$i]['url'],2);
@ -85,11 +85,11 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$param = (isset($tmp[1])?$tmp[1]:''); $param = (isset($tmp[1])?$tmp[1]:'');
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url']))
{ {
$param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu='; $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu=';
} }
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url']))
{ {
$param.=($param?'&':'').'leftmenu='; $param.=($param?'&':'').'leftmenu=';
} }
@ -110,7 +110,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
if ($search_project_user) $shorturl=preg_replace('/search_project_user=__search_project_user__/', 'search_project_user='.$search_project_user, $shorturl); if ($search_project_user) $shorturl=preg_replace('/search_project_user=__search_project_user__/', 'search_project_user='.$search_project_user, $shorturl);
else $shorturl=preg_replace('/search_project_user=__search_project_user__/', '', $shorturl); else $shorturl=preg_replace('/search_project_user=__search_project_user__/', '', $shorturl);
} }
// Define the class (top menu selected or not) // Define the class (top menu selected or not)
if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"';
else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"'; else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"';
@ -144,7 +144,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
function print_start_menu_array_auguria() function print_start_menu_array_auguria()
{ {
global $conf; global $conf;
print '<div class="tmenudiv">'; print '<div class="tmenudiv">';
print '<ul class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'':' title="Top menu"').'>'; print '<ul class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'':' title="Top menu"').'>';
} }
@ -258,7 +258,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)); $usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
global $usemenuhider; global $usemenuhider;
// Show logo company // Show logo company
if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
@ -292,7 +292,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print '</div>'."\n"; print '</div>'."\n";
print "<!-- End SearchForm -->\n"; print "<!-- End SearchForm -->\n";
} }
// We update newmenu with entries found into database // We update newmenu with entries found into database
$menuArbo = new Menubase($db,'auguria'); $menuArbo = new Menubase($db,'auguria');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu); $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
@ -300,6 +300,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
// We update newmenu for special dynamic menus // We update newmenu for special dynamic menus
if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account
{ {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required for to get Account::TYPE_CASH for example
$sql = "SELECT rowid, label, courant, rappro, courant"; $sql = "SELECT rowid, label, courant, rappro, courant";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
@ -409,7 +411,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
for($j = ($i + 1); $j < $num; $j++) for($j = ($i + 1); $j < $num; $j++)
{ {
if (empty($menu_array[$j]['level'])) $lastopened=false; if (empty($menu_array[$j]['level'])) $lastopened=false;
} }
if ($altok % 2 == 0) if ($altok % 2 == 0)
{ {
print '<div class="blockvmenuimpair'.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n"; print '<div class="blockvmenuimpair'.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
@ -470,10 +472,12 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
// Menu level > 0 // Menu level > 0
if ($menu_array[$i]['level'] > 0) if ($menu_array[$i]['level'] > 0)
{ {
$cssmenu = '';
if ($menu_array[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/','',$menu_array[$i]['url']));
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled. if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
{ {
print '<div class="menu_contenu">'.$tabstring; print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
//print $lastlevel0;
if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'; if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
else print '<span class="vsmenu">'; else print '<span class="vsmenu">';
print $menu_array[$i]['titre']; print $menu_array[$i]['titre'];
@ -485,7 +489,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
} }
else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled. else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled.
{ {
print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n"; print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
} }
} }
@ -497,7 +501,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
if ($blockvmenuopened) { print '</div>'."\n"; $blockvmenuopened=false; } if ($blockvmenuopened) { print '</div>'."\n"; $blockvmenuopened=false; }
} }
} }
if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block
} }
@ -510,7 +514,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print '</div>'."\n"; print '</div>'."\n";
print "<!-- End Bookmarks -->\n"; print "<!-- End Bookmarks -->\n";
} }
return count($menu_array); return count($menu_array);
} }

View File

@ -811,7 +811,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&amp;search_status=2",$langs->trans("BillShortStatusPaid"),2,$user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&amp;search_status=2",$langs->trans("BillShortStatusPaid"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&amp;search_status=3",$langs->trans("BillShortStatusCanceled"),2,$user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&amp;search_status=3",$langs->trans("BillShortStatusCanceled"),2,$user->rights->facture->lire);
} }
$newmenu->add("/compta/facture/fiche-rec.php",$langs->trans("ListOfTemplates"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/fiche-rec.php",$langs->trans("ListOfTemplates"),1,$user->rights->facture->creer); // No need to see recurring invoices, if user has no permission to create invoice.
$newmenu->add("/compta/paiement/list.php",$langs->trans("Payments"),1,$user->rights->facture->lire); $newmenu->add("/compta/paiement/list.php",$langs->trans("Payments"),1,$user->rights->facture->lire);
@ -1322,9 +1322,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("Activities"), 0, $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("NewTimeSpent"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire);
// All project i have permission on // All project i have permission on
/*$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire); /*$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
@ -1650,10 +1651,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Menu level > 0 // Menu level > 0
if ($menu_array[$i]['level'] > 0) if ($menu_array[$i]['level'] > 0)
{ {
$cssmenu = '';
if ($menu_array[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/','',$menu_array[$i]['url']));
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled. if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
{ {
print '<div class="menu_contenu">'.$tabstring; print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
//print $lastlevel0;
if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'; if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
else print '<span class="vsmenu">'; else print '<span class="vsmenu">';
print $menu_array[$i]['titre']; print $menu_array[$i]['titre'];
@ -1665,7 +1668,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
} }
else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled. else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled.
{ {
print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n"; print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
} }
} }

View File

@ -82,7 +82,7 @@ class MenuManager
{ {
return 1; return 1;
} }
if ($mode == 'top' || $mode == 'jmobile') if ($mode == 'top' || $mode == 'jmobile')
{ {
if (empty($noout)) print_start_menu_array_empty(); if (empty($noout)) print_start_menu_array_empty();
@ -98,13 +98,13 @@ class MenuManager
$showmode=1; $showmode=1;
$classname = 'class="tmenu menuhider"'; $classname = 'class="tmenu menuhider"';
$idsel='menu'; $idsel='menu';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", ''); $menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
} }
if (empty($noout)) print_start_menu_entry_empty($idsel, $classname, $showmode); if (empty($noout)) print_start_menu_entry_empty($idsel, $classname, $showmode);
if (empty($noout)) print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $this->atarget); if (empty($noout)) print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $this->atarget);
if (empty($noout)) print_end_menu_entry_empty($showmode); if (empty($noout)) print_end_menu_entry_empty($showmode);
@ -201,8 +201,12 @@ class MenuManager
print '<div class="menu_top"></div>'."\n"; print '<div class="menu_top"></div>'."\n";
} }
if ($this->menu->liste[$i]['level'] > 0) { if ($this->menu->liste[$i]['level'] > 0)
print '<div class="menu_contenu">'; {
$cssmenu = '';
if ($this->menu->liste[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/','',$this->menu->liste[$i]['url']));
print '<div class="menu_contenu'.$cssmenu.'">';
if ($this->menu->liste[$i]['enabled']) if ($this->menu->liste[$i]['enabled'])
{ {
@ -229,7 +233,7 @@ class MenuManager
print "</div>\n"; print "</div>\n";
} }
} }
if ($altok) print '<div class="blockvmenuend"></div>'; if ($altok) print '<div class="blockvmenuend"></div>';
} }
@ -308,7 +312,7 @@ class MenuManager
function print_start_menu_array_empty() function print_start_menu_array_empty()
{ {
global $conf; global $conf;
print '<div class="tmenudiv">'; print '<div class="tmenudiv">';
print '<ul class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'':' title="Top menu"').'>'; print '<ul class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'':' title="Top menu"').'>';
} }

View File

@ -215,6 +215,9 @@ class DolibarrModules // Can not be abstract, because we need to insta
*/ */
public $descriptionlong; public $descriptionlong;
// For exports
/** /**
* @var string Module export code * @var string Module export code
*/ */
@ -225,6 +228,19 @@ class DolibarrModules // Can not be abstract, because we need to insta
*/ */
public $export_label; public $export_label;
public $export_permission;
public $export_fields_array;
public $export_TypeFields_array;
public $export_entities_array;
public $export_special_array; // special or computed field
public $export_dependencies_array;
public $export_sql_start;
public $export_sql_end;
public $export_sql_order;
// For import
/** /**
* @var string Module import code * @var string Module import code
*/ */
@ -235,6 +251,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
*/ */
public $import_label; public $import_label;
/** /**
* @var string Module constant name * @var string Module constant name
*/ */
@ -343,6 +360,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
public $hidden = false; public $hidden = false;
/** /**
* Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* *

View File

@ -116,14 +116,14 @@ class modProjet extends DolibarrModules
$this->const[$r][3] = ""; $this->const[$r][3] = "";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
$this->const[$r][0] = "PROJECT_USE_OPPORTUNITIES"; $this->const[$r][0] = "PROJECT_USE_OPPORTUNITIES";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "1"; $this->const[$r][2] = "1";
$this->const[$r][3] = ""; $this->const[$r][3] = "";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
$this->const[$r][0] = "MAIN_DELAY_PROJECT_TO_CLOSE"; $this->const[$r][0] = "MAIN_DELAY_PROJECT_TO_CLOSE";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "7"; $this->const[$r][2] = "7";
@ -136,7 +136,7 @@ class modProjet extends DolibarrModules
$this->const[$r][3] = ""; $this->const[$r][3] = "";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
// Boxes // Boxes
$this->boxes = array(); $this->boxes = array();
$r=0; $r=0;
@ -207,7 +207,7 @@ class modProjet extends DolibarrModules
//------- //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager. $this->menu = 1; // This module add menu entries. They are coded into menu manager.
//Exports //Exports
//-------- //--------
$r=1; $r=1;
@ -240,15 +240,16 @@ class modProjet extends DolibarrModules
unset($this->export_fields_array[$r]['p.opp_amount']); unset($this->export_fields_array[$r]['p.opp_amount']);
unset($this->export_fields_array[$r]['cls.code']); unset($this->export_fields_array[$r]['cls.code']);
} }
// Add fields for project // Add fields for project
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
// Add extra fields for project
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// Add fields for tasks // Add fields for tasks
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'RefTask','pt.label'=>'LabelTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription")); $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'RefTask','pt.label'=>'LabelTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask','pt.label'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask")); $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask','pt.label'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask"));
// Add extra fields // Add extra fields for task
$keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2'; $keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields // End add extra fields
@ -264,8 +265,8 @@ class modProjet extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity; $this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity;
// Import list of tasks // Import list of tasks
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
@ -297,7 +298,7 @@ class modProjet extends DolibarrModules
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); $this->import_regex_array[$r]=array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
$this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note"); $this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note");
} }
} }

View File

@ -35,7 +35,10 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
require_once '../main.inc.php'; require_once '../main.inc.php';
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
$langs->load("main"); $langs->load("main");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
@ -75,11 +78,11 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
else else
{ {
$conf->global->MAIN_HTML5_PLACEHOLDER = 1; $conf->global->MAIN_HTML5_PLACEHOLDER = 1;
$usedbyinclude = 1; // Used into next include $usedbyinclude = 1; // Used into next include
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
$accesskeyalreadyassigned=array(); $accesskeyalreadyassigned=array();
foreach($arrayresult as $key => $val) foreach($arrayresult as $key => $val)
{ {

View File

@ -51,7 +51,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
return 0; return 0;
} }
if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED') { if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' || $action === 'BILL_SENTBYMAIL') {
$amounts= (double) $object->total_ttc; $amounts= (double) $object->total_ttc;
} }
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') { else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') {

View File

@ -127,7 +127,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
/* /*
* Actions * Actions
*/ */
if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (GETPOST('cancel')) { $action='list'; $massaction=''; }
@ -320,7 +320,7 @@ if ($resql)
$title = $langs->trans("ListTripsAndExpenses"); $title = $langs->trans("ListTripsAndExpenses");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
@ -333,7 +333,7 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
@ -344,10 +344,10 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
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";
// Filters // Filters
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['d.ref']['checked'])) if (! empty($arrayfields['d.ref']['checked']))
@ -362,7 +362,7 @@ if ($resql)
if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous) if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous)
{ {
print '<td class="liste_titre maxwidthonspartphone" align="left">'; print '<td class="liste_titre maxwidthonspartphone" align="left">';
print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
print '</td>'; print '</td>';
} else { } else {
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -452,7 +452,7 @@ if ($resql)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Status // Status
if (! empty($arrayfields['d.fk_statut']['checked'])) if (! empty($arrayfields['d.fk_statut']['checked']))
{ {
@ -498,7 +498,7 @@ if ($resql)
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.fk_statut']['checked'])) print_liste_field_titre($arrayfields['d.fk_statut']['label'],$_SERVER["PHP_SELF"],"d.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['d.fk_statut']['checked'])) print_liste_field_titre($arrayfields['d.fk_statut']['label'],$_SERVER["PHP_SELF"],"d.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$total_total_ht = 0; $total_total_ht = 0;
$total_total_ttc = 0; $total_total_ttc = 0;
@ -527,8 +527,8 @@ if ($resql)
$expensereportstatic->date_approve=$db->jdate($obj->date_approve); $expensereportstatic->date_approve=$db->jdate($obj->date_approve);
$expensereportstatic->note_private=$obj->note_private; $expensereportstatic->note_private=$obj->note_private;
$expensereportstatic->note_public=$obj->note_public; $expensereportstatic->note_public=$obj->note_public;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
if (! empty($arrayfields['d.ref']['checked'])) { if (! empty($arrayfields['d.ref']['checked'])) {
@ -615,7 +615,7 @@ if ($resql)
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc; $totalarray['totalttc'] += $obj->total_ttc;
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
@ -723,11 +723,11 @@ if ($resql)
// Show list of available documents // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->expensereport->lire; $genallowed=$user->rights->expensereport->lire;
$delallowed=$user->rights->expensereport->lire; $delallowed=$user->rights->expensereport->lire;
print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
} }
else else

View File

@ -38,6 +38,7 @@ class Export
var $array_export_sql_start=array(); // Tableau des "requetes sql" var $array_export_sql_start=array(); // Tableau des "requetes sql"
var $array_export_sql_end=array(); // Tableau des "requetes sql" var $array_export_sql_end=array(); // Tableau des "requetes sql"
var $array_export_sql_order=array(); // Tableau des "requetes sql" var $array_export_sql_order=array(); // Tableau des "requetes sql"
var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
var $array_export_TypeFields=array(); // Tableau des listes de champ+Type de filtre var $array_export_TypeFields=array(); // Tableau des listes de champ+Type de filtre
var $array_export_FilterValue=array(); // Tableau des listes de champ+Valeur a filtrer var $array_export_FilterValue=array(); // Tableau des listes de champ+Valeur a filtrer
@ -45,7 +46,7 @@ class Export
var $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export var $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
var $array_export_special=array(); // Tableau des operations speciales sur champ var $array_export_special=array(); // Tableau des operations speciales sur champ
var $array_export_examplevalues=array(); // array with examples var $array_export_examplevalues=array(); // array with examples
// To store export modules // To store export modules
var $hexa; var $hexa;
var $hexafiltervalue; var $hexafiltervalue;
@ -178,7 +179,7 @@ class Export
$this->array_export_special[$i]=(! empty($module->export_special_array[$r])?$module->export_special_array[$r]:''); $this->array_export_special[$i]=(! empty($module->export_special_array[$r])?$module->export_special_array[$r]:'');
// Array of examples // Array of examples
$this->array_export_examplevalues[$i]=$module->export_examplevalues_array[$r]; $this->array_export_examplevalues[$i]=$module->export_examplevalues_array[$r];
// Requete sql du dataset // Requete sql du dataset
$this->array_export_sql_start[$i]=$module->export_sql_start[$r]; $this->array_export_sql_start[$i]=$module->export_sql_start[$r];
$this->array_export_sql_end[$i]=$module->export_sql_end[$r]; $this->array_export_sql_end[$i]=$module->export_sql_end[$r];
@ -246,7 +247,7 @@ class Export
} }
$sql.=$sqlWhere; $sql.=$sqlWhere;
} }
// Add the order // Add the order
$sql.=$this->array_export_sql_order[$indice]; $sql.=$this->array_export_sql_order[$indice];
@ -259,7 +260,7 @@ class Export
if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
} }
} }
return $sql; return $sql;
} }
@ -281,7 +282,7 @@ class Export
if (! (strpos($ValueField, '%') === false)) if (! (strpos($ValueField, '%') === false))
$szFilterQuery.=" ".$NameField." LIKE '".$ValueField."'"; $szFilterQuery.=" ".$NameField." LIKE '".$ValueField."'";
else else
$szFilterQuery.=" ".$NameField."='".$ValueField."'"; $szFilterQuery.=" ".$NameField." = '".$ValueField."'";
break; break;
case 'Date': case 'Date':
if (strpos($ValueField, "+") > 0) if (strpos($ValueField, "+") > 0)
@ -325,8 +326,12 @@ class Export
case 'List': case 'List':
if (is_numeric($ValueField)) if (is_numeric($ValueField))
$szFilterQuery=" ".$NameField."=".$ValueField; $szFilterQuery=" ".$NameField."=".$ValueField;
else else {
$szFilterQuery=" ".$NameField."='".$ValueField."'"; if (! (strpos($ValueField, '%') === false))
$szFilterQuery=" ".$NameField." LIKE '".$ValueField."'";
else
$szFilterQuery=" ".$NameField." = '".$ValueField."'";
}
break; break;
default: default:
dol_syslog("Error we try to forge an sql export request with a condition on a field with type '".$InfoFieldList[0]."' (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERR); dol_syslog("Error we try to forge an sql export request with a condition on a field with type '".$InfoFieldList[0]."' (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERR);
@ -589,10 +594,8 @@ class Export
$var=true; $var=true;
while ($objp = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
// Process special operations // Process special operations
if (! empty($this->array_export_special[$indice])) if (! empty($this->array_export_special[$indice]))
{ {
@ -604,14 +607,14 @@ class Export
{ {
//$alias=$this->array_export_alias[$indice][$key]; //$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-','(',')'),'_',$key); $alias=str_replace(array('.', '-','(',')'),'_',$key);
if ($objp->$alias < 0) $objp->$alias=''; if ($obj->$alias < 0) $obj->$alias='';
} }
// Operation ZEROIFNEG // Operation ZEROIFNEG
elseif ($this->array_export_special[$indice][$key]=='ZEROIFNEG') elseif ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
{ {
//$alias=$this->array_export_alias[$indice][$key]; //$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-','(',')'),'_',$key); $alias=str_replace(array('.', '-','(',')'),'_',$key);
if ($objp->$alias < 0) $objp->$alias='0'; if ($obj->$alias < 0) $obj->$alias='0';
} }
// Operation INVOICEREMAINTOPAY // Operation INVOICEREMAINTOPAY
elseif ($this->array_export_special[$indice][$key]=='getRemainToPay') elseif ($this->array_export_special[$indice][$key]=='getRemainToPay')
@ -619,29 +622,34 @@ class Export
//$alias=$this->array_export_alias[$indice][$key]; //$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-','(',')'),'_',$key); $alias=str_replace(array('.', '-','(',')'),'_',$key);
$remaintopay=''; $remaintopay='';
if ($objp->f_rowid > 0) if ($obj->f_rowid > 0)
{ {
global $tmpobjforcomputecall; global $tmpobjforcomputecall;
if (! is_object($tmpobjforcomputecall)) if (! is_object($tmpobjforcomputecall))
{ {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$tmpobjforcomputecall=new Facture($this->db); $tmpobjforcomputecall=new Facture($this->db);
} }
$tmpobjforcomputecall->id = $objp->f_rowid; $tmpobjforcomputecall->id = $obj->f_rowid;
$tmpobjforcomputecall->total_ttc = $objp->f_total_ttc; $tmpobjforcomputecall->total_ttc = $obj->f_total_ttc;
$remaintopay=$tmpobjforcomputecall->getRemainToPay(); $remaintopay=$tmpobjforcomputecall->getRemainToPay();
} }
$objp->$alias=$remaintopay; $obj->$alias=$remaintopay;
} }
else else
{ {
$this->error='Operation '.$this->array_export_special[$indice][$key].' not supported.'; // TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field
$computestring=$this->array_export_special[$indice][$key];
$tmp=dol_eval($computestring, 1, 0);
$obj->$alias=$tmp;
$this->error="ERROPNOTSUPPORTED. Operation ".$this->array_export_special[$indice][$key]." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
return -1; return -1;
} }
} }
} }
// end of special operation processing // end of special operation processing
$objmodel->write_record($array_selected,$objp,$outputlangs,$this->array_export_TypeFields[$indice]); $objmodel->write_record($array_selected,$obj,$outputlangs,$this->array_export_TypeFields[$indice]);
} }
// Genere en-tete // Genere en-tete
@ -732,7 +740,7 @@ class Export
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->model_name = $obj->label; $this->model_name = $obj->label;
$this->datatoexport = $obj->type; $this->datatoexport = $obj->type;
$this->hexa = $obj->field; $this->hexa = $obj->field;
$this->hexafiltervalue = $obj->filter; $this->hexafiltervalue = $obj->filter;

View File

@ -168,7 +168,7 @@ if ($action=='selectfield') // Selection of field at step 2
$warnings=array(); $warnings=array();
$array_selected[$field]=count($array_selected)+1; // We tag the key $field as "selected" $array_selected[$field]=count($array_selected)+1; // We tag the key $field as "selected"
// We check if there is a dependency to activate // We check if there is a dependency to activate
/*var_dump($field); /*var_dump($field);
var_dump($fieldsentitiesarray[$field]); var_dump($fieldsentitiesarray[$field]);
var_dump($fieldsdependenciesarray);*/ var_dump($fieldsdependenciesarray);*/
@ -187,7 +187,7 @@ if ($action=='selectfield') // Selection of field at step 2
if (is_array($tmp)) $listofdependencies=$tmp; if (is_array($tmp)) $listofdependencies=$tmp;
else $listofdependencies=array($tmp); else $listofdependencies=array($tmp);
} }
if (count($listofdependencies)) if (count($listofdependencies))
{ {
foreach($listofdependencies as $fieldid) foreach($listofdependencies as $fieldid)
@ -270,7 +270,7 @@ if ($action == 'builddoc')
{ {
@ini_set("max_execution_time", $max_execution_time_for_export); // This work only if safe mode is off. also web servers has timeout of 300 @ini_set("max_execution_time", $max_execution_time_for_export); // This work only if safe mode is off. also web servers has timeout of 300
} }
// Build export file // Build export file
$result=$objexport->build_file($user, GETPOST('model','alpha'), $datatoexport, $array_selected, $array_filtervalue); $result=$objexport->build_file($user, GETPOST('model','alpha'), $datatoexport, $array_selected, $array_filtervalue);
if ($result < 0) if ($result < 0)
@ -535,9 +535,9 @@ if ($step == 2 && $datatoexport)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<br>'; print '<br>';
// Combo list of export models // Combo list of export models
@ -561,7 +561,7 @@ if ($step == 2 && $datatoexport)
print '<td>'.$langs->trans("ExportableFields").'</td>'; print '<td>'.$langs->trans("ExportableFields").'</td>';
print '<td width="100" align="center">'; print '<td width="100" align="center">';
print '<a class="liste_titre" title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field=all">'.$langs->trans("All")."</a>"; print '<a class="liste_titre" title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field=all">'.$langs->trans("All")."</a>";
print '/'; print ' / ';
print '<a class="liste_titre" title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field=all">'.$langs->trans("None")."</a>"; print '<a class="liste_titre" title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field=all">'.$langs->trans("None")."</a>";
print '</td>'; print '</td>';
print '<td width="44%">'.$langs->trans("ExportedFields").'</td>'; print '<td width="44%">'.$langs->trans("ExportedFields").'</td>';
@ -585,7 +585,7 @@ if ($step == 2 && $datatoexport)
foreach($fieldsarray as $code=>$label) foreach($fieldsarray as $code=>$label)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$i++; $i++;
@ -597,7 +597,7 @@ if ($step == 2 && $datatoexport)
print '<td class="nowrap">'; print '<td class="nowrap">';
// If value of entityicon=entitylang='icon:Label' // If value of entityicon=entitylang='icon:Label'
//print $code.'-'.$label.'-'.$entity; //print $code.'-'.$label.'-'.$entity;
$tmparray=explode(':',$entityicon); $tmparray=explode(':',$entityicon);
if (count($tmparray) >=2) if (count($tmparray) >=2)
{ {
@ -606,7 +606,9 @@ if ($step == 2 && $datatoexport)
} }
print img_object('',$entityicon).' '.$langs->trans($entitylang); print img_object('',$entityicon).' '.$langs->trans($entitylang);
print '</td>'; print '</td>';
$text=$langs->trans($label);
$text=(empty($objexport->array_export_special[0][$code])?'':'<i>').$langs->trans($label).(empty($objexport->array_export_special[0][$code])?'':'</i>');
$tablename=getablenamefromfield($code,$sqlmaxforexport); $tablename=getablenamefromfield($code,$sqlmaxforexport);
$htmltext ='<b>'.$langs->trans("Name").":</b> ".$text.'<br>'; $htmltext ='<b>'.$langs->trans("Name").":</b> ".$text.'<br>';
if (! empty($objexport->array_export_special[0][$code])) if (! empty($objexport->array_export_special[0][$code]))
@ -617,11 +619,16 @@ if ($step == 2 && $datatoexport)
{ {
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>"; $htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>";
} }
if (! empty($objexport->array_export_examplevalues[0][$code])) if (! empty($objexport->array_export_examplevalues[0][$code]))
{ {
$htmltext.=$langs->trans("SourceExample").': <b>'.$objexport->array_export_examplevalues[0][$code].'</b><br>'; $htmltext.=$langs->trans("SourceExample").': <b>'.$objexport->array_export_examplevalues[0][$code].'</b><br>';
} }
if (isset($array_selected[$code]) && $array_selected[$code]) if (! empty($objexport->array_export_TypeFields[0][$code]))
{
$htmltext.=$langs->trans("Type").': <b>'.$objexport->array_export_TypeFields[0][$code].'</b><br>';
}
if (isset($array_selected[$code]) && $array_selected[$code])
{ {
// Selected fields // Selected fields
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
@ -649,7 +656,7 @@ if ($step == 2 && $datatoexport)
print '</table>'; print '</table>';
/* /*
* Barre d'action * Barre d'action
*/ */
@ -740,7 +747,7 @@ if ($step == 3 && $datatoexport)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
// Combo list of export models // Combo list of export models
@ -772,7 +779,6 @@ if ($step == 3 && $datatoexport)
// on boucle sur les champs // on boucle sur les champs
foreach($fieldsarray as $code => $label) foreach($fieldsarray as $code => $label)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$i++; $i++;
@ -794,15 +800,27 @@ if ($step == 3 && $datatoexport)
// Field name // Field name
$labelName=(! empty($fieldsarray[$code])?$fieldsarray[$code]:''); $labelName=(! empty($fieldsarray[$code])?$fieldsarray[$code]:'');
$ValueFilter=(! empty($array_filtervalue[$code])?$array_filtervalue[$code]:''); $ValueFilter=(! empty($array_filtervalue[$code])?$array_filtervalue[$code]:'');
$text=$langs->trans($labelName); $text=(empty($objexport->array_export_special[0][$code])?'':'<i>').$langs->trans($labelName).(empty($objexport->array_export_special[0][$code])?'':'</i>');
$tablename=getablenamefromfield($code,$sqlmaxforexport); $tablename=getablenamefromfield($code,$sqlmaxforexport);
$htmltext ='<b>'.$langs->trans("Name").':</b> '.$text.'<br>'; $htmltext ='<b>'.$langs->trans("Name").':</b> '.$text.'<br>';
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>"; if (! empty($objexport->array_export_special[0][$code]))
{
$htmltext.='<b>'.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." :</b> ".$objexport->array_export_special[0][$code]."<br>";
}
else
{
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>";
}
if (! empty($objexport->array_export_examplevalues[0][$code])) if (! empty($objexport->array_export_examplevalues[0][$code]))
{ {
$htmltext.=$langs->trans("SourceExample").': <b>'.$objexport->array_export_examplevalues[0][$code].'</b><br>'; $htmltext.=$langs->trans("SourceExample").': <b>'.$objexport->array_export_examplevalues[0][$code].'</b><br>';
} }
if (! empty($objexport->array_export_TypeFields[0][$code]))
{
$htmltext.=$langs->trans("Type").': <b>'.$objexport->array_export_TypeFields[0][$code].'</b><br>';
}
print '<td>'; print '<td>';
print $form->textwithpicto($text,$htmltext); print $form->textwithpicto($text,$htmltext);
print '</td>'; print '</td>';
@ -849,7 +867,7 @@ if ($step == 4 && $datatoexport)
header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport);
exit; exit;
} }
asort($array_selected); asort($array_selected);
llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones'); llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
@ -937,7 +955,7 @@ if ($step == 4 && $datatoexport)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
// Select request if all fields are selected // Select request if all fields are selected
@ -957,7 +975,6 @@ if ($step == 4 && $datatoexport)
$var=true; $var=true;
foreach($array_selected as $code=>$value) foreach($array_selected as $code=>$value)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]); $entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
@ -975,15 +992,30 @@ if ($step == 4 && $datatoexport)
print img_object('',$entityicon).' '.$langs->trans($entitylang); print img_object('',$entityicon).' '.$langs->trans($entitylang);
print '</td>'; print '</td>';
print '<td>'; $labelName=$objexport->array_export_fields[0][$code];
$text=$langs->trans($objexport->array_export_fields[0][$code]);
$text=(empty($objexport->array_export_special[0][$code])?'':'<i>').$langs->trans($labelName).(empty($objexport->array_export_special[0][$code])?'':'</i>');
$tablename=getablenamefromfield($code,$sqlmaxforexport); $tablename=getablenamefromfield($code,$sqlmaxforexport);
$htmltext ='<b>'.$langs->trans("Name").":</b> ".$text.'<br>'; $htmltext ='<b>'.$langs->trans("Name").':</b> '.$text.'<br>';
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>"; if (! empty($objexport->array_export_special[0][$code]))
if (! empty($objexport->array_export_examplevalues[0][$code])) {
{ $htmltext.='<b>'.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." :</b> ".$objexport->array_export_special[0][$code]."<br>";
$htmltext.=$langs->trans("SourceExample").': <b>'.$objexport->array_export_examplevalues[0][$code].'</b><br>'; }
} else
{
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>";
}
if (! empty($objexport->array_export_examplevalues[0][$code]))
{
$htmltext.=$langs->trans("SourceExample").': <b>'.$objexport->array_export_examplevalues[0][$code].'</b><br>';
}
if (! empty($objexport->array_export_TypeFields[0][$code]))
{
$htmltext.=$langs->trans("Type").': <b>'.$objexport->array_export_TypeFields[0][$code].'</b><br>';
}
print '<td>';
print $form->textwithpicto($text,$htmltext); print $form->textwithpicto($text,$htmltext);
//print ' ('.$code.')'; //print ' ('.$code.')';
print '</td>'; print '</td>';
@ -1056,7 +1088,7 @@ if ($step == 4 && $datatoexport)
$var=false; $var=false;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $obj->label; print $obj->label;
@ -1085,7 +1117,7 @@ if ($step == 5 && $datatoexport)
header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport);
exit; exit;
} }
asort($array_selected); asort($array_selected);
llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones'); llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
@ -1135,7 +1167,7 @@ if ($step == 5 && $datatoexport)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
// Module // Module
@ -1186,7 +1218,7 @@ if ($step == 5 && $datatoexport)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
print $langs->trans("NowClickToGenerateToBuildExportFile").'<br>'; print $langs->trans("NowClickToGenerateToBuildExportFile").'<br>';
@ -1210,7 +1242,7 @@ if ($step == 5 && $datatoexport)
unset($liste[$key]); unset($liste[$key]);
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="16">'.img_picto_common($key,$objmodelexport->getPictoForKey($key)).'</td>'; print '<td width="16">'.img_picto_common($key,$objmodelexport->getPictoForKey($key)).'</td>';
$text=$objmodelexport->getDriverDescForKey($key); $text=$objmodelexport->getDriverDescForKey($key);
@ -1222,7 +1254,7 @@ if ($step == 5 && $datatoexport)
print '</div>'; print '</div>';
print '<table width="100%">'; print '<table width="100%">';
if ($sqlusedforexport && $user->admin) if ($sqlusedforexport && $user->admin)
@ -1233,7 +1265,7 @@ if ($step == 5 && $datatoexport)
} }
print '</table>'; print '</table>';
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
if (! is_dir($conf->export->dir_temp)) dol_mkdir($conf->export->dir_temp); if (! is_dir($conf->export->dir_temp)) dol_mkdir($conf->export->dir_temp);
@ -1243,7 +1275,7 @@ if ($step == 5 && $datatoexport)
print $formfile->showdocuments('export','',$upload_dir,$_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1); print $formfile->showdocuments('export','',$upload_dir,$_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div></div></div>'; print '</div></div></div>';
} }
@ -1265,11 +1297,11 @@ function getablenamefromfield($code,$sqlmaxforexport)
{ {
$alias=preg_replace('/\.(.*)$/i','',$code); // Keep only 'Alias' and remove '.Fieldname' $alias=preg_replace('/\.(.*)$/i','',$code); // Keep only 'Alias' and remove '.Fieldname'
$regexstring='/([a-zA-Z_]+) as '.preg_quote($alias).'[, \)]/i'; $regexstring='/([a-zA-Z_]+) as '.preg_quote($alias).'[, \)]/i';
$newsql=$sqlmaxforexport; $newsql=$sqlmaxforexport;
$newsql=preg_replace('/^(.*) FROM /i','',$newsql); // Remove part before the FROM $newsql=preg_replace('/^(.*) FROM /i','',$newsql); // Remove part before the FROM
$newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // Remove part after the WHERE so we have now only list of table aliases in a string. We must keep the ' ' before WHERE $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // Remove part after the WHERE so we have now only list of table aliases in a string. We must keep the ' ' before WHERE
if (preg_match($regexstring,$newsql,$reg)) if (preg_match($regexstring,$newsql,$reg))
{ {
return $reg[1]; // The tablename return $reg[1]; // The tablename

View File

@ -2634,19 +2634,29 @@ elseif (! empty($object->id))
// Create bill // Create bill
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // 2 means accepted if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled
{ {
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
} }
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier']))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
} }
}
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) // statut 2 means approved
{
if (empty($conf->facture->enabled))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
else if (!empty($object->linkedObjectsIds['invoice_supplier']))
{
if ($user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
}
} }
// Create a remote order using WebService only if module is activated // Create a remote order using WebService only if module is activated

View File

@ -218,7 +218,7 @@ if (empty($reshook))
$toselect=''; $toselect='';
$search_project_ref=''; $search_project_ref='';
$search_array_options=array(); $search_array_options=array();
// Mass actions // Mass actions
$objectclass='Commande'; $objectclass='Commande';
$objectlabel='Orders'; $objectlabel='Orders';
@ -235,54 +235,54 @@ if (empty($reshook))
$permtodelete = $user->rights->fournisseur->commande->supprimer; $permtodelete = $user->rights->fournisseur->commande->supprimer;
$uploaddir = $conf->fournisseur->commande->dir_output; $uploaddir = $conf->fournisseur->commande->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// TODO Move this into mass action include // TODO Move this into mass action include
if ($massaction == 'confirm_createbills') if ($massaction == 'confirm_createbills')
{ {
$orders = GETPOST('toselect'); $orders = GETPOST('toselect');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int'); $validate_invoices = GETPOST('valdate_invoices', 'int');
$TFact = array(); $TFact = array();
$TFactThird = array(); $TFactThird = array();
$nb_bills_created = 0; $nb_bills_created = 0;
$db->begin(); $db->begin();
foreach($orders as $id_order) { foreach($orders as $id_order) {
$cmd = new Commande($db); $cmd = new Commande($db);
if($cmd->fetch($id_order) <= 0) continue; if($cmd->fetch($id_order) <= 0) continue;
$object = new Facture($db); $object = new Facture($db);
if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
else { else {
$object->socid = $cmd->socid; $object->socid = $cmd->socid;
$object->type = Facture::TYPE_STANDARD; $object->type = Facture::TYPE_STANDARD;
$object->cond_reglement_id = $cmd->cond_reglement_id; $object->cond_reglement_id = $cmd->cond_reglement_id;
$object->mode_reglement_id = $cmd->mode_reglement_id; $object->mode_reglement_id = $cmd->mode_reglement_id;
$object->fk_project = $cmd->fk_project; $object->fk_project = $cmd->fk_project;
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) if (empty($datefacture))
{ {
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
} }
$object->date = $datefacture; $object->date = $datefacture;
$object->origin = 'commande'; $object->origin = 'commande';
$object->origin_id = $id_order; $object->origin_id = $id_order;
$res = $object->create($user); $res = $object->create($user);
if($res > 0) $nb_bills_created++; if($res > 0) $nb_bills_created++;
} }
if($object->id > 0) { if($object->id > 0) {
$db->begin(); $db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql.= "fk_source"; $sql.= "fk_source";
@ -295,7 +295,7 @@ if (empty($reshook))
$sql.= ", ".$object->id; $sql.= ", ".$object->id;
$sql.= ", '".$object->element."'"; $sql.= ", '".$object->element."'";
$sql.= ")"; $sql.= ")";
if ($db->query($sql)) if ($db->query($sql))
{ {
$db->commit(); $db->commit();
@ -304,17 +304,17 @@ if (empty($reshook))
{ {
$db->rollback(); $db->rollback();
} }
$lines = $cmd->lines; $lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines')) if (empty($lines) && method_exists($cmd, 'fetch_lines'))
{ {
$cmd->fetch_lines(); $cmd->fetch_lines();
$lines = $cmd->lines; $lines = $cmd->lines;
} }
$fk_parent_line=0; $fk_parent_line=0;
$num=count($lines); $num=count($lines);
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
@ -404,42 +404,42 @@ if (empty($reshook))
} }
} }
} }
} }
$cmd->classifyBilled($user); $cmd->classifyBilled($user);
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
else $TFact[$object->id] = $object; else $TFact[$object->id] = $object;
} }
// Build doc with all invoices // Build doc with all invoices
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array(); $toselect = array();
if(!empty($validate_invoices)) { if(!empty($validate_invoices)) {
$massaction = $action = 'builddoc'; $massaction = $action = 'builddoc';
foreach($TAllFact as &$object) { foreach($TAllFact as &$object) {
$object->validate($user); $object->validate($user);
$toselect[] = $object->id; // For builddoc action $toselect[] = $object->id; // For builddoc action
// Fac builddoc // Fac builddoc
$upload_dir = $conf->facture->dir_output; $upload_dir = $conf->facture->dir_output;
$permissioncreate=$user->rights->facture->creer; $permissioncreate=$user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
} }
$objectclass='Facture'; $objectclass='Facture';
$objectlabel='Invoice'; $objectlabel='Invoice';
$permtoread = $user->rights->facture->lire; $permtoread = $user->rights->facture->lire;
$permtodelete = $user->rights->facture->supprimer; $permtodelete = $user->rights->facture->supprimer;
$uploaddir = $conf->facture->dir_output; $uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
@ -537,12 +537,11 @@ if ($billed != '' && $billed >= 0) $sql .= " AND cf.billed = ".$billed;
//Required triple check because statut=0 means draft filter //Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'alpha') !== '') if (GETPOST('statut', 'alpha') !== '')
{ {
$sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")"; $sql .= " AND cf.fk_statut IN (".$db->escape(GETPOST('statut', 'alpha')).")";
} }
if ($search_status != '' && $search_status >= 0) if ($search_status != '' && $search_status >= 0)
{ {
if (strstr($search_status, ',')) $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")";
else $sql.=" AND cf.fk_statut = ".$search_status;
} }
if ($ordermonth > 0) if ($ordermonth > 0)
{ {
@ -573,11 +572,11 @@ else if ($deliveryyear > 0)
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='supplier_order' AND tc.source='internal' AND ec.element_id = cf.rowid AND ec.fk_socpeople = ".$search_user; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='supplier_order' AND tc.source='internal' AND ec.element_id = cf.rowid AND ec.fk_socpeople = ".$db->escape($search_user);
if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1); if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1);
if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1); if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1);
if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1); if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1);
@ -629,7 +628,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if ($socid > 0) $param.='&socid='.$socid; if ($socid > 0) $param.='&socid='.$socid;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
@ -670,7 +669,7 @@ if ($resql)
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -688,7 +687,7 @@ if ($resql)
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails"); $langs->load("mails");
if (! GETPOST('cancel')) if (! GETPOST('cancel'))
{ {
$objecttmp=new CommandeFournisseur($db); $objecttmp=new CommandeFournisseur($db);
@ -707,23 +706,23 @@ if ($resql)
} }
} }
} }
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
dol_fiche_head(null, '', ''); dol_fiche_head(null, '', '');
$topicmail="SendOrderRef"; $topicmail="SendOrderRef";
$modelmail="order_send"; $modelmail="order_send";
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->withform=-1; $formmail->withform=-1;
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
if($formmail->fromtype === 'user'){ if($formmail->fromtype === 'user'){
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
} }
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{ {
@ -767,23 +766,23 @@ if ($resql)
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']=''; $formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param['action']=$action; $formmail->param['action']=$action;
$formmail->param['models']=$modelmail; $formmail->param['models']=$modelmail;
$formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['id']=join(',',$arrayofselected); $formmail->param['id']=join(',',$arrayofselected);
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form(); print $formmail->get_form();
dol_fiche_end(); dol_fiche_end();
} }
elseif ($massaction == 'createbills') elseif ($massaction == 'createbills')
{ {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
print '<table class="border" width="100%" >'; print '<table class="border" width="100%" >';
print '<tr>'; print '<tr>';
print '<td class="titlefieldmiddle">'; print '<td class="titlefieldmiddle">';
@ -810,7 +809,7 @@ if ($resql)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> '; print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> ';
@ -818,7 +817,7 @@ if ($resql)
print '</div>'; print '</div>';
print '<br>'; print '<br>';
} }
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
@ -833,7 +832,7 @@ if ($resql)
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view other users // If the user can view other users
@ -841,7 +840,7 @@ if ($resql)
{ {
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -851,14 +850,14 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
@ -1065,8 +1064,8 @@ if ($resql)
if (! empty($arrayfields['cf.billed']['checked'])) print_liste_field_titre($arrayfields['cf.billed']['label'],$_SERVER["PHP_SELF"],'cf.billed','',$param,'align="center"',$sortfield,$sortorder,''); if (! empty($arrayfields['cf.billed']['checked'])) print_liste_field_titre($arrayfields['cf.billed']['label'],$_SERVER["PHP_SELF"],'cf.billed','',$param,'align="center"',$sortfield,$sortorder,'');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$total=0; $total=0;
$subtotal=0; $subtotal=0;
$productstat_cache=array(); $productstat_cache=array();
@ -1081,7 +1080,7 @@ if ($resql)
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$objectstatic->id=$obj->rowid; $objectstatic->id=$obj->rowid;
$objectstatic->ref=$obj->ref; $objectstatic->ref=$obj->ref;
@ -1098,7 +1097,7 @@ if ($resql)
if (! empty($arrayfields['cf.ref']['checked'])) if (! empty($arrayfields['cf.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
@ -1113,7 +1112,7 @@ if ($resql)
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'."\n"; print '</td>'."\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -1319,18 +1318,18 @@ if ($resql)
*/ */
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->fournisseur->commande->lire; $genallowed=$user->rights->fournisseur->commande->lire;
$delallowed=$user->rights->fournisseur->commande->lire; $delallowed=$user->rights->fournisseur->commande->lire;
print $formfile->showdocuments('massfilesarea_supplier_order','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_supplier_order','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
} }
else else
{ {
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
} }
$db->free($resql); $db->free($resql);
} }
else else

View File

@ -193,7 +193,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // All test must be present to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // All test must be present to be compatible with all browsers
{ {
$search_all=""; $search_all="";
@ -232,7 +232,7 @@ if (empty($reshook))
$filter=''; $filter='';
$option=''; $option='';
} }
// Mass actions // Mass actions
$objectclass='FactureFournisseur'; $objectclass='FactureFournisseur';
$objectlabel='SupplierInvoices'; $objectlabel='SupplierInvoices';
@ -242,7 +242,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
/* /*
* View * View
*/ */
@ -267,7 +267,7 @@ $sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= " p.rowid as project_id, p.ref as project_ref"; $sql.= " p.rowid as project_id, p.ref as project_ref";
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (! $search_all) $sql.= ', SUM(pf.amount) as dynamount_payed'; if (! $search_all) $sql.= ', SUM(pf.amount) as dynamount_payed';
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks // Add fields from hooks
@ -396,7 +396,7 @@ if (! $search_all)
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
{ {
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
} }
} }
else else
{ {
@ -421,7 +421,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($socid) if ($socid)
{ {
$soc = new Societe($db); $soc = new Societe($db);
@ -460,7 +460,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
@ -470,7 +470,7 @@ if ($resql)
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$i = 0; $i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -484,11 +484,11 @@ if ($resql)
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails"); $langs->load("mails");
if (! GETPOST('cancel')) if (! GETPOST('cancel'))
{ {
$objecttmp=new FactureFourn($db); $objecttmp=new FactureFourn($db);
@ -507,26 +507,26 @@ if ($resql)
} }
} }
} }
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
dol_fiche_head(null, '', ''); dol_fiche_head(null, '', '');
$topicmail="SendBillRef"; $topicmail="SendBillRef";
$modelmail="supplier_invoice_send"; $modelmail="supplier_invoice_send";
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->withform=-1; $formmail->withform=-1;
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
if($formmail->fromtype === 'user'){ if($formmail->fromtype === 'user'){
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
} }
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{ {
@ -570,23 +570,23 @@ if ($resql)
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']=''; $formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param['action']=$action; $formmail->param['action']=$action;
$formmail->param['models']=$modelmail; $formmail->param['models']=$modelmail;
$formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['id']=join(',',$arrayofselected); $formmail->param['id']=join(',',$arrayofselected);
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form(); print $formmail->get_form();
dol_fiche_end(); dol_fiche_end();
} }
elseif ($massaction == 'createbills') elseif ($massaction == 'createbills')
{ {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
print '<table class="border" width="100%" >'; print '<table class="border" width="100%" >';
print '<tr>'; print '<tr>';
print '<td class="titlefieldmiddle">'; print '<td class="titlefieldmiddle">';
@ -613,7 +613,7 @@ if ($resql)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> '; print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> ';
@ -621,13 +621,13 @@ if ($resql)
print '</div>'; print '</div>';
print '<br>'; print '<br>';
} }
if ($search_all) if ($search_all)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
$moreforfilter=''; $moreforfilter='';
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
@ -635,7 +635,7 @@ if ($resql)
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -643,7 +643,7 @@ if ($resql)
{ {
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -653,7 +653,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
@ -671,7 +671,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
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";
@ -900,12 +900,12 @@ if ($resql)
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$facturestatic=new FactureFournisseur($db); $facturestatic=new FactureFournisseur($db);
$supplierstatic=new Fournisseur($db); $supplierstatic=new Fournisseur($db);
$projectstatic=new Project($db); $projectstatic=new Project($db);
if ($num > 0) if ($num > 0)
{ {
$i=0; $i=0;
@ -915,7 +915,7 @@ if ($resql)
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$datelimit=$db->jdate($obj->datelimite); $datelimit=$db->jdate($obj->datelimite);
$facturestatic->id=$obj->facid; $facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
@ -929,7 +929,7 @@ if ($resql)
$totaldeposits = $facturestatic->getSumDepositsUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits; $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay; $remaintopay = $obj->total_ttc - $totalpay;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['f.ref']['checked'])) if (! empty($arrayfields['f.ref']['checked']))
{ {
@ -950,11 +950,11 @@ if ($resql)
$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Customer ref // Customer ref
if (! empty($arrayfields['f.ref_supplier']['checked'])) if (! empty($arrayfields['f.ref_supplier']['checked']))
{ {
@ -963,7 +963,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Label // Label
if (! empty($arrayfields['f.label']['checked'])) if (! empty($arrayfields['f.label']['checked']))
{ {
@ -972,7 +972,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date // Date
if (! empty($arrayfields['f.datef']['checked'])) if (! empty($arrayfields['f.datef']['checked']))
{ {
@ -981,7 +981,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date limit // Date limit
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{ {
@ -993,7 +993,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Project // Project
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
@ -1007,7 +1007,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -1061,7 +1061,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Payment mode // Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{ {
@ -1070,7 +1070,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Amount HT // Amount HT
if (! empty($arrayfields['f.total_ht']['checked'])) if (! empty($arrayfields['f.total_ht']['checked']))
{ {
@ -1127,8 +1127,8 @@ if ($resql)
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay; $totalarray['totalrtp'] += $remaintopay;
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
@ -1176,7 +1176,7 @@ if ($resql)
print "</td>"; print "</td>";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Action column // Action column
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
@ -1187,12 +1187,12 @@ if ($resql)
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
// Show total line // Show total line
if (isset($totalarray['totalhtfield']) if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield']) || isset($totalarray['totalvatfield'])
@ -1215,7 +1215,7 @@ if ($resql)
} }
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>'; elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>'; elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totallocaltax1field'] == $i) print '<td align="right">'.price($totalarray['totallocaltax1']).'</td>'; elseif ($totalarray['totallocaltax1field'] == $i) print '<td align="right">'.price($totalarray['totallocaltax1']).'</td>';
elseif ($totalarray['totallocaltax2field'] == $i) print '<td align="right">'.price($totalarray['totallocaltax2']).'</td>'; elseif ($totalarray['totallocaltax2field'] == $i) print '<td align="right">'.price($totalarray['totallocaltax2']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>'; elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>'; elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>';
@ -1223,32 +1223,32 @@ if ($resql)
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }
} }
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";
/* /*
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{ {
// Show list of available documents // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire; $genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->lire;
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
} }
else else

View File

@ -576,27 +576,27 @@ if ($action == 'confirm_draft' && GETPOST('confirm') == 'yes')
{ {
$object = new Holiday($db); $object = new Holiday($db);
$object->fetch($id); $object->fetch($id);
$oldstatus = $object->statut; $oldstatus = $object->statut;
$object->statut = 1; $object->statut = 1;
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) if ($result < 0)
{ {
$error = $langs->trans('ErrorBackToDraft'); $error = $langs->trans('ErrorBackToDraft');
} }
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
} }
else else
{ {
$db->rollback(); $db->rollback();
} }
} }
// Si Validation de la demande // Si Validation de la demande
@ -1029,7 +1029,7 @@ else
{ {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleSetToDraft"),$langs->trans("ConfirmSetToDraft"),"confirm_draft", '', 1, 1); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleSetToDraft"),$langs->trans("ConfirmSetToDraft"),"confirm_draft", '', 1, 1);
} }
$head=holiday_prepare_head($object); $head=holiday_prepare_head($object);
@ -1041,17 +1041,17 @@ else
print '<input type="hidden" name="id" value="'.$object->id.'" />'."\n"; print '<input type="hidden" name="id" value="'.$object->id.'" />'."\n";
} }
dol_fiche_head($head,'card',$langs->trans("CPTitreMenu"),0,'holiday'); dol_fiche_head($head, 'card', $langs->trans("CPTitreMenu"), -1, 'holiday');
$linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php">'.$langs->trans("BackToList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref'); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<tbody>'; print '<tbody>';
@ -1153,9 +1153,9 @@ else
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
// Info workflow // Info workflow
print '<table class="border centpercent">'."\n"; print '<table class="border centpercent">'."\n";
print '<tbody>'; print '<tbody>';
@ -1212,12 +1212,12 @@ else
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
if ($action == 'edit' && $object->statut == 1) if ($action == 'edit' && $object->statut == 1)
{ {
print '<div align="center">'; print '<div align="center">';
@ -1273,7 +1273,7 @@ else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>';
} }
print '</div>'; print '</div>';
} }

View File

@ -1195,12 +1195,15 @@ class Holiday extends CommonObject
* *
* @param boolean $stringlist If true return a string list of id. If false, return an array * @param boolean $stringlist If true return a string list of id. If false, return an array
* @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list. * @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list.
* @param string $filters Filters
* @return array|string|int Return an array * @return array|string|int Return an array
*/ */
function fetchUsers($stringlist=true,$type=true) function fetchUsers($stringlist=true, $type=true, $filters='')
{ {
global $conf; global $conf;
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
// Si vrai donc pour user Dolibarr // Si vrai donc pour user Dolibarr
if ($stringlist) if ($stringlist)
{ {
@ -1219,11 +1222,12 @@ class Holiday extends CommonObject
$sql.= " OR u.admin = 1"; $sql.= " OR u.admin = 1";
} }
else else
{
$sql.= " WHERE u.entity IN (0,".$conf->entity.")"; $sql.= " WHERE u.entity IN (0,".$conf->entity.")";
}
$sql.= " AND u.statut > 0"; $sql.= " AND u.statut > 0";
if ($filters) $sql.=$filters;
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
// Si pas d'erreur SQL // Si pas d'erreur SQL
@ -1261,9 +1265,10 @@ class Holiday extends CommonObject
{ {
// We want only list of user id // We want only list of user id
$sql = "SELECT DISTINCT cpu.fk_user"; $sql = "SELECT DISTINCT cpu.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE cpu.fk_user = u.user";
if ($filters) $sql.=$filters;
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
// Si pas d'erreur SQL // Si pas d'erreur SQL
@ -1318,8 +1323,8 @@ class Holiday extends CommonObject
$sql.= " WHERE u.entity IN (0,".$conf->entity.")"; $sql.= " WHERE u.entity IN (0,".$conf->entity.")";
$sql.= " AND u.statut > 0"; $sql.= " AND u.statut > 0";
if ($filters) $sql.=$filters;
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
// Si pas d'erreur SQL // Si pas d'erreur SQL
@ -1358,14 +1363,13 @@ class Holiday extends CommonObject
} }
} }
else else
{ {
// List of vacation balance users // List of vacation balance users
$sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holiday, u.lastname, u.firstname"; $sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holiday, u.lastname, u.firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu,"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu, ".MAIN_DB_PREFIX."user as u";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE cpu.fk_user = u.rowid"; $sql.= " WHERE cpu.fk_user = u.rowid";
if ($filters) $sql.=$filters;
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
// Si pas d'erreur SQL // Si pas d'erreur SQL

View File

@ -30,81 +30,135 @@ require('../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
$langs->load('users');
$langs->load('hrm');
$action=GETPOST('action','aZ09');
$search_name=GETPOST('search_name', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="t.rowid"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
// Protection if external user // Protection if external user
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
// If the user does not have perm to read the page // If the user does not have perm to read the page
if(!$user->rights->holiday->read) accessforbidden(); if(!$user->rights->holiday->read) accessforbidden();
$action=GETPOST('action','aZ09');
// Initialize technical object to manage context to save list fields
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'defineholidaylist';
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('defineholidaylist'));
$extrafields = new ExtraFields($db);
$holiday = new Holiday($db); $holiday = new Holiday($db);
$langs->load('users');
$langs->load('hrm');
/* /*
* Actions * Actions
*/ */
// Si il y a une action de mise à jour if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if ($action == 'update' && isset($_POST['update_cp'])) if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{ {
$error = 0; // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
$typeleaves=$holiday->getTypes(1,1); // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
$userID = array_keys($_POST['update_cp']);
$userID = $userID[0];
foreach($typeleaves as $key => $val)
{ {
$userValue = $_POST['nb_holiday_'.$val['rowid']]; $search_name='';
$userValue = $userValue[$userID]; $toselect='';
$search_array_options=array();
if (!empty($userValue))
{
$userValue = price2num($userValue,5);
} else {
$userValue = '';
}
//If the user set a comment, we add it to the log comment
$comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
//print 'eee'.$val['rowid'].'-'.$userValue;
if ($userValue != '')
{
// We add the modification to the log (must be before update of sold because we read current value of sold)
$result=$holiday->addLogCP($user->id, $userID, $langs->transnoentitiesnoconv('ManualUpdate').$comment, $userValue, $val['rowid']);
if ($result < 0)
{
setEventMessages($holiday->error, $holiday->errors, 'errors');
$error++;
}
// Update of the days of the employee
$result = $holiday->updateSoldeCP($userID, $userValue, $val['rowid']);
if ($result < 0)
{
setEventMessages($holiday->error, $holiday->errors, 'errors');
$error++;
}
// If it first update of balance, we set date to avoid to have sold incremented by new month
/*
$now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
$sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init.
dol_syslog('define_holiday update lastUpdate entry', LOG_DEBUG);
$result = $db->query($sql);
*/
}
} }
if (! $error) setEventMessages('UpdateConfCPOK', '', 'mesgs'); // Mass actions
/*
$objectclass='Skeleton';
$objectlabel='Skeleton';
$permtoread = $user->rights->skeleton->read;
$permtodelete = $user->rights->skeleton->delete;
$uploaddir = $conf->skeleton->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
*/
// Si il y a une action de mise à jour
if ($action == 'update' && isset($_POST['update_cp']))
{
$error = 0;
$typeleaves=$holiday->getTypes(1,1);
$userID = array_keys($_POST['update_cp']);
$userID = $userID[0];
foreach($typeleaves as $key => $val)
{
$userValue = $_POST['nb_holiday_'.$val['rowid']];
$userValue = $userValue[$userID];
if (!empty($userValue))
{
$userValue = price2num($userValue,5);
} else {
$userValue = '';
}
//If the user set a comment, we add it to the log comment
$comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
//print 'eee'.$val['rowid'].'-'.$userValue;
if ($userValue != '')
{
// We add the modification to the log (must be before update of sold because we read current value of sold)
$result=$holiday->addLogCP($user->id, $userID, $langs->transnoentitiesnoconv('ManualUpdate').$comment, $userValue, $val['rowid']);
if ($result < 0)
{
setEventMessages($holiday->error, $holiday->errors, 'errors');
$error++;
}
// Update of the days of the employee
$result = $holiday->updateSoldeCP($userID, $userValue, $val['rowid']);
if ($result < 0)
{
setEventMessages($holiday->error, $holiday->errors, 'errors');
$error++;
}
// If it first update of balance, we set date to avoid to have sold incremented by new month
/*
$now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
$sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init.
dol_syslog('define_holiday update lastUpdate entry', LOG_DEBUG);
$result = $db->query($sql);
*/
}
}
if (! $error) setEventMessages('UpdateConfCPOK', '', 'mesgs');
}
} }
@ -117,6 +171,17 @@ $userstatic=new User($db);
llxHeader('', $langs->trans('CPTitreMenu')); llxHeader('', $langs->trans('CPTitreMenu'));
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png'); print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n"; print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
@ -137,10 +202,12 @@ if ($result < 0)
setEventMessages($holiday->error, $holiday->errors, 'errors'); setEventMessages($holiday->error, $holiday->errors, 'errors');
} }
$listUsers = $holiday->fetchUsers(false,true); $filters=natural_search(array('u.firstname','u.lastname'), $search_name);
$listUsers = $holiday->fetchUsers(false,true,$filters);
if (is_numeric($listUsers) && $listUsers < 0) if (is_numeric($listUsers) && $listUsers < 0)
{ {
setEventMessages($holiday->error, $holiday->errors, 'errors'); setEventMessages($holiday->error, $holiday->errors, 'errors');
} }
$var=true; $var=true;
@ -159,22 +226,44 @@ else
{ {
$canedit=0; $canedit=0;
if (! empty($user->rights->holiday->define_holiday)) $canedit=1; if (! empty($user->rights->holiday->define_holiday)) $canedit=1;
// Get array of ids of all childs // Get array of ids of all childs
$userchilds=array(); $userchilds=array();
if (empty($user->rights->holiday->read_all)) if (empty($user->rights->holiday->read_all))
{ {
$userchilds=$user->getAllChildIds(); $userchilds=$user->getAllChildIds();
} }
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<input type="hidden" name="action" value="update" />'; print '<input type="hidden" name="action" value="update" />';
$moreforfilter=''; $moreforfilter='';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_name" value="'.dol_escape_htmltag($search_name).'"></td>';
if (count($typeleaves))
{
foreach($typeleaves as $key => $val)
{
print '<td class="liste_titre" style="text-align:center"></td>';
}
}
else
{
print '<td class="liste_titre"></td>';
}
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Employee'), $_SERVER["PHP_SELF"]); print_liste_field_titre($langs->trans('Employee'), $_SERVER["PHP_SELF"]);
if (count($typeleaves)) if (count($typeleaves))
@ -193,35 +282,18 @@ else
print '</th>'; print '</th>';
print_liste_field_titre(''); print_liste_field_titre('');
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"></td>';
if (count($typeleaves))
{
foreach($typeleaves as $key => $val)
{
print '<td class="liste_titre" style="text-align:center"></td>';
}
}
else
{
print '<td class="liste_titre"></td>';
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '</tr>';
foreach($listUsers as $users) foreach($listUsers as $users)
{ {
// If user has not permission to edit/read all, we must see only subordinates // If user has not permission to edit/read all, we must see only subordinates
if (empty($user->rights->holiday->read_all)) if (empty($user->rights->holiday->read_all))
{ {
if (($users['rowid'] != $user->id) && (! in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. if (($users['rowid'] != $user->id) && (! in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it.
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// User // User
print '<td>'; print '<td>';
$userstatic->id=$users['rowid']; $userstatic->id=$users['rowid'];
@ -252,7 +324,7 @@ else
{ {
print '<td></td>'; print '<td></td>';
} }
// Note // Note
print '<td style="text-align:center">'; print '<td style="text-align:center">';
if ($canedit) print '<input type="text"'.($canedit?'':' disabled="disabled"').' class="maxwidthonsmartphone" value="" name="note_holiday['.$users['rowid'].']" size="30"/>'; if ($canedit) print '<input type="text"'.($canedit?'':' disabled="disabled"').' class="maxwidthonsmartphone" value="" name="note_holiday['.$users['rowid'].']" size="30"/>';
@ -270,9 +342,10 @@ else
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</form>';
} }
print '</form>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -66,7 +66,7 @@ $year_end = GETPOST('year_end');
$search_employe = GETPOST('search_employe'); $search_employe = GETPOST('search_employe');
$search_valideur = GETPOST('search_valideur'); $search_valideur = GETPOST('search_valideur');
$search_statut = GETPOST('select_statut'); $search_statut = GETPOST('select_statut');
$type = GETPOST('type','int'); $type = GETPOST('type','int');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
@ -310,14 +310,14 @@ print '</td>';
if ($user->rights->holiday->write_all) if ($user->rights->holiday->write_all)
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($search_employe,"search_employe",1,"",0,'','',0,32,0,'',0,'','maxwidth200'); print $form->select_dolusers($search_employe,"search_employe",1,"",0,'','',0,0,0,'',0,'','maxwidth200');
print '</td>'; print '</td>';
} }
else else
{ {
//print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($user->id,"search_employe",1,"",1,'','',0,32,0,'',0,'','maxwidth200'); print $form->select_dolusers($user->id,"search_employe",1,"",1,'','',0,0,0,'',0,'','maxwidth200');
print '</td>'; print '</td>';
} }
@ -331,7 +331,7 @@ if($user->rights->holiday->write_all)
$valideurobjects = $validator->listUsersForGroup($excludefilter); $valideurobjects = $validator->listUsersForGroup($excludefilter);
$valideurarray = array(); $valideurarray = array();
foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id; foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id;
print $form->select_dolusers($search_valideur,"search_valideur",1,"",0,$valideurarray,'', 0, 32,0,'',0,'','maxwidth200'); print $form->select_dolusers($search_valideur,"search_valideur",1,"",0,$valideurarray,'', 0, 0, 0, '', 0, '', 'maxwidth200');
print '</td>'; print '</td>';
} }
else else
@ -408,7 +408,7 @@ if (! empty($holiday->holiday))
$userstatic->login=$infos_CP['user_login']; $userstatic->login=$infos_CP['user_login'];
$userstatic->statut=$infos_CP['user_statut']; $userstatic->statut=$infos_CP['user_statut'];
$userstatic->photo=$infos_CP['user_photo']; $userstatic->photo=$infos_CP['user_photo'];
// Valideur // Valideur
$approbatorstatic->id=$infos_CP['fk_validator']; $approbatorstatic->id=$infos_CP['fk_validator'];
$approbatorstatic->lastname=$infos_CP['validator_lastname']; $approbatorstatic->lastname=$infos_CP['validator_lastname'];
@ -416,7 +416,7 @@ if (! empty($holiday->holiday))
$approbatorstatic->login=$infos_CP['validator_login']; $approbatorstatic->login=$infos_CP['validator_login'];
$approbatorstatic->statut=$infos_CP['validator_statut']; $approbatorstatic->statut=$infos_CP['validator_statut'];
$approbatorstatic->photo=$infos_CP['validator_photo']; $approbatorstatic->photo=$infos_CP['validator_photo'];
$date = $infos_CP['date_create']; $date = $infos_CP['date_create'];
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -265,7 +265,7 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.
// Defini objet langs // Defini objet langs
$langs = new Translate('..',$conf); $langs = new Translate('..',$conf);
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
else $langs->setDefaultLang('auto'); else $langs->setDefaultLang('auto');
$bc[false]=' class="bg1"'; $bc[false]=' class="bg1"';

View File

@ -3,6 +3,7 @@ BlockedLogDesc=This module store event for invoice and payments as block chain
FingerprintsDesc=All fingerprints stored FingerprintsDesc=All fingerprints stored
EntityKey=Entity Key EntityKey=Entity Key
ShowAllFingerPrintsMightBeTooLong=Show all fingerprints (might be long) ShowAllFingerPrintsMightBeTooLong=Show all fingerprints (might be long)
ShowAllFingerPrintsErrorsMightBeTooLong=Show all fingerprints with error (might be long)
DownloadBlockChain=Download fingerprints DownloadBlockChain=Download fingerprints
KoCheckFingerprintValidity=Fingerprint is not valid KoCheckFingerprintValidity=Fingerprint is not valid
OkCheckFingerprintValidity=Fingerprint is valid OkCheckFingerprintValidity=Fingerprint is valid
@ -14,3 +15,7 @@ logPAYMENT_CUSTOMER_CREATE=Payment of customer created
logBILL_PAYED=Customer bill payed logBILL_PAYED=Customer bill payed
logBILL_UNPAYED=Customer bill set unpayed logBILL_UNPAYED=Customer bill set unpayed
logBILL_VALIDATE=Customer bill set valid from draft logBILL_VALIDATE=Customer bill set valid from draft
logBILL_SENTBYMAIL=Customer bill send by mail
BlockedlogInfoDialog=Log Details
Fingerprint=Fingerprint
DownloadLogCSV=Download fingerprints CSV

View File

@ -11,7 +11,14 @@ ModuleBuilderDescobjects=Define here the new objects you want to manage with you
ModuleBuilderDescmenus=This tab is dedicated to define menu entries provided by your module. ModuleBuilderDescmenus=This tab is dedicated to define menu entries provided by your module.
ModuleBuilderDescpermissions=This tab is dedicated to define the new permissions you want to provide with your module. ModuleBuilderDescpermissions=This tab is dedicated to define the new permissions you want to provide with your module.
ModuleBuilderDesctriggers=This is the view of triggers provided by your module. To include code executed when a triggered business event is launched, just edit this file with your IDE. ModuleBuilderDesctriggers=This is the view of triggers provided by your module. To include code executed when a triggered business event is launched, just edit this file with your IDE.
ModuleBuilderDeschooks=This tab is dedicated to hooks.
ModuleBuilderDescwidgets=This tab is dedicated to manage/build widgets.
ModuleBuilderDescbuildpackage=You can generate here a "ready to distribute" package file (a normalized .zip file) of your module. Just click on button to get your module package file. ModuleBuilderDescbuildpackage=You can generate here a "ready to distribute" package file (a normalized .zip file) of your module. Just click on button to get your module package file.
ModuleBuilderDescdangerzone=You can delete your module. WARNING: All files of module will be definetly lost !
DangerZone=Danger zone
BuildPackage=Build package BuildPackage=Build package
ModuleIsNotActive=This module was not activated yet (go into Home-Setup-Module to make it live) ModuleIsNotActive=This module was not activated yet (go into Home-Setup-Module to make it live)
ModuleIsLive=This module has been activated. Any change on it may break a current active feature. ModuleIsLive=This module has been activated. Any change on it may break a current active feature.
DescriptionLong=Long description
EditorName=Name of editor
EditorUrl=URL of editor

View File

@ -64,6 +64,7 @@ TaskDescription=Task description
NewTask=New task NewTask=New task
AddTask=Create task AddTask=Create task
AddTimeSpent=Create time spent AddTimeSpent=Create time spent
AddHereTimeSpentForDay=Add here time spent for this day/task
Activity=Activity Activity=Activity
Activities=Tasks/activities Activities=Tasks/activities
MyActivities=My tasks/activities MyActivities=My tasks/activities

View File

@ -396,8 +396,8 @@ if (! defined('NOLOGIN'))
{ {
if (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/public/',$_SERVER['HTTP_REFERER'])) if (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/public/',$_SERVER['HTTP_REFERER']))
{ {
dol_syslog("Call index page from another url than demo page"); dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")");
$url=''; $url='';
$url.=($url?'&':'').($dol_hide_topmenu?'dol_hide_topmenu='.$dol_hide_topmenu:''); $url.=($url?'&':'').($dol_hide_topmenu?'dol_hide_topmenu='.$dol_hide_topmenu:'');
$url.=($url?'&':'').($dol_hide_leftmenu?'dol_hide_leftmenu='.$dol_hide_leftmenu:''); $url.=($url?'&':'').($dol_hide_leftmenu?'dol_hide_leftmenu='.$dol_hide_leftmenu:'');
$url.=($url?'&':'').($dol_optimize_smallscreen?'dol_optimize_smallscreen='.$dol_optimize_smallscreen:''); $url.=($url?'&':'').($dol_optimize_smallscreen?'dol_optimize_smallscreen='.$dol_optimize_smallscreen:'');

View File

@ -113,6 +113,19 @@ if ($dirins && $action == 'initmodule' && $modulename)
} }
} }
if ($dirins && $action == 'confirm_delete')
{
$modulelowercase=strtolower($module);
// Dir for module
$dir = $dirins.'/'.$modulelowercase;
dol_delete_dir_recursive($dir);
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
exit;
}
if ($dirins && $action == 'generatepackage') if ($dirins && $action == 'generatepackage')
{ {
$modulelowercase=strtolower($module); $modulelowercase=strtolower($module);
@ -373,16 +386,31 @@ elseif (! empty($module))
$head2[$h][2] = 'permissions'; $head2[$h][2] = 'permissions';
$h++; $h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module;
$head2[$h][1] = $langs->trans("Hooks");
$head2[$h][2] = 'hooks';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module;
$head2[$h][1] = $langs->trans("Triggers"); $head2[$h][1] = $langs->trans("Triggers");
$head2[$h][2] = 'triggers'; $head2[$h][2] = 'triggers';
$h++; $h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module;
$head2[$h][1] = $langs->trans("Widgets");
$head2[$h][2] = 'widgets';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module;
$head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][1] = $langs->trans("BuildPackage");
$head2[$h][2] = 'buildpackage'; $head2[$h][2] = 'buildpackage';
$h++; $h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dangerzone&module='.$module;
$head2[$h][1] = $langs->trans("DangerZone");
$head2[$h][2] = 'dangerzone';
$h++;
print $modulestatusinfo.'<br><br>'; print $modulestatusinfo.'<br><br>';
dol_fiche_head($head2, $tab, '', -1, ''); dol_fiche_head($head2, $tab, '', -1, '');
@ -421,7 +449,7 @@ elseif (! empty($module))
print '<tr><td>'; print '<tr><td>';
print $langs->trans("Family"); print $langs->trans("Family");
print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'"; //print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'";
print '</td><td>'; print '</td><td>';
print $moduleobj->family; print $moduleobj->family;
print '</td></tr>'; print '</td></tr>';
@ -445,7 +473,7 @@ elseif (! empty($module))
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'; print '<tr><td>';
print $langs->trans("LongDescription"); print $langs->trans("DescriptionLong");
print '</td><td>'; print '</td><td>';
print $moduleobj->getDescLong(); print $moduleobj->getDescLong();
print '</td></tr>'; print '</td></tr>';
@ -453,14 +481,6 @@ elseif (! empty($module))
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br><br>';
print '<form name="delete">';
print '<input type="hidden" name="action" value="confirm_delete">';
print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>';
print '</form>';
} }
if ($tab == 'objects') if ($tab == 'objects')
@ -483,6 +503,12 @@ elseif (! empty($module))
} }
if ($tab == 'hooks')
{
print $langs->trans("FeatureNotYetAvailable");
}
if ($tab == 'triggers') if ($tab == 'triggers')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
@ -520,6 +546,12 @@ elseif (! empty($module))
print '</div>'; print '</div>';
} }
if ($tab == 'widget')
{
print $langs->trans("FeatureNotYetAvailable");
}
if ($tab == 'buildpackage') if ($tab == 'buildpackage')
{ {
if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP'))
@ -536,6 +568,16 @@ elseif (! empty($module))
print '</form>'; print '</form>';
} }
if ($tab == 'dangerzone')
{
print '<form name="delete">';
print '<input type="hidden" name="action" value="confirm_delete">';
print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>';
print '</form>';
}
dol_fiche_end(); dol_fiche_end();
} }
} }

View File

@ -3,4 +3,4 @@
## Features ## Features
MyModuleDescription MyModuleDescription
Other modules are available on <a href="https://www.dolistore.com target="_new">Dolistore.com</a>. Other modules are available on <a href="https://www.dolistore.com" target="_new">Dolistore.com</a>.

View File

@ -20,8 +20,6 @@
* \file htdocs/modulebuilder/template/admin/about.php * \file htdocs/modulebuilder/template/admin/about.php
* \ingroup mymodule * \ingroup mymodule
* \brief About page of module MyModule. * \brief About page of module MyModule.
*
* MyModuleDescription.
*/ */
// Load Dolibarr environment // Load Dolibarr environment
@ -84,8 +82,8 @@ echo $langs->trans("MyModuleAboutPage");
echo '<br>'; echo '<br>';
require_once '../core/modulebuilder/mymodule/core/modules/modMyModule.class.php'; dol_include_once('/mymodule/core/modules/modMyModule.class.php');
$tmpmodule = new MyModule($db); $tmpmodule = new modMyModule($db);
print $tmpmodule->getDescLong(); print $tmpmodule->getDescLong();
// Page end // Page end

View File

@ -19,9 +19,7 @@
/** /**
* \file htdocs/modulebuilder/template/admin/setup.php * \file htdocs/modulebuilder/template/admin/setup.php
* \ingroup mymodule * \ingroup mymodule
* \brief Example module setup page. * \brief MyModule setup page.
*
* Put detailed description here.
*/ */
// Load Dolibarr environment // Load Dolibarr environment

View File

@ -56,6 +56,8 @@ class ActionsMyModule
/** /**
* Constructor * Constructor
*
* @param DoliDB $db Database handler
*/ */
public function __construct($db) public function __construct($db)
{ {

View File

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

View File

@ -182,8 +182,10 @@ else
$idprod = (! empty($match[0]) ? $match[0] : ''); $idprod = (! empty($match[0]) ? $match[0] : '');
if (GETPOST($htmlname,'alpha') == '' && (! $idprod || ! GETPOST($idprod,'alpha'))) if (GETPOST($htmlname,'alpha') == '' && (! $idprod || ! GETPOST($idprod,'alpha')))
{
print json_encode(array()); print json_encode(array());
return; return;
}
// When used from jQuery, the search term is added as GET param "term". // When used from jQuery, the search term is added as GET param "term".
$searchkey = (($idprod && GETPOST($idprod,'alpha')) ? GETPOST($idprod,'alpha') : (GETPOST($htmlname, 'alpha') ? GETPOST($htmlname, 'alpha') : '')); $searchkey = (($idprod && GETPOST($idprod,'alpha')) ? GETPOST($idprod,'alpha') : (GETPOST($htmlname, 'alpha') ? GETPOST($htmlname, 'alpha') : ''));

View File

@ -705,9 +705,9 @@ else
$product_static->status = $obj->tosell; $product_static->status = $obj->tosell;
$product_static->entity = $obj->entity; $product_static->entity = $obj->entity;
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) // To optimize call of load_stock if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock
{ {
if ($obj->fk_product_type != 1) // Not a service if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service
{ {
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
} }

View File

@ -1332,7 +1332,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); print '<div class="divlogofpreviouscustomerprice">';
$num = $db->num_rows($result);
if (! $num) if (! $num)
{ {
@ -1475,6 +1477,8 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
print '</div>'; print '</div>';
print "<br>"; print "<br>";
} }
print '</div>';
} else { } else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -444,7 +444,7 @@ if (! empty($conf->categorie->enabled))
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectCategories'). ': '; $moreforfilter.=$langs->trans('ProjectCategories'). ': ';
$moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
@ -453,7 +453,7 @@ $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
$includeonly=''; $includeonly='';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
// If the user can view thirdparties other than his' // If the user can view thirdparties other than his'
@ -462,7 +462,7 @@ if ($user->rights->societe->client->voir || $socid)
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }

View File

@ -442,7 +442,7 @@ if (! empty($conf->categorie->enabled))
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectCategories'). ': '; $moreforfilter.=$langs->trans('ProjectCategories'). ': ';
$moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 'maxwidth300');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
@ -451,7 +451,7 @@ $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' ';
$includeonly=''; $includeonly='';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
// If the user can view users // If the user can view users
@ -459,7 +459,7 @@ $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': ';
$includeonly=''; $includeonly='';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
if (! empty($moreforfilter)) if (! empty($moreforfilter))

View File

@ -54,12 +54,13 @@ $alwaysuncheckedmodules=array();
$alwayshiddencheckedmodules=array(); $alwayshiddencheckedmodules=array();
$alwayshiddenuncheckedmodules=array(); $alwayshiddenuncheckedmodules=array();
$url=DOL_URL_ROOT.'/index.php?'; $url='';
$url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); $url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:'');
$url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); $url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:'');
$url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); $url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:'');
$url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); $url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:'');
$url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); $url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:'');
$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:'');
$tmpaction = 'view'; $tmpaction = 'view';
$parameters=array(); $parameters=array();
@ -105,6 +106,7 @@ if (empty($reshook))
) )
); );
// Visible // Visible
$alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
$alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','workflow'); // Module we never want $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','workflow'); // Module we never want
@ -202,7 +204,7 @@ asort($orders);
* Actions * Actions
*/ */
if (GETPOST('action','aZ09') == 'gotodemo') if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules
{ {
//print 'ee'.GETPOST("demochoice"); //print 'ee'.GETPOST("demochoice");
$disablestring=''; $disablestring='';
@ -232,8 +234,9 @@ if (GETPOST('action','aZ09') == 'gotodemo')
// Do redirect to login page // Do redirect to login page
if ($disablestring) if ($disablestring)
{ {
if (GETPOST('urlfrom')) $url.=($url?'&':'').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&amp;':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha'));
$url.=($url?'&':'').'disablemodules='.$disablestring; $url.=(preg_match('/\?/',$url)?'&amp;':'?').'disablemodules='.$disablestring;
//var_dump($url);exit;
header("Location: ".$url); header("Location: ".$url);
exit; exit;
} }
@ -252,25 +255,25 @@ $head.='
<script type="text/javascript"> <script type="text/javascript">
var openedId=""; var openedId="";
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery("tr.moduleline").hide(); jQuery("tr.moduleline").hide();
// Enable this to allow personalized setup // Enable this to allow personalized setup
jQuery(".modulelineshow").attr("href","#a1profdemoall"); jQuery(".modulelineshow").attr("href","#a1profdemoall");
jQuery(".cursorpointer").css("cursor","pointer"); jQuery(".cursorpointer").css("cursor","pointer");
jQuery(".modulelineshow").click(function() { jQuery(".modulelineshow").click(function() {
var idstring=$(this).attr("id"); var idstring=$(this).attr("id");
if (typeof idstring != "undefined") if (typeof idstring != "undefined")
{ {
var currentId = idstring.substring(2); var currentId = idstring.substring(2);
jQuery("tr.moduleline").hide(); jQuery("tr.moduleline").hide();
if (currentId != openedId) if (currentId != openedId)
{ {
openedId=currentId; openedId=currentId;
jQuery("#tr1"+currentId).show(); jQuery("#tr1"+currentId).show();
jQuery("#tr2"+currentId).show(); jQuery("#tr2"+currentId).show();
} }
else openedId = ""; else openedId = "";
} }
}); });
}); });
</script>'; </script>';
@ -304,13 +307,23 @@ foreach ($demoprofiles as $profilearray)
//print $profilearray['lang']; //print $profilearray['lang'];
if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']);
$url=$_SERVER["PHP_SELF"].'?action=gotodemo&amp;urlfrom='.urlencode($_SERVER["PHP_SELF"]); $url=$_SERVER["PHP_SELF"].'?action=gotodemo';
$urlwithmod=$url.'&amp;demochoice='.$profilearray['key']; $urlwithmod=$url.'&amp;demochoice='.$profilearray['key'];
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
//print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>'; //print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>';
$urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]);
$urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]);
//print $urlfrom; //print $urlfrom;
if (! empty($profilearray['url'])) $urlwithmod=$profilearray['url'];
if (! empty($profilearray['url']))
{
$urlwithmod=$profilearray['url'];
$urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&amp;':'?').'urlfrom='.urlencode($urlfrom);
if (! empty($profilearray['disablemodules']))
{
$urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&amp;':'?').'disablemodules='.$profilearray['disablemodules'];
}
}
if (empty($profilearray['url'])) if (empty($profilearray['url']))
{ {
@ -348,7 +361,7 @@ foreach ($demoprofiles as $profilearray)
print '</a>'; print '</a>';
// Modules // Modules (a profile you must choose modules)
if (empty($profilearray['url'])) if (empty($profilearray['url']))
{ {
print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">'; print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">';

View File

@ -803,11 +803,6 @@ if (empty($reshook))
$price_min = $product->multiprices_min [$object->thirdparty->price_level]; $price_min = $product->multiprices_min [$object->thirdparty->price_level];
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error ++;
}
} else { } else {
$type = GETPOST('type'); $type = GETPOST('type');
$label = (GETPOST('product_label') ? GETPOST('product_label') : ''); $label = (GETPOST('product_label') ? GETPOST('product_label') : '');

View File

@ -149,7 +149,7 @@ if (empty($conf->db->user)) $conf->db->user='';
// Defini objet langs // Defini objet langs
$langs = new Translate('..',$conf); $langs = new Translate('..',$conf);
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
else $langs->setDefaultLang('auto'); else $langs->setDefaultLang('auto');
$bc[false]=' class="bg1"'; $bc[false]=' class="bg1"';

View File

@ -76,6 +76,8 @@ else header('Cache-Control: no-cache');
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); }
if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL
if (GETPOST('lang','aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');

View File

@ -77,6 +77,8 @@ else header('Cache-Control: no-cache');
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); }
if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');

View File

@ -1163,7 +1163,7 @@ else
// Check if user has rights // Check if user has rights
$object->getrights(); $object->getrights();
if(empty($object->nb_rights)) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings'); if (empty($object->nb_rights) && $object->statut != 0) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings');
// Connexion ldap // Connexion ldap
// pour recuperer passDoNotExpire et userChangePassNextLogon // pour recuperer passDoNotExpire et userChangePassNextLogon

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
@ -204,7 +204,7 @@ else
} }
if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid; if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid;
//if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user); //if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
if ($search_supervisor > 0) $sql.= " AND u.fk_user = ".$db->escape($search_supervisor); if ($search_supervisor > 0) $sql.= " AND u.fk_user IN (".$db->escape($search_supervisor).")";
if ($search_thirdparty != '') $sql.= natural_search(array('s.nom'), $search_thirdparty); if ($search_thirdparty != '') $sql.= natural_search(array('s.nom'), $search_thirdparty);
if ($search_login != '') $sql.= natural_search("u.login", $search_login); if ($search_login != '') $sql.= natural_search("u.login", $search_login);
if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname); if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname);
@ -360,9 +360,12 @@ if (! empty($arrayfields['u.entity']['checked']))
{ {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
// Supervisor
if (! empty($arrayfields['u.fk_user']['checked'])) if (! empty($arrayfields['u.fk_user']['checked']))
{ {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre">';
print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, array(), 0, '', 0, 0, 0, 0, '', 0, '', 'maxwidth200');
print '</td>';
} }
if (! empty($arrayfields['u.datelastlogin']['checked'])) if (! empty($arrayfields['u.datelastlogin']['checked']))
{ {
@ -665,6 +668,7 @@ while ($i < min($num,$limit))
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }