Merge branch 'develop' into new_branch_04_02_2019

This commit is contained in:
Laurent Destailleur 2019-02-08 09:42:18 +01:00 committed by GitHub
commit 0e42e8824b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
121 changed files with 2127 additions and 2087 deletions

View File

@ -7,8 +7,12 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
# PHP PSR-2 Coding Standards
# http://www.php-fig.org/psr/psr-2/
[*.php]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.js]
indent_style = tab

View File

@ -20,8 +20,8 @@
*/
/**
* \file dev/initdata/generate-order.php
* \brief Script example to inject random orders (for load tests)
* \file dev/initdata/generate-order.php
* \brief Script example to inject random orders (for load tests)
*/
// Test si mode batch
@ -113,13 +113,13 @@ $societesid = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe where client in (1, 3)";
$resql=$db->query($sql);
if ($resql) {
$num_thirdparties = $db->num_rows($resql);
$i = 0;
while ($i < $num_thirdparties) {
$i++;
$row = $db->fetch_row($resql);
$societesid[$i] = $row[0];
}
$num_thirdparties = $db->num_rows($resql);
$i = 0;
while ($i < $num_thirdparties) {
$i++;
$row = $db->fetch_row($resql);
$societesid[$i] = $row[0];
}
}
else { print "err"; }
@ -127,35 +127,32 @@ $commandesid = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande";
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$i++;
$row = $db->fetch_row($resql);
$commandesid[$i] = $row[0];
}
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$i++;
$row = $db->fetch_row($resql);
$commandesid[$i] = $row[0];
}
}
else { print "err"; }
$prodids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
$resql = $db->query($sql);
if ($resql)
{
$num_prods = $db->num_rows($resql);
$i = 0;
while ($i < $num_prods)
{
$i++;
if ($resql) {
$num_prods = $db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
$i++;
$row = $db->fetch_row($resql);
$prodids[$i] = $row[0];
$row = $db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
print "Build ".GEN_NUMBER_COMMANDE." orders\n";
for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
{
@ -173,18 +170,18 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$object->cond_reglement_id = mt_rand(0, 2);
$object->more_reglement_id = mt_rand(0, 7);
$object->availability_id = mt_rand(0, 1);
$listofuserid=array(12,13,16);
$fuser = new User($db);
$fuser->fetch($listofuserid[mt_rand(0, 2)]);
$fuser->getRights();
$db->begin();
$result=$object->create($fuser);
if ($result >= 0)
{
if ($result >= 0)
{
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp)
@ -200,23 +197,23 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$xnbp++;
}
$result=$object->valid($fuser);
if ($result > 0)
{
$result=$object->valid($fuser);
if ($result > 0)
{
$db->commit();
print " OK with ref ".$object->ref."\n";
}
else
{
}
else
{
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
}
else
{
$db->rollback();
dol_print_error($db, $object->error);
}
}
else
{
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
$db->rollback();
dol_print_error($db, $object->error);
}
}

View File

@ -170,6 +170,8 @@
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>

View File

@ -541,8 +541,8 @@ if ($id)
print $valuetoshow;
}
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
print '<td>';

View File

@ -495,8 +495,8 @@ if ($id)
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
print '<td>';

View File

@ -444,8 +444,8 @@ if ($id)
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
print '<td>';

View File

@ -280,7 +280,7 @@ if (! empty($search_credit)) {
if (! empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code=' . urlencode($search_lettering_code);
}
}
if ($action == 'delbookkeeping') {

View File

@ -326,11 +326,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) {
for($i = 1; $i <= 12; $i ++) {
print '<td class="right">' . price($row[$i]) . '</td>';
}
print '<td class="right"><b>' . price($row[13]) . '</b></td>';

View File

@ -328,15 +328,15 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) {
for($i = 1; $i <= 12; $i ++) {
print '<td class="right">' . price($row[$i]) . '</td>';
}
print '<td class="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';

View File

@ -2767,7 +2767,7 @@ class Adherent extends CommonObject
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
dol_syslog("sendReminderForExpiredSubscription Language set to ".$outputlangs->defaultlang);
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;

View File

@ -105,14 +105,14 @@ class Subscription extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
if ($this->fk_type == null) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$type=$member->typeid;
} else {
$type=$this->fk_type;
}
if ($this->fk_type == null) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$type=$member->typeid;
} else {
$type=$this->fk_type;
}
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',";

View File

@ -157,15 +157,16 @@ if ($mode)
'lastdate'=>$db->jdate($obj->lastdate)
);
}
if ($mode == 'memberbyregion') //+
if ($mode == 'memberbyregion') //+
{
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
$data[]=array(
'label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
);
}
}
if ($mode == 'memberbystate')
{
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),

View File

@ -673,7 +673,7 @@ if ($rowid > 0)
$sql.= " c.datef,";
$sql.= " c.fk_bank,";
$sql.= " b.rowid as bid,";
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number";
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
@ -726,8 +726,9 @@ if ($rowid > 0)
$accountstatic->id=$objp->baid;
$accountstatic->number=$objp->number;
$accountstatic->account_number=$objp->account_number;
$accountstatic->currency_code=$objp->currency_code;
if (! empty($conf->accounting->enabled))
if (! empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0)
{
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal);

View File

@ -308,17 +308,17 @@ if ($rowid && $action != 'edit')
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Type
print '<tr>';
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
print '<td class="valeur">';
if ( ! empty($object->fk_type) ) {
$adht->fetch($object->fk_type);
print $adht->getNomUrl(1);
} else {
print $langs->trans("NoType");
}
if (! empty($object->fk_type) ) {
$adht->fetch($object->fk_type);
print $adht->getNomUrl(1);
} else {
print $langs->trans("NoType");
}
print '</td></tr>';
// Member

View File

@ -460,7 +460,7 @@ while ($i < min($num, $limit))
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
$adht = new AdherentType($db);
$adht = new AdherentType($db);
$adht->fetch($obj->fk_type);
print '<tr class="oddeven">';
@ -471,13 +471,13 @@ while ($i < min($num, $limit))
print '<td>'.$subscription->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type
if (! empty($arrayfields['d.fk_type']['checked']))
// Type
if (! empty($arrayfields['d.fk_type']['checked']))
{
print '<td>';
if ( ! empty($obj->fk_type) ) print $adht->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
print '<td>';
if ( ! empty($obj->fk_type) ) print $adht->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Lastname

View File

@ -1117,19 +1117,19 @@ if ($id)
if ($id == 2) // Special cas for state page
{
if ($fieldlist[$field]=='region_id') { $valuetoshow='&nbsp;'; $showfield=1; }
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
if ($fieldlist[$field]=='region_id') { $valuetoshow='&nbsp;'; $showfield=1; }
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
}
if ($valuetoshow != '')
{
print '<td'.($class?' class="'.$class.'"':'').'>';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow;
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
if ($id == 4) print '<td></td>';

View File

@ -127,7 +127,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($action == 'testunsubscribe')
{
$result=$mailmanspip->del_to_mailman($object);
if ($result < 0)
if ($result < 0)
{
$error++;
setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
@ -160,7 +160,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$link.=$langs->trans("Disable");
@ -200,10 +200,10 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
</script>';
form_constantes($constantes, 2);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
@ -213,7 +213,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
else
{
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$link.=img_$langs->trans("Activate")
$link.=img_picto($langs->trans("Disabled"), 'switch_off');

View File

@ -545,7 +545,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
}
if ($tmpfieldlist == 'content')
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist);
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
if ($tmpfieldlist == 'content_lines')
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>';
// Input field

View File

@ -219,12 +219,12 @@ if ($action == 'add')
$menu->fk_menu=GETPOST('menuId', 'int');
}
else
{
if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu;
}
{
if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu;
}
$result=$menu->create($user);
if ($result > 0)

View File

@ -68,8 +68,7 @@ if (!function_exists('gzdecode')) {
* Action
*/
if ($action == 'addprinter' && $user->admin)
{
if ($action == 'addprinter' && $user->admin) {
$error=0;
$db->begin();
if (empty($printername)) {
@ -81,8 +80,7 @@ if ($action == 'addprinter' && $user->admin)
setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings');
}
if (! $error)
{
if (! $error) {
$result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
if ($result > 0) $error++;
@ -100,8 +98,7 @@ if ($action == 'addprinter' && $user->admin)
$action = '';
}
if ($action == 'deleteprinter' && $user->admin)
{
if ($action == 'deleteprinter' && $user->admin) {
$error=0;
$db->begin();
if (empty($printerid)) {
@ -109,8 +106,7 @@ if ($action == 'deleteprinter' && $user->admin)
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (! $error)
{
if (! $error) {
$result= $printer->DeletePrinter($printerid);
if ($result > 0) $error++;
@ -128,8 +124,7 @@ if ($action == 'deleteprinter' && $user->admin)
$action = '';
}
if ($action == 'updateprinter' && $user->admin)
{
if ($action == 'updateprinter' && $user->admin) {
$error=0;
$db->begin();
if (empty($printerid)) {
@ -137,18 +132,14 @@ if ($action == 'updateprinter' && $user->admin)
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (! $error)
{
if (! $error) {
$result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
if ($result > 0) $error++;
if (! $error)
{
if (! $error) {
$db->commit();
setEventMessages($langs->trans("PrinterUpdated", $printername), null);
}
else
{
} else {
$db->rollback();
dol_print_error($db);
}
@ -156,24 +147,19 @@ if ($action == 'updateprinter' && $user->admin)
$action = '';
}
if ($action == 'testprinter' && $user->admin)
{
if ($action == 'testprinter' && $user->admin) {
$error=0;
if (empty($printerid)) {
$error++;
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (! $error)
{
if (! $error) {
// test
$ret = $printer->SendTestToPrinter($printerid);
if ($ret == 0)
{
if ($ret == 0) {
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
}
else
{
} else {
setEventMessages($printer->error, $printer->errors, 'errors');
}
}
@ -181,8 +167,7 @@ if ($action == 'testprinter' && $user->admin)
}
if ($action == 'updatetemplate' && $user->admin)
{
if ($action == 'updatetemplate' && $user->admin) {
$error=0;
$db->begin();
if (empty($templateid)) {
@ -190,18 +175,14 @@ if ($action == 'updatetemplate' && $user->admin)
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
}
if (! $error)
{
if (! $error) {
$result= $printer->UpdateTemplate($templatename, $template, $templateid);
if ($result > 0) $error++;
if (! $error)
{
if (! $error) {
$db->commit();
setEventMessages($langs->trans("TemplateUpdated", $templatename), null);
}
else
{
} else {
$db->rollback();
dol_print_error($db);
}
@ -223,8 +204,7 @@ print load_fiche_titre($langs->trans("ReceiptPrinterSetup"), $linkback, 'title_s
$head = receiptprinteradmin_prepare_head($mode);
if ($mode == 'config' && $user->admin)
{
if ($mode == 'config' && $user->admin) {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
if ($action!='editprinter') {
@ -253,11 +233,9 @@ if ($mode == 'config' && $user->admin)
if ($ret > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
for ($line=0; $line < $nbofprinters; $line++)
{
for ($line=0; $line < $nbofprinters; $line++) {
print '<tr class="oddeven">';
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid)
{
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) {
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
@ -269,7 +247,7 @@ if ($mode == 'config' && $user->admin)
print '<td></td>';
print '<td></td>';
print '</tr>';
} else {
} else {
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_type_name']).'</td>';
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
@ -291,10 +269,8 @@ if ($mode == 'config' && $user->admin)
}
}
if ($action!='editprinter')
{
if ($nbofprinters > 0)
{
if ($action!='editprinter') {
if ($nbofprinters > 0) {
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
@ -357,8 +333,7 @@ if ($mode == 'config' && $user->admin)
dol_fiche_end();
}
if ($mode == 'template' && $user->admin)
{
if ($mode == 'template' && $user->admin) {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
if ($action!='edittemplate') {
@ -429,8 +404,7 @@ if ($mode == 'template' && $user->admin)
print '<th>'.$langs->trans("Description").'</th>';
print "</tr>\n";
$max = count($printer->tags);
for ($tag=0; $tag < $max; $tag++)
{
for ($tag=0; $tag < $max; $tag++) {
print '<tr class="oddeven">';
print '<td>&lt;'.$printer->tags[$tag].'&gt;</td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
print '</tr>';

View File

@ -98,17 +98,16 @@ print '<br>';
$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook');
foreach($arrayofsocialnetworks as $snkey => $snlabel)
{
$consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey);
if ($conf->use_javascript_ajax) {
$link = ajax_constantonoff($consttocheck);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
$link = $form->selectarray($consttocheck, $arrval, $conf->global->$consttocheck);
}
print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'<br><br>';
foreach($arrayofsocialnetworks as $snkey => $snlabel) {
$consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey);
if ($conf->use_javascript_ajax) {
$link = ajax_constantonoff($consttocheck);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
$link = $form->selectarray($consttocheck, $arrval, $conf->global->$consttocheck);
}
print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'<br><br>';
}

View File

@ -35,14 +35,15 @@ $what=GETPOST('what', 'alpha');
$export_type=GETPOST('export_type', 'alpha');
$file=GETPOST('filename_template', '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 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date";
if ($page < 0) { $page = 0; }
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $user->admin) accessforbidden();

View File

@ -478,8 +478,8 @@ if ($id)
}
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
print '<td colspan="4">';

View File

@ -89,15 +89,14 @@ foreach ($modulesdir as $dir)
$obj = 'facture';
}
if ($module == 'ficheinter') {
$obj = 'fichinter';
$part = 'fichinter';
$module='fichinter';
}
$obj = 'fichinter';
$part = 'fichinter';
$module='fichinter';
}
if (empty($conf->$module->enabled)) $enabled=false;
if (empty($conf->$module->enabled)) $enabled=false;
if ($enabled)
{
if ($enabled) {
/*
* If exists, load the API class for enable module
*

View File

@ -921,8 +921,8 @@ class BlockedLog
* @param int $beforeid ID of a record
* @return string Hash of previous record (if beforeid is defined) or hash of last record (if beforeid is 0)
*/
public function getPreviousHash($withlock = 0, $beforeid = 0)
{
public function getPreviousHash($withlock = 0, $beforeid = 0)
{
global $conf;
$previoussignature='';

View File

@ -55,8 +55,8 @@ class Categories extends DolibarrApi
*/
function __construct()
{
global $db, $conf;
$this->db = $db;
global $db, $conf;
$this->db = $db;
$this->category = new Categorie($this->db);
}
@ -67,25 +67,25 @@ class Categories extends DolibarrApi
*
* @param int $id ID of category
* @return array|mixed data without useless information
*
*
* @throws RestException
*/
function get($id)
{
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}
$result = $this->category->fetch($id);
if( ! $result ) {
if ( ! $result ) {
throw new RestException(404, 'category not found');
}
if( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->category);
return $this->_cleanObjectDatas($this->category);
}
/**
@ -101,7 +101,7 @@ class Categories extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of category objects
*
* @throws RestException
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
{
@ -109,9 +109,9 @@ class Categories extends DolibarrApi
$obj_ret = array();
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as t";
@ -127,7 +127,7 @@ class Categories extends DolibarrApi
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -145,7 +145,7 @@ class Categories extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
$i=0;
$i=0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
@ -164,7 +164,7 @@ class Categories extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No category found');
}
return $obj_ret;
return $obj_ret;
}
/**
@ -176,8 +176,8 @@ class Categories extends DolibarrApi
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
}
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -201,17 +201,17 @@ class Categories extends DolibarrApi
function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
}
throw new RestException(401);
}
$result = $this->category->fetch($id);
if( ! $result ) {
throw new RestException(404, 'category not found');
}
if( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
@ -224,7 +224,7 @@ class Categories extends DolibarrApi
}
else
{
throw new RestException(500, $this->category->error);
throw new RestException(500, $this->category->error);
}
}
@ -237,16 +237,16 @@ class Categories extends DolibarrApi
function delete($id)
{
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
throw new RestException(401);
}
throw new RestException(401);
}
$result = $this->category->fetch($id);
if( ! $result ) {
throw new RestException(404, 'category not found');
}
if( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (! $this->category->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when delete category');

View File

@ -1291,7 +1291,7 @@ class ActionComm extends CommonObject
if (! empty($this->location))
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
if (! empty($this->note))
$tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . (dol_textishtml($this->note) ? str_replace(array("\r","\n"), "", $this->note) : $this->note);
$tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . (dol_textishtml($this->note) ? str_replace(array("\r","\n"), "", $this->note) : str_replace(array("\r","\n"), '<br>', $this->note));
$linkclose='';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
$linkclose = ' style="background-color:#'.$this->type_color.'"';

View File

@ -58,7 +58,7 @@ class AgendaEvents extends DolibarrApi
*
* @param int $id ID of Agenda Events
* @return array|mixed Data without useless information
*
*
* @throws RestException
*/
function get($id)
@ -83,7 +83,7 @@ class AgendaEvents extends DolibarrApi
$result = $this->actioncomm->fetch_optionals();
$this->actioncomm->fetchObjectLinked();
return $this->_cleanObjectDatas($this->actioncomm);
return $this->_cleanObjectDatas($this->actioncomm);
}
/**
@ -116,7 +116,7 @@ class AgendaEvents extends DolibarrApi
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
if (empty($conf->societe->enabled)) $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists
if (empty($conf->societe->enabled)) $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists
$sql = "SELECT t.id as rowid";
if (! empty($conf->societe->enabled))
@ -160,7 +160,7 @@ class AgendaEvents extends DolibarrApi
if ($result)
{
$i=0;
$i=0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
@ -179,7 +179,7 @@ class AgendaEvents extends DolibarrApi
if ( ! count($obj_ret)) {
throw new RestException(404, 'No Agenda Event found');
}
return $obj_ret;
return $obj_ret;
}
/**
@ -190,12 +190,12 @@ class AgendaEvents extends DolibarrApi
*/
function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
}
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
}
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -229,21 +229,21 @@ class AgendaEvents extends DolibarrApi
/*
function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
}
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
}
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
$result = $this->actioncomm->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'actioncomm not found');
}
if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->actioncomm->$field = $value;
@ -266,13 +266,13 @@ class AgendaEvents extends DolibarrApi
function delete($id)
{
if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
throw new RestException(401, "Insuffisant rights to delete your Agenda Event");
}
throw new RestException(401, "Insuffisant rights to delete your Agenda Event");
}
$result = $this->actioncomm->fetch($id);
if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) {
throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
if( ! $result ) {

View File

@ -876,31 +876,31 @@ class AdvanceTargetingMailing extends CommonObject
foreach($extralabels as $key=>$val) {
if (($extrafields->attribute_type[$key] == 'varchar') ||
($extrafields->attribute_type[$key] == 'text')) {
if (!empty($arrayquery['options_'.$key])) {
$sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')";
}
} elseif (($extrafields->attribute_type[$key] == 'int') ||
($extrafields->attribute_type[$key] == 'double')) {
if (!empty($arrayquery['options_'.$key.'_max'])) {
$sqlwhere[]= " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")";
}
} elseif (($extrafields->attribute_type[$key] == 'date') ||
($extrafields->attribute_type[$key] == 'datetime')) {
if (!empty($arrayquery['options_'.$key.'_end_dt'])){
$sqlwhere[]= " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')";
}
}elseif ($extrafields->attribute_type[$key] == 'boolean') {
if ($arrayquery['options_'.$key]!=''){
$sqlwhere[]= " (tse.".$key." = ".$arrayquery['options_'.$key].")";
}
}else{
if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[]= " (tse.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
} elseif (!empty($arrayquery['options_'.$key])) {
$sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')";
}
}
($extrafields->attribute_type[$key] == 'text')) {
if (!empty($arrayquery['options_'.$key])) {
$sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')";
}
} elseif (($extrafields->attribute_type[$key] == 'int') ||
($extrafields->attribute_type[$key] == 'double')) {
if (!empty($arrayquery['options_'.$key.'_max'])) {
$sqlwhere[]= " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")";
}
} elseif (($extrafields->attribute_type[$key] == 'date') ||
($extrafields->attribute_type[$key] == 'datetime')) {
if (!empty($arrayquery['options_'.$key.'_end_dt'])){
$sqlwhere[]= " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')";
}
} elseif ($extrafields->attribute_type[$key] == 'boolean') {
if ($arrayquery['options_'.$key]!=''){
$sqlwhere[]= " (tse.".$key." = ".$arrayquery['options_'.$key].")";
}
} else {
if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[]= " (tse.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
} elseif (!empty($arrayquery['options_'.$key])) {
$sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')";
}
}
}
}
}

View File

@ -109,20 +109,19 @@ if (is_resource($handle))
print '<tr class="oddeven">';
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$i = 0;
while ($i < $num )
while ($i < $num )
{
$obj = $db->fetch_object($result);
print '<td>'.img_object('', $mailmodule->picto).' '.$obj->label.'</td><td class="right">'.$obj->nb.'<td>';
$i++;
$obj = $db->fetch_object($result);
print '<td>'.img_object('', $mailmodule->picto).' '.$obj->label.'</td><td class="right">'.$obj->nb.'<td>';
$i++;
}
$db->free($result);
$db->free($result);
}
else
{
@ -154,45 +153,44 @@ $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql.= " ORDER BY m.date_creat DESC";
$sql.= " LIMIT ".$limit;
$result=$db->query($sql);
if ($result)
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("LastMailings", $limit).'</td>';
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
print '<td align="center">'.$langs->trans("NbOfEMails").'</td>';
print '<td class="right"><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("AllEMailings").'</a></td></tr>';
if ($result) {
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("LastMailings", $limit).'</td>';
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
print '<td align="center">'.$langs->trans("NbOfEMails").'</td>';
print '<td class="right"><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("AllEMailings").'</a></td></tr>';
$num = $db->num_rows($result);
if ($num > 0)
{
$i = 0;
while ($i < $num )
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEMail"), "email").' '.$obj->rowid.'</a></td>';
print '<td>'.dol_trunc($obj->titre, 38).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_creat), 'day').'</td>';
print '<td align="center">'.($obj->nbemail?$obj->nbemail:"0").'</td>';
$mailstatic=new Mailing($db);
print '<td class="right">'.$mailstatic->LibStatut($obj->statut, 5).'</td>';
print '</tr>';
$i++;
}
}
else
$num = $db->num_rows($result);
if ($num > 0)
{
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$i = 0;
while ($i < $num )
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEMail"), "email").' '.$obj->rowid.'</a></td>';
print '<td>'.dol_trunc($obj->titre, 38).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_creat), 'day').'</td>';
print '<td align="center">'.($obj->nbemail?$obj->nbemail:"0").'</td>';
$mailstatic=new Mailing($db);
print '<td class="right">'.$mailstatic->LibStatut($obj->statut, 5).'</td>';
print '</tr>';
$i++;
}
}
print "</table><br>";
$db->free($result);
else
{
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print "</table><br>";
$db->free($result);
}
else
{
dol_print_error($db);
dol_print_error($db);
}
@ -207,7 +205,7 @@ if ($langs->file_exists("html/spam.html", 0)) {
print '</div>';
print '<br>';
}
}
// End of page
llxFooter();

View File

@ -184,11 +184,11 @@ class Proposals extends DolibarrApi
*/
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
$this->propal->$field = $value;
@ -218,24 +218,24 @@ class Proposals extends DolibarrApi
*/
function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->propal->getLinesArray();
$result = array();
foreach ($this->propal->lines as $line) {
array_push($result, $this->_cleanObjectDatas($line));
}
return $result;
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->propal->getLinesArray();
$result = array();
foreach ($this->propal->lines as $line) {
array_push($result, $this->_cleanObjectDatas($line));
}
return $result;
}
/**
@ -266,7 +266,7 @@ class Proposals extends DolibarrApi
$request_data = (object) $request_data;
$updateRes = $this->propal->addline(
$updateRes = $this->propal->addline(
$request_data->desc,
$request_data->subprice,
$request_data->qty,
@ -293,15 +293,14 @@ class Proposals extends DolibarrApi
$request_data->origin_id,
$request_data->multicurrency_subprice,
$request_data->fk_remise_except
);
);
if ($updateRes > 0) {
return $updateRes;
}
else {
throw new RestException(400, $this->propal->error);
}
}
if ($updateRes > 0) {
return $updateRes;
} else {
throw new RestException(400, $this->propal->error);
}
}
/**
* Update a line of given commercial proposal
@ -360,14 +359,14 @@ class Proposals extends DolibarrApi
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
);
);
if ($updateRes > 0) {
$result = $this->get($id);
unset($result->line);
return $this->_cleanObjectDatas($result);
}
return false;
if ($updateRes > 0) {
$result = $this->get($id);
unset($result->line);
return $this->_cleanObjectDatas($result);
}
return false;
}
/**
@ -386,7 +385,7 @@ class Proposals extends DolibarrApi
function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
throw new RestException(401);
}
$result = $this->propal->fetch($id);
@ -417,12 +416,12 @@ class Proposals extends DolibarrApi
* @param array $request_data Datas
*
* @return int
*/
*/
function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
@ -654,35 +653,35 @@ class Proposals extends DolibarrApi
*/
function setinvoiced($id)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user );
if ($result < 0) {
throw new RestException(500, 'Error : '.$this->propal->error);
}
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user );
if ($result < 0) {
throw new RestException(500, 'Error : '.$this->propal->error);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
$result = $this->propal->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->propal->fetchObjectLinked();
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
return $this->_cleanObjectDatas($this->propal);
}

View File

@ -1063,13 +1063,13 @@ class Propal extends CommonObject
for ($i=0;$i<$num;$i++)
{
if (! is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API
{ // Convert into object this->lines[$i].
$line = (object) $this->lines[$i];
}
else
{
$line = $this->lines[$i];
}
{ // Convert into object this->lines[$i].
$line = (object) $this->lines[$i];
}
else
{
$line = $this->lines[$i];
}
// Reset fk_parent_line for line that are not child lines or special product
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
$fk_parent_line = 0;

View File

@ -24,10 +24,9 @@
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
if (empty($conf) || ! is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
}
?>
@ -54,12 +53,13 @@ foreach($linkedObjectBlock as $key => $objectlink)
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?>
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
}
?>
<?php
if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
}
?>
</td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
@ -86,7 +86,7 @@ if (count($linkedObjectBlock) > 1)
<td class="right"></td>
<td class="right"></td>
</tr>
<?php
<?php
}
?>

View File

@ -3,7 +3,7 @@
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -183,13 +183,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
foreach($sqls as $sql){
$resql = $db->query($sql);
if($resql){
while($sqlobj = $db->fetch_object($resql)){
if ($resql) {
while ($sqlobj = $db->fetch_object($resql)) {
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($resql);
}else{
} else {
$error++;
}
}

View File

@ -112,16 +112,16 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
if ($resd)
{
$numd = $db->num_rows($resd);
$numd = $db->num_rows($resd);
$tmpinvoice=new Facture($db);
$tmpinvoicesupplier=new FactureFournisseur($db);
$tmpdonation=new Don($db);
$tmpinvoice=new Facture($db);
$tmpinvoicesupplier=new FactureFournisseur($db);
$tmpdonation=new Don($db);
$upload_dir ='';
$i=0;
while($i<$numd)
{
$upload_dir ='';
$i=0;
while($i<$numd)
{
$objd = $db->fetch_object($resd);
switch($objd->item)
@ -197,14 +197,14 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
}
}
$i++;
}
}
else
{
dol_print_error($db);
}
}
}
else
{
dol_print_error($db);
}
$db->free($resd);
$db->free($resd);
}
/*
@ -315,57 +315,57 @@ if (!empty($date_start) && !empty($date_stop))
if ($result)
{
$TData = dol_sort_array($filesarray, 'date', 'ASC');
if(empty($TData)) {
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
} else {
// Sort array by date ASC to calucalte balance
if(empty($TData)) {
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
} else {
// Sort array by date ASC to calucalte balance
$totalDebit = 0;
$totalCredit = 0;
// Balance calculation
$balance = 0;
foreach($TData as &$data1) {
if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
$data1['amount']=-$data1['amount'];
}
if ($data1['amount']>0){
}else{
}
$balance += $data1['amount'];
$data1['balance'] = $balance;
}
// Display array
foreach($TData as $data) {
$html_class = '';
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
print '<tr class="oddeven '.$html_class.'">';
print "<td align=\"center\">";
print dol_print_date($data['date'], 'day');
print "</td>\n";
print '<td aling="left">'.$data['item'].'</td>';
print '<td aling="left">'.$data['ref'].'</td>';
// File link
print '<td><a href='.DOL_URL_ROOT.'/'.$data['link'].">".$data['name']."</a></td>\n";
print '<td aling="left">'.$data['paid'].'</td>';
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
// Balance
print '<td align="right">'.price($data['balance'])."</td>\n";
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="5">&nbsp;</td>';
print '<td align="right">'.price($totalDebit).'</td>';
print '<td align="right">'.price($totalCredit).'</td>';
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
print "</tr>\n";
}
$totalDebit = 0;
$totalCredit = 0;
// Balance calculation
$balance = 0;
foreach($TData as &$data1) {
if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
$data1['amount']=-$data1['amount'];
}
if ($data1['amount']>0){
}else{
}
$balance += $data1['amount'];
$data1['balance'] = $balance;
}
// Display array
foreach($TData as $data) {
$html_class = '';
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
print '<tr class="oddeven '.$html_class.'">';
print "<td align=\"center\">";
print dol_print_date($data['date'], 'day');
print "</td>\n";
print '<td aling="left">'.$data['item'].'</td>';
print '<td aling="left">'.$data['ref'].'</td>';
// File link
print '<td><a href='.DOL_URL_ROOT.'/'.$data['link'].">".$data['name']."</a></td>\n";
print '<td aling="left">'.$data['paid'].'</td>';
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
// Balance
print '<td align="right">'.price($data['balance'])."</td>\n";
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="5">&nbsp;</td>';
print '<td align="right">'.price($totalDebit).'</td>';
print '<td align="right">'.price($totalCredit).'</td>';
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
print "</tr>\n";
}
}
print "</table>";
print '</div>';
}

View File

@ -837,12 +837,12 @@ if (empty($reshook))
$type = GETPOST('type');
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
// Check parameters
if (GETPOST('type') < 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
// Check parameters
if (GETPOST('type') < 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
}
if ($qty < 0) {
$langs->load("errors");
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
@ -1481,13 +1481,13 @@ else
}
else
{
if ($object->frequency > 0)
{
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
}
else
{
print $langs->trans("NotARecurringInvoiceTemplate");
if ($object->frequency > 0)
{
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
}
else
{
print $langs->trans("NotARecurringInvoiceTemplate");
}
}
print '</td></tr>';

View File

@ -582,12 +582,12 @@ if ($resql)
}
if ($user->rights->facture->supprimer) {
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
$arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft");
$arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft");
}
elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
$arrayofmassactions['predelete'] = $langs->trans("Delete");
}
}
elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
$arrayofmassactions['predelete'] = $langs->trans("Delete");
}
}
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -66,22 +66,20 @@ print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
print "</tr>\n";
if ($resql)
{
if ($row = $db->fetch_row($resql) )
{
$num = $row[0];
if ($resql) {
if ($row = $db->fetch_row($resql) ) {
$num = $row[0];
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '</td></tr>';
print "</table>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '</td></tr>';
print "</table>\n";
}
else
{
dol_print_error($db);
dol_print_error($db);
}

View File

@ -553,8 +553,8 @@ class Paiement extends CommonObject
{
$this->db->rollback();
return -1;
}
// End call triggers
}
// End call triggers
}
// Delete payment (into paiement_facture and paiement)

View File

@ -88,8 +88,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
$page = 0;
$offset = 0;
}
}
@ -98,89 +98,89 @@ $sql.= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$num = $db->num_rows($result);
$i = 0;
$urladd= "&amp;statut=".$statut;
$urladd= "&amp;statut=".$statut;
$selectedfields='';
$selectedfields='';
$newcardbutton='';
if ($user->rights->prelevement->bons->creer)
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php"><span class="valignmiddle">'.$langs->trans('NewStandingOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
// Lines of title fields
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_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', '', 'class="liste_titre"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", "", 'class="liste_titre" align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
print "</tr>\n";
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven"><td>';
print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td align="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td align="right"></td>'."\n";
print "</tr>\n";
$i++;
$newcardbutton='';
if ($user->rights->prelevement->bons->creer)
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php"><span class="valignmiddle">'.$langs->trans('NewStandingOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
print "</table>";
print '</div>';
print '</form>';
// Lines of title fields
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.'">';
$db->free($result);
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', '', 'class="liste_titre"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", "", 'class="liste_titre" align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
print "</tr>\n";
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven"><td>';
print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td align="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td align="right"></td>'."\n";
print "</tr>\n";
$i++;
}
print "</table>";
print '</div>';
print '</form>';
$db->free($result);
}
else
{
dol_print_error($db);
dol_print_error($db);
}
// End of page

View File

@ -162,9 +162,9 @@ if ($nb) {
} else {
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL">' . $langs->trans("CreateAll") . "</a>\n";
}
}
else
{
}
else
{
if ($mysoc->isInEEC())
{
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
@ -178,7 +178,7 @@ if ($nb) {
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
}
print "</div>\n";

View File

@ -59,9 +59,9 @@ $date_endmonth = GETPOST("date_endmonth");
$date_endday = GETPOST("date_endday");
if (empty($year))
{
$year_current = strftime("%Y", dol_now());
$month_current = strftime("%m", dol_now());
$year_start = $year_current;
$year_current = strftime("%Y", dol_now());
$month_current = strftime("%m", dol_now());
$year_start = $year_current;
} else {
$year_current = $year;
$month_current = strftime("%m", dol_now());
@ -211,7 +211,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql.= " WHERE f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2,5)";
} else {
} else {
$sql.= " AND f.type IN (0,1,2,3,5)";
}
if ($date_start && $date_end) {
@ -243,12 +243,12 @@ if ($result) {
$i=0;
while ($i < $num) {
$obj = $db->fetch_object($result);
$amount_ht[$obj->rowid] = $obj->amount;
$amount[$obj->rowid] = $obj->amount_ttc;
$name[$obj->rowid] = $obj->name.' '.$obj->firstname;
$catotal_ht+=$obj->amount;
$catotal+=$obj->amount_ttc;
$i++;
$amount_ht[$obj->rowid] = $obj->amount;
$amount[$obj->rowid] = $obj->amount_ttc;
$name[$obj->rowid] = $obj->name.' '.$obj->firstname;
$catotal_ht+=$obj->amount;
$catotal+=$obj->amount_ttc;
$i++;
}
} else {
dol_print_error($db);
@ -302,7 +302,7 @@ print_liste_field_titre(
"",
$sortfield,
$sortorder
);
);
if ($modecompta == 'CREANCES-DETTES') {
print_liste_field_titre(
$langs->trans('AmountHT'),
@ -313,8 +313,8 @@ if ($modecompta == 'CREANCES-DETTES') {
'align="right"',
$sortfield,
$sortorder
);
} else {
);
} else {
print_liste_field_titre('');
}
print_liste_field_titre(
@ -326,7 +326,7 @@ print_liste_field_titre(
'align="right"',
$sortfield,
$sortorder
);
);
print_liste_field_titre(
$langs->trans("Percentage"),
$_SERVER["PHP_SELF"], "amount_ttc",
@ -335,7 +335,7 @@ print_liste_field_titre(
'align="right"',
$sortfield,
$sortorder
);
);
print_liste_field_titre(
$langs->trans("OtherStatistics"),
$_SERVER["PHP_SELF"],
@ -343,7 +343,7 @@ print_liste_field_titre(
"",
"",
'align="center" width="20%"'
);
);
print "</tr>\n";
if (count($amount)) {
@ -390,22 +390,22 @@ if (count($amount)) {
}
print "<td>".$linkname."</td>\n";
// Amount w/o VAT
// Amount w/o VAT
print '<td align="right">';
if ($modecompta != 'CREANCES-DETTES')
{
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">';
}
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">';
}
} else {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
} else {
print '<a href="#">';
}
print price($amount_ht[$key]);
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
} else {
print '<a href="#">';
}
print price($amount_ht[$key]);
}
print '</td>';
@ -413,16 +413,16 @@ if (count($amount)) {
print '<td align="right">';
if ($modecompta != 'CREANCES-DETTES') {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">';
}
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">';
}
} else {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
} else {
print '<a href="#">';
}
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
} else {
print '<a href="#">';
}
}
print price($amount[$key]);
print '</td>';
@ -433,14 +433,14 @@ if (count($amount)) {
// Other stats
print '<td align="center">';
if (! empty($conf->propal->enabled) && $key>0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"), "stats").'</a>&nbsp;';
}
print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"), "stats").'</a>&nbsp;';
}
if (! empty($conf->commande->enabled) && $key>0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"), "stats").'</a>&nbsp;';
}
print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"), "stats").'</a>&nbsp;';
}
if (! empty($conf->facture->enabled) && $key>0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"), "stats").'</a>&nbsp;';
}
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"), "stats").'</a>&nbsp;';
}
print '</td>';
print "</tr>\n";
$i++;
@ -450,9 +450,9 @@ if (count($amount)) {
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>';
print '<td colspan="1"></td>';
} else {
print '<td align="right">'.price($catotal_ht).'</td>';
print '<td align="right">'.price($catotal_ht).'</td>';
}
print '<td align="right">'.price($catotal).'</td>';
print '<td>&nbsp;</td>';

View File

@ -451,9 +451,9 @@ if ($modecompta == 'CREANCES-DETTES') {
'align="right"',
$sortfield,
$sortorder
);
} else {
print_liste_field_titre('');
);
} else {
print_liste_field_titre('');
}
print_liste_field_titre(
$langs->trans("AmountTTC"),
@ -464,7 +464,7 @@ print_liste_field_titre(
'align="right"',
$sortfield,
$sortorder
);
);
print_liste_field_titre(
$langs->trans("Percentage"),
$_SERVER["PHP_SELF"],
@ -474,7 +474,7 @@ print_liste_field_titre(
'align="right"',
$sortfield,
$sortorder
);
);
print_liste_field_titre(
$langs->trans("OtherStatistics"),
$_SERVER["PHP_SELF"],
@ -482,7 +482,7 @@ print_liste_field_titre(
"",
"",
'align="center" width="20%"'
);
);
print "</tr>\n";
@ -569,34 +569,34 @@ if (count($amount)) {
// Amount w/o VAT
print '<td align="right">';
if ($modecompta != 'CREANCES-DETTES') {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?socid='.$key.'">';
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?socid='.$key.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?socid=-1">';
}
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?socid=-1">';
}
} else {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
} else {
print '<a href="#">';
print '<a href="#">';
}
print price($amount_ht[$key]);
print price($amount_ht[$key]);
}
print '</td>';
// Amount with VAT
print '<td align="right">';
if ($modecompta != 'CREANCES-DETTES') {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?socid='.$key.'">';
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?socid='.$key.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?orphelins=1">';
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?orphelins=1">';
}
} else {
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
} else {
print '<a href="#">';
print '<a href="#">';
}
}
print price($amount[$key]);
@ -609,18 +609,18 @@ if (count($amount)) {
// Other stats
print '<td align="center">';
if (! empty($conf->propal->enabled) && $key>0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"), "stats").'</a>&nbsp;';
}
print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"), "stats").'</a>&nbsp;';
}
if (! empty($conf->commande->enabled) && $key>0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("OrderStats"), "stats").'</a>&nbsp;';
}
print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("OrderStats"), "stats").'</a>&nbsp;';
}
if (! empty($conf->facture->enabled) && $key>0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"), "stats").'</a>&nbsp;';
}
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"), "stats").'</a>&nbsp;';
}
print '</td>';
print "</tr>\n";
$i++;
}
print "</tr>\n";
$i++;
}
// Total
print '<tr class="liste_total">';

View File

@ -1010,7 +1010,8 @@ class Contact extends CommonObject
}
// Removed extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { // For avoid conflicts if trigger used
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) {
// For avoid conflicts if trigger used
$result=$this->deleteExtraFields($this);
if ($result < 0) $error++;
}

View File

@ -186,9 +186,9 @@ class Contracts extends DolibarrApi
*/
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401, "Insuffisant rights");
}
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -220,9 +220,9 @@ class Contracts extends DolibarrApi
*/
function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->contrat->lire) {
if (! DolibarrApiAccess::$user->rights->contrat->lire) {
throw new RestException(401);
}
}
$result = $this->contract->fetch($id);
if( ! $result ) {

View File

@ -5434,8 +5434,7 @@ abstract class CommonObject
elseif (in_array($type, array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type))
{
$morecss = 'maxwidth75';
}elseif ($type == 'url')
{
} elseif ($type == 'url') {
$morecss='minwidth400';
}
elseif ($type == 'boolean')

View File

@ -1470,43 +1470,43 @@ class Form
$contactstatic->id=$obj->rowid;
$contactstatic->lastname=$obj->lastname;
$contactstatic->firstname=$obj->firstname;
if ($obj->statut == 1){
if ($htmlname != 'none')
{
$disabled=0;
if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) $disabled=1;
if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid, $limitto)) $disabled=1;
if (!empty($selected) && in_array($obj->rowid, $selected))
{
$out.= '<option value="'.$obj->rowid.'"';
if ($disabled) $out.= ' disabled';
$out.= ' selected>';
$out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
$out.= '</option>';
}
else
{
$out.= '<option value="'.$obj->rowid.'"';
if ($disabled) $out.= ' disabled';
$out.= '>';
$out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
$out.= '</option>';
}
}
else
{
if (in_array($obj->rowid, $selected))
{
$out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
}
}
}
if ($obj->statut == 1) {
if ($htmlname != 'none')
{
$disabled=0;
if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) $disabled=1;
if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid, $limitto)) $disabled=1;
if (!empty($selected) && in_array($obj->rowid, $selected))
{
$out.= '<option value="'.$obj->rowid.'"';
if ($disabled) $out.= ' disabled';
$out.= ' selected>';
$out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
$out.= '</option>';
}
else
{
$out.= '<option value="'.$obj->rowid.'"';
if ($disabled) $out.= ' disabled';
$out.= '>';
$out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
$out.= '</option>';
}
}
else
{
if (in_array($obj->rowid, $selected))
{
$out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
}
}
}
$i++;
}
}

View File

@ -1346,7 +1346,7 @@ class FormFile
print '<td'.(($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"').'>';
print '</td>';
}
}
}
}
else
{

View File

@ -713,5 +713,5 @@ class Menubase
$this->recur($tab, $tab[$x]['rowid'], ($level+1));
}
}
}
}
}

View File

@ -1403,32 +1403,28 @@ class DoliDBSqlite3 extends DoliDB
$weekday=self::calc_weekday($first_daynr, !$monday_first);
$calc_year=$year;
if ($month == 1 && $day <= 7-$weekday)
{
if ($month == 1 && $day <= 7-$weekday) {
if (!$week_year && (($first_weekday && $weekday != 0) || (!$first_weekday && $weekday >= 4)))
return 0;
$week_year= 1;
$calc_year--;
$first_daynr-= ($days=self::calc_days_in_year($calc_year));
$weekday= ($weekday + 53*7- $days) % 7;
}
if (($first_weekday && $weekday != 0) || (!$first_weekday && $weekday >= 4)) {
$days= $daynr - ($first_daynr+ (7-$weekday));
}
else {
$days= $daynr - ($first_daynr - $weekday);
}
if ($week_year && $days >= 52*7)
{
$weekday= ($weekday + self::calc_days_in_year($calc_year)) % 7;
if ((!$first_weekday && $weekday < 4) || ($first_weekday && $weekday == 0))
{
$calc_year++;
return 1;
}
}
return floor($days/7+1);
if (($first_weekday && $weekday != 0) || (!$first_weekday && $weekday >= 4)) {
$days= $daynr - ($first_daynr+ (7-$weekday));
} else {
$days= $daynr - ($first_daynr - $weekday);
}
if ($week_year && $days >= 52*7) {
$weekday= ($weekday + self::calc_days_in_year($calc_year)) % 7;
if ((!$first_weekday && $weekday < 4) || ($first_weekday && $weekday == 0)) {
$calc_year++;
return 1;
}
}
return floor($days/7+1);
}
}

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
*
* @param array $versionarray Tableau de version (vermajeur,vermineur,autre)
* @return string Chaine version
* @see versioncompare
*/
function versiontostring($versionarray)
{
@ -54,6 +55,7 @@ function versiontostring($versionarray)
* @return int -4,-3,-2,-1 if versionarray1<versionarray2 (value depends on level of difference)
* 0 if same
* 1,2,3,4 if versionarray1>versionarray2 (value depends on level of difference)
* @see versiontostring
*/
function versioncompare($versionarray1, $versionarray2)
{

View File

@ -2365,9 +2365,10 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
{//ex: +66_A_BCD_EF_GHI
$newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 3);
}
}
}
elseif (strtoupper($countrycode) == "MU")
{//Maurice
{
//Maurice
if(dol_strlen($phone) == 11)
{//ex: +230_ABC_DE_FG
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
@ -2514,9 +2515,11 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
}
}
elseif(strtoupper($countrycode) == "AU")
{//Australie
if(dol_strlen($phone) == 12)
{//ex: +61_A_BCDE_FGHI
{
//Australie
if(dol_strlen($phone) == 12)
{
//ex: +61_A_BCDE_FGHI
$newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4);
}
}
@ -2593,7 +2596,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone;
if ($adddivfloat) $rep.='</div>';
else $rep.='</span>';
}
}
return $rep;
}
@ -7085,7 +7088,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
}
elseif (count($values) == 5) // deprecated
{
dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING);
dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING);
if ($values[0] != $type) continue;
if ($values[3]) $langs->load($values[3]);

View File

@ -900,7 +900,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// First line of company infos
$line1=""; $line2=""; $line3=""; $line4="";
if ($showdetails == 1 || $showdetails == 3)
if ($showdetails == 1 || $showdetails == 3)
{
// Company name
if ($fromcompany->name)
@ -1969,9 +1969,9 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
}
else
$result.=price($sign * $total_ht, 0, $outputlangs);
}
}
}
return $result;
return $result;
}
/**

View File

@ -667,6 +667,10 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n";
$tplcontent.= "// END PHP ?>\n";
if (! empty($conf->global->WEBSITE_FORCE_DOCTYPE_HTML5))
{
$tplcontent.= "<!DOCTYPE html>\n";
}
$tplcontent.= '<html'.($shortlangcode ? ' lang="'.$shortlangcode.'"':'').'>'."\n";
$tplcontent.= '<head>'."\n";
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* Classe permettant de generer les projets au modele SEPAMandate
* Class to generate SEPA mandate
*/
class pdf_sepamandate extends ModeleBankAccountDoc

View File

@ -768,23 +768,22 @@ class pdf_einstein extends ModelePDFCommandes
$posy=$pdf->GetY()+1;
}
// Show payment mode
// Show payment mode
if ($object->mode_reglement_code
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR')
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode").':';
$pdf->MultiCell(80, 5, $titre, 0, 'L');
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode").':';
$pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$posy=$pdf->GetY()+2;
}
$posy=$pdf->GetY()+2;
}
// Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')

View File

@ -828,30 +828,29 @@ class pdf_eratosthene extends ModelePDFCommandes
$posy=$pdf->GetY()+1;
}
// Show payment mode
// Show payment mode
if ($object->mode_reglement_code
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR')
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode").':';
$pdf->MultiCell(80, 5, $titre, 0, 'L');
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode").':';
$pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$posy=$pdf->GetY()+2;
}
$posy=$pdf->GetY()+2;
}
// Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{
// Si mode reglement non force ou si force a CHQ
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{
// Si mode reglement non force ou si force a CHQ
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
{
$account = new Account($this->db);

View File

@ -294,12 +294,13 @@ class doc_generic_contract_odt extends ModelePDFContract
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{

View File

@ -1292,31 +1292,27 @@ class pdf_crabe extends ModelePDFFactures
foreach($localtax_rate as $tvakey => $tvaval)
{
// retrieve global local tax
if ($tvakey != 0) // On affiche pas taux 0
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/', $tvakey))
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/', $tvakey))
{
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
//}
}
}
//}
// Revenue stamp
if (price2num($object->revenuestamp) != 0)

View File

@ -1377,8 +1377,8 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
//}
}
}
//}
// Revenue stamp
if (price2num($object->revenuestamp) != 0)

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php';
*/
class mod_arctic extends ModeleNumRefFicheinter
{
/**
/**
* Dolibarr version of the loaded document
* @public string
*/
@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
// On d<EFBFBD>fini critere recherche compteur
// On défini critere recherche compteur
$mask=$conf->global->FICHINTER_ARTIC_MASK;
if (! $mask)
@ -142,14 +142,14 @@ class mod_arctic extends ModeleNumRefFicheinter
$numFinal=get_next_value($db, $mask, 'fichinter', 'ref', '', $objsoc, $object->datec);
return $numFinal;
}
}
/**
* Return next free value
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @param Object $objforref Object for number to search
* @return string Next free value
*/
function getNumRef($objsoc, $objforref)

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@products.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@products.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -321,12 +321,13 @@ class doc_generic_product_odt extends ModelePDFProduct
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{

View File

@ -425,19 +425,19 @@ class pdf_beluga extends ModelePDFProjects
$total_ttc = 0;
$num = count($elementarray);
// Loop on each lines
for ($i = 0; $i < $num; $i ++)
{
$curY = $nexY;
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
// Loop on each lines
for ($i = 0; $i < $num; $i ++)
{
$curY = $nexY;
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of line
$idofelement=$elementarray[$i];
// Description of line
$idofelement=$elementarray[$i];
if ($classname == 'ExpenseReport')
{
// We get id of expense report
@ -457,114 +457,114 @@ class pdf_beluga extends ModelePDFProjects
$qualifiedfortotal = false; // Replacement invoice
}
$showpricebeforepagebreak=1;
$showpricebeforepagebreak=1;
$pdf->startTransaction();
// Label
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
$forcedesconsamepage=1;
if ($forcedesconsamepage)
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->startTransaction();
// Label
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
$forcedesconsamepage=1;
if ($forcedesconsamepage)
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1;
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
}
}
//var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak);
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
}
}
//var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak);
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
//var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak);
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
}
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
//var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak);
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
}
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
$date = $element->date_commande;
else {
$date = $element->date;
if (empty($date))
$date = $element->datep;
if (empty($date))
$date = $element->date_contrat;
if (empty($date))
$date = $element->datev; // Fiche inter
}
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
$date = $element->date_commande;
else {
$date = $element->date;
if (empty($date))
$date = $element->datep;
if (empty($date))
$date = $element->date_contrat;
if (empty($date))
$date = $element->datev; // Fiche inter
}
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C');
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
if ($classname == 'ExpenseReport')
{
$fuser=new User($this->db);
$fuser->fetch($element->fk_user_author);
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L');
}
else
{
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L');
}
$pdf->SetXY($this->posxsociety, $curY);
if ($classname == 'ExpenseReport')
{
$fuser=new User($this->db);
$fuser->fetch($element->fk_user_author);
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L');
}
else
{
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L');
}
// Amount without tax
if (empty($value['disableamount'])) {

View File

@ -336,10 +336,10 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{

View File

@ -321,12 +321,13 @@ class doc_generic_stock_odt extends ModelePDFStock
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{

View File

@ -65,7 +65,7 @@ class doc_generic_user_odt extends ModelePDFUser
global $conf, $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main","companies"));
$langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";
@ -318,10 +318,10 @@ class doc_generic_user_odt extends ModelePDFUser
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{

View File

@ -320,10 +320,10 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{

View File

@ -235,7 +235,10 @@ if ($permission) {
</form>
<?php $i++; ?>
<?php } } ?>
<?php
}
}
?>
</div>
</div>

View File

@ -21,10 +21,9 @@
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
if (empty($conf) || ! is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
}
@ -61,19 +60,24 @@ print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disable
$colorbackhmenu1='60,70,100'; // topmenu
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1;
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1):(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1):(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
?>
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
<?php if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
<?php
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
// For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random'
?>
?>
<body class="body bodylogin" style="background-image: url('<?php echo $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND; ?>'); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; background-size: cover; background-color: #ffffff;">
<?php } else { ?>
<?php
} else {
?>
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
<?php } ?>
<?php
}
?>
<?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript">

View File

@ -193,16 +193,19 @@ $coldisplay=-1; // We remove first td
&nbsp;
<?php } ?>
</td>
<?php
<?php
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td class="nowrap right"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
}
if (! empty($usemargins))
{
?>
<?php if (!empty($user->rights->margins->creer)) { ?>
<td class="margininfos right"><?php $coldisplay++; ?>
if (!empty($user->rights->margins->creer)) {
?>
<td class="margininfos right">
<?php
$coldisplay++;
?>
<!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat right" style="display: none;"></select>
@ -211,30 +214,31 @@ $coldisplay=-1; // We remove first td
<input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
</td>
<?php } ?>
<?php if ($user->rights->margins->creer) {
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
{
$margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate", "alpha", 2):(($line->pa_ht == 0)?'':price($line->marge_tx)));
// if credit note, dont allow to modify margin
if ($line->subprice < 0)
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
else
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++;
}
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
{
$mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate", 'alpha', 2):price($line->marque_tx));
// if credit note, dont allow to modify margin
if ($line->subprice < 0)
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
else
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++;
}
}
<?php
if ($user->rights->margins->creer) {
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
{
$margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate", "alpha", 2):(($line->pa_ht == 0)?'':price($line->marge_tx)));
// if credit note, dont allow to modify margin
if ($line->subprice < 0)
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
else
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++;
}
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
{
$mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate", 'alpha', 2):price($line->marque_tx));
// if credit note, dont allow to modify margin
if ($line->subprice < 0)
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
else
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++;
}
}
}
?>
?>
<!-- colspan=4 for this td because it replace total_ht+3 td for buttons -->
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=4; ?>

View File

@ -204,13 +204,15 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
<?php } ?>
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
// I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
} else echo '&nbsp;'; ?>
<?php
if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
// I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
} else echo '&nbsp;';
?>
</td>
<?php
@ -308,9 +310,13 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
<?php } else { ?>
<td <?php echo (($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php } else { ?>
<?php
} else {
?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
<?php } ?>
<?php
}
?>
<?php if($action == 'selectlines'){ ?>
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
<?php } ?>

View File

@ -446,7 +446,7 @@ if ($num > 0)
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap">';
print '<td class="nowraponall">';
print $object->getNomUrl(1);
print '</td>';

View File

@ -206,8 +206,7 @@ class ActionsDatapolicy
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT . '/datapolicy/class/datapolicy.class.php';
DataPolicy::sendMailDataPolicyContact($object);
}
elseif ($parameters['currentcontext'] == 'membercard' && $action == 'send_datapolicy') {
} elseif ($parameters['currentcontext'] == 'membercard' && $action == 'send_datapolicy') {
$object->fetch(GETPOST('id'));
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/datapolicy/class/datapolicy.class.php';

View File

@ -258,7 +258,7 @@ Class DataPolicy
if ($message) {
if ($sendtocc) {
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
}
}
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg .= dol_concatdesc($actionmsg, $message);

View File

@ -46,9 +46,9 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td align="center"><?php echo $objectlink->ref_client; ?></td>
<td align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td align="right"><?php
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
} ?>
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
} ?>
</td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
</tr>

View File

@ -34,8 +34,8 @@ class Shipments extends DolibarrApi
*/
static $FIELDS = array(
'socid',
'origin_id',
'origin_type',
'origin_id',
'origin_type',
);
/**
@ -184,9 +184,9 @@ class Shipments extends DolibarrApi
*/
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401, "Insuffisant rights");
}
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -194,11 +194,11 @@ class Shipments extends DolibarrApi
$this->shipment->$field = $value;
}
if (isset($request_data["lines"])) {
$lines = array();
foreach ($request_data["lines"] as $line) {
array_push($lines, (object) $line);
}
$this->shipment->lines = $lines;
$lines = array();
foreach ($request_data["lines"] as $line) {
array_push($lines, (object) $line);
}
$this->shipment->lines = $lines;
}
if ($this->shipment->create(DolibarrApiAccess::$user) < 0) {
@ -220,26 +220,26 @@ class Shipments extends DolibarrApi
/*
function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
}
$result = $this->shipment->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
$result = $this->shipment->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
if( ! DolibarrApi::_checkAccessToResource('expedition',$this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->shipment->getLinesArray();
$result = array();
foreach ($this->shipment->lines as $line) {
array_push($result,$this->_cleanObjectDatas($line));
}
return $result;
if( ! DolibarrApi::_checkAccessToResource('expedition',$this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->shipment->getLinesArray();
$result = array();
foreach ($this->shipment->lines as $line) {
array_push($result,$this->_cleanObjectDatas($line));
}
return $result;
}
*/
*/
/**
* Add a line to given shipment
@ -254,20 +254,20 @@ class Shipments extends DolibarrApi
/*
function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
$result = $this->shipment->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
$result = $this->shipment->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
if( ! DolibarrApi::_checkAccessToResource('expedition',$this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->shipment->addline(
if( ! DolibarrApi::_checkAccessToResource('expedition',$this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->shipment->addline(
$request_data->desc,
$request_data->subprice,
$request_data->qty,
@ -294,13 +294,13 @@ class Shipments extends DolibarrApi
$request_data->origin,
$request_data->origin_id,
$request_data->multicurrency_subprice
);
);
if ($updateRes > 0) {
return $updateRes;
if ($updateRes > 0) {
return $updateRes;
}
return false;
}
return false;
}*/
/**
@ -317,20 +317,20 @@ class Shipments extends DolibarrApi
/*
function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
$result = $this->shipment->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
$result = $this->shipment->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
if( ! DolibarrApi::_checkAccessToResource('expedition',$this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->shipment->updateline(
if( ! DolibarrApi::_checkAccessToResource('expedition',$this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->shipment->updateline(
$lineid,
$request_data->desc,
$request_data->subprice,
@ -352,15 +352,15 @@ class Shipments extends DolibarrApi
$request_data->special_code,
$request_data->array_options,
$request_data->fk_unit,
$request_data->multicurrency_subprice
);
$request_data->multicurrency_subprice
);
if ($updateRes > 0) {
$result = $this->get($id);
unset($result->line);
return $this->_cleanObjectDatas($result);
}
return false;
if ($updateRes > 0) {
$result = $this->get($id);
unset($result->line);
return $this->_cleanObjectDatas($result);
}
return false;
}*/
/**
@ -414,9 +414,9 @@ class Shipments extends DolibarrApi
*/
function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
$result = $this->shipment->fetch($id);
if (! $result) {
@ -495,15 +495,15 @@ class Shipments extends DolibarrApi
*/
function validate($id, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
}
$result = $this->shipment->fetch($id);
if( ! $result ) {
if ( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
if ( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -513,15 +513,15 @@ class Shipments extends DolibarrApi
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Shipment: '.$this->shipment->error);
}
$result = $this->shipment->fetch($id);
if( ! $result ) {
}
$result = $this->shipment->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
if ( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
}
$this->shipment->fetchObjectLinked();
return $this->_cleanObjectDatas($this->shipment);
@ -631,8 +631,8 @@ class Shipments extends DolibarrApi
if (! empty($object->lines) && is_array($object->lines))
{
foreach ($object->lines as $line)
{
foreach ($object->lines as $line)
{
unset($line->tva_tx);
unset($line->vat_src_code);
unset($line->total_ht);

View File

@ -47,8 +47,8 @@ class ExpenseReports extends DolibarrApi
*/
function __construct()
{
global $db, $conf;
$this->db = $db;
global $db, $conf;
$this->db = $db;
$this->expensereport = new ExpenseReport($this->db);
}
@ -163,9 +163,9 @@ class ExpenseReports extends DolibarrApi
*/
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401, "Insuffisant rights");
}
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -198,24 +198,24 @@ class ExpenseReports extends DolibarrApi
/*
function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expensereport->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->expensereport->lire) {
throw new RestException(401);
}
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'expensereport not found');
}
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'expensereport not found');
}
if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->expensereport->getLinesArray();
$result = array();
foreach ($this->expensereport->lines as $line) {
array_push($result,$this->_cleanObjectDatas($line));
}
return $result;
if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->expensereport->getLinesArray();
$result = array();
foreach ($this->expensereport->lines as $line) {
array_push($result,$this->_cleanObjectDatas($line));
}
return $result;
}
*/
@ -387,18 +387,18 @@ class ExpenseReports extends DolibarrApi
*/
function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401);
}
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'expensereport not found');
}
if( ! DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->expensereport->$field = $value;

View File

@ -188,18 +188,17 @@ if ($action == 'create' || empty($action))
$total = $expensereport->total_ttc;
// autofill remainder amount
if (! empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';
print ' });'."\n";
print ' </script>'."\n";
}
if (! empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';
print "\t});\n";
print "</script>\n";
}
print load_fiche_titre($langs->trans("DoPayment"));

View File

@ -806,7 +806,7 @@ if ($step == 3 && $datatoexport)
$tablename=getablenamefromfield($code, $sqlmaxforexport);
$htmltext ='<b>'.$langs->trans("Name").':</b> '.$text.'<br>';
if (! empty($objexport->array_export_special[0][$code]))
if (! empty($objexport->array_export_special[0][$code]))
{
$htmltext.='<b>'.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." :</b> ".$objexport->array_export_special[0][$code]."<br>";
}

View File

@ -191,9 +191,9 @@ class Interventions extends DolibarrApi
*/
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
@ -254,8 +254,8 @@ class Interventions extends DolibarrApi
function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validateLine($request_data);
@ -263,13 +263,13 @@ class Interventions extends DolibarrApi
$this->fichinter->$field = $value;
}
if( ! $result ) {
if ( ! $result ) {
throw new RestException(404, 'Intervention not found');
}
if( ! DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$updateRes = $this->fichinter->addLine(
DolibarrApiAccess::$user,
@ -280,10 +280,9 @@ class Interventions extends DolibarrApi
);
if ($updateRes > 0) {
return $updateRes;
}
else {
throw new RestException(400, $this->fichinter->error);
return $updateRes;
} else {
throw new RestException(400, $this->fichinter->error);
}
}
@ -337,8 +336,8 @@ class Interventions extends DolibarrApi
function validate($id, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
throw new RestException(401, "Insuffisant rights");
}
$result = $this->fichinter->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Intervention not found');
@ -350,10 +349,10 @@ class Interventions extends DolibarrApi
$result = $this->fichinter->setValid(DolibarrApiAccess::$user, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Intervention: '.$this->commande->error);
throw new RestException(500, 'Error when validating Intervention: '.$this->commande->error);
}
$this->fichinter->fetchObjectLinked();
@ -388,10 +387,10 @@ class Interventions extends DolibarrApi
$result = $this->fichinter->setStatut(3);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already closed');
throw new RestException(304, 'Error nothing done. May be object is already closed');
}
if ($result < 0) {
throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error);
throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error);
}
$this->fichinter->fetchObjectLinked();

View File

@ -3082,54 +3082,56 @@ class CommandeFournisseur extends CommonOrder
}
return 4;
}
}elseif(! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) )
{//set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...)
} elseif (! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) ) {
//set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...)
$close=0;
$close=0;
if( count($diff_array) > 0 )
{//there are some difference between the two arrays
if( count($diff_array) > 0 )
{
//there are some difference between the two arrays
//scan the array of results
foreach($diff_array as $key => $value)
{//if the quantity delivered is greater or equal to wish quantity
if($qtydelivered[$key] >= $qtywished[$key] )
{
$close++;
}
}
}
//scan the array of results
foreach($diff_array as $key => $value)
{
//if the quantity delivered is greater or equal to wish quantity
if($qtydelivered[$key] >= $qtywished[$key] )
{
$close++;
}
}
}
if($close == count($diff_array))
{//all the products are received equal or more than the wished quantity
if ($closeopenorder)
{
$ret = $this->Livraison($user, $date_liv, 'tot', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
if ($ret<0) {
return -1;
}
return 5;
}
else
{
//Diff => received partially
$ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
if ($ret<0) {
return -1;
}
return 4;
}
}
else
{//all the products are not received
$ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
if ($ret<0) {
return -1;
}
return 4;
}
}
if($close == count($diff_array)) {
//all the products are received equal or more than the wished quantity
if ($closeopenorder) {
$ret = $this->Livraison($user, $date_liv, 'tot', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
if ($ret<0) {
return -1;
}
return 5;
}
else
{
//Diff => received partially
$ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
if ($ret<0) {
return -1;
}
return 4;
}
}
else
{
//all the products are not received
$ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
if ($ret<0) {
return -1;
}
return 4;
}
}
else
{
//Diff => received partially
@ -3145,7 +3147,7 @@ class CommandeFournisseur extends CommonOrder
}
return 0;
}
/**
* Load array this->receptions of lines of shipments with nb of products sent for each order line
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
@ -3169,7 +3171,7 @@ class CommandeFournisseur extends CommonOrder
if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product;
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut;
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
dol_syslog(get_class($this)."::loadReceptions", LOG_DEBUG);
$result = $this->db->query($sql);
@ -3184,7 +3186,7 @@ class CommandeFournisseur extends CommonOrder
$i++;
}
$this->db->free();
return $num;
}
else
@ -3319,7 +3321,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->total_ttc = $objp->total_ttc;
$this->product_type = $objp->product_type;
$this->special_code = $objp->special_code;
$this->ref = $objp->product_ref;
$this->product_ref = $objp->product_ref;
$this->product_libelle = $objp->product_libelle;

View File

@ -312,7 +312,7 @@ class CommandeFournisseurDispatch extends CommonObject
}
else
{
$this->error="Error ".$this->db->lasterror();
$this->error="Error ".$this->db->lasterror();
return -1;
}
}
@ -391,7 +391,7 @@ class CommandeFournisseurDispatch extends CommonObject
$result=$this->call_trigger('LINERECEPTION_UPDATE', $user);
if ($result < 0) $error++;
//// End call triggers
}
}
}
// Commit or rollback

View File

@ -3218,4 +3218,4 @@ class SupplierInvoiceLine extends CommonObjectLine
return -2;
}
}
}
}

View File

@ -2222,227 +2222,227 @@ elseif (! empty($object->id))
dol_fiche_end();
/**
* Boutons actions
*/
/**
* Boutons actions
*/
if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete')
if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete')
{
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
{
print '<div class="tabsAction">';
$object->fetchObjectLinked(); // Links are used to show or not button, so we load them now.
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
// Validate
if ($object->statut == 0 && $num > 0)
{
$object->fetchObjectLinked(); // Links are used to show or not button, so we load them now.
// Validate
if ($object->statut == 0 && $num > 0)
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate)))
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate)))
{
$tmpbuttonlabel=$langs->trans('Validate');
if ($user->rights->fournisseur->commande->approuver && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) $tmpbuttonlabel = $langs->trans("ValidateAndApprove");
$tmpbuttonlabel=$langs->trans('Validate');
if ($user->rights->fournisseur->commande->approuver && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) $tmpbuttonlabel = $langs->trans("ValidateAndApprove");
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">';
print $tmpbuttonlabel;
print '</a>';
}
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">';
print $tmpbuttonlabel;
print '</a>';
}
// Create event
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}*/
}
// Create event
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}*/
// Modify
if ($object->statut == 1)
// Modify
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->commander)
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Modify").'</a>';
}
}
// Approve
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approuver)
{
if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && ! empty($object->user_approve_id))
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("FirstApprovalAlreadyDone")).'">'.$langs->trans("ApproveOrder").'</a>';
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("ApproveOrder").'</a>';
}
}
// Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set)
if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)
{
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approve2)
{
if (! empty($object->user_approve_id2))
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("SecondApprovalAlreadyDone")).'">'.$langs->trans("Approve2Order").'</a>';
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=approve2">'.$langs->trans("Approve2Order").'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Approve2Order").'</a>';
}
}
}
// Refuse
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approuver || $user->rights->fournisseur->commande->approve2)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("RefuseOrder").'</a>';
}
}
// Send
if (in_array($object->statut, array(2, 3, 4, 5)))
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
}
}
// Reopen
if (in_array($object->statut, array(2)))
{
$buttonshown=0;
if (! $buttonshown && $user->rights->fournisseur->commande->approuver)
{
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|| (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
$buttonshown++;
}
}
if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED))
{
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|| (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
}
}
}
if (in_array($object->statut, array(3, 4, 5, 6, 7, 9)))
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
}
}
// Ship
if (! empty($conf->stock->enabled) && (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)))
{
if (in_array($object->statut, array(3,4,5))) {
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/dispatch.php?id=' . $object->id . '">' . $langs->trans('ReceiveProducts') . '</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('ReceiveProducts') . '</a></div>';
}
}
}
if ($object->statut == 2)
{
if ($user->rights->fournisseur->commande->commander)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=makeorder#makeorder">'.$langs->trans("MakeOrder").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("MakeOrder").'</a></div>';
}
}
// Create bill
if (! empty($conf->facture->enabled))
{
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)
{
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>';
}
}
}
// 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>';
}
elseif (!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
if (! empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) // 2 means accepted
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=webservice&amp;mode=init">'.$langs->trans('CreateRemoteOrder').'</a>';
}
// Clone
if ($user->rights->fournisseur->commande->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a>';
}
// Cancel
if ($object->statut == 2)
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
}
// Delete
if ($user->rights->fournisseur->commande->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Modify").'</a>';
}
}
print "</div>";
// Approve
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approuver)
{
if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && ! empty($object->user_approve_id))
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("FirstApprovalAlreadyDone")).'">'.$langs->trans("ApproveOrder").'</a>';
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("ApproveOrder").'</a>';
}
}
// Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set)
if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)
{
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approve2)
{
if (! empty($object->user_approve_id2))
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("SecondApprovalAlreadyDone")).'">'.$langs->trans("Approve2Order").'</a>';
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=approve2">'.$langs->trans("Approve2Order").'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Approve2Order").'</a>';
}
}
}
// Refuse
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approuver || $user->rights->fournisseur->commande->approve2)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("RefuseOrder").'</a>';
}
}
// Send
if (in_array($object->statut, array(2, 3, 4, 5)))
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
}
}
// Reopen
if (in_array($object->statut, array(2)))
{
$buttonshown=0;
if (! $buttonshown && $user->rights->fournisseur->commande->approuver)
{
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|| (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
$buttonshown++;
}
}
if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED))
{
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|| (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
}
}
}
if (in_array($object->statut, array(3, 4, 5, 6, 7, 9)))
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
}
}
// Ship
if (! empty($conf->stock->enabled) && (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)))
{
if (in_array($object->statut, array(3,4,5))) {
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/dispatch.php?id=' . $object->id . '">' . $langs->trans('ReceiveProducts') . '</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('ReceiveProducts') . '</a></div>';
}
}
}
if ($object->statut == 2)
{
if ($user->rights->fournisseur->commande->commander)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=makeorder#makeorder">'.$langs->trans("MakeOrder").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("MakeOrder").'</a></div>';
}
}
// Create bill
if (! empty($conf->facture->enabled))
{
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)
{
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>';
}
}
}
// 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>';
}
elseif (!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
if (! empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) // 2 means accepted
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=webservice&amp;mode=init">'.$langs->trans('CreateRemoteOrder').'</a>';
}
// Clone
if ($user->rights->fournisseur->commande->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a>';
}
// Cancel
if ($object->statut == 2)
{
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
}
// Delete
if ($user->rights->fournisseur->commande->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
}
print "</div>";

View File

@ -460,8 +460,8 @@ if ($id > 0 || ! empty($ref)) {
$listwarehouses = $entrepot->list_array(1);
if(empty($conf->reception->enabled))print '<form method="POST" action="dispatch.php?id=' . $object->id . '">';
else print '<form method="post" action="'.dol_buildpath('/reception/card.php', 1).'?originid='.$object->id.'&origin=supplierorder">';
else print '<form method="post" action="'.dol_buildpath('/reception/card.php', 1).'?originid='.$object->id.'&origin=supplierorder">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
if(empty($conf->reception->enabled))print '<input type="hidden" name="action" value="dispatch">';
else print '<input type="hidden" name="action" value="create">';
@ -726,19 +726,19 @@ if ($id > 0 || ! empty($ref)) {
// modified by hook
if (empty($reshook))
{
if(empty($conf->reception->enabled)){
print $langs->trans("Comment").' : ';
print '<input type="text" class="minwidth400" maxlength="128" name="comment" value="';
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
// print ' / '.$object->ref_supplier; // Not yet available
print '" class="flat"><br>';
if (empty($conf->reception->enabled)){
print $langs->trans("Comment").' : ';
print '<input type="text" class="minwidth400" maxlength="128" name="comment" value="';
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
// print ' / '.$object->ref_supplier; // Not yet available
print '" class="flat"><br>';
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
}
empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive");
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
}
empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive");
print '<br><input type="submit" class="button" value="' . $dispatchBt. '"';
if (count($listwarehouses) <= 0)
print '<br><input type="submit" class="button" value="' . $dispatchBt. '"';
if (count($listwarehouses) <= 0)
print ' disabled';
print '>';
}
@ -787,7 +787,7 @@ if ($id > 0 || ! empty($ref)) {
print '<tr class="liste_titre">';
if($conf->reception->enabled)print '<td>' . $langs->trans("Reception") . '</td>';
print '<td>' . $langs->trans("Product") . '</td>';
print '<td>' . $langs->trans("DateCreation") . '</td>';
print '<td>' . $langs->trans("DateDeliveryPlanned") . '</td>';
@ -809,19 +809,19 @@ if ($id > 0 || ! empty($ref)) {
$objp = $db->fetch_object($resql);
print "<tr " . $bc[$var] . ">";
if(!empty($conf->reception->enabled) ){
print '<td>';
if (!empty($objp->fk_reception)){
$reception = new Reception($db);
$reception->fetch($objp->fk_reception);
print $reception->getNomUrl(1);
}
print "</td>";
}
print '<td>';
print '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $objp->fk_product . '">' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '</a>';
print ' - ' . $objp->label;
@ -895,7 +895,7 @@ if ($id > 0 || ! empty($ref)) {
print '</td>';
print '<td align="center">';
print '</td>';
print "</tr>\n";

View File

@ -552,8 +552,8 @@ if ($showweather)
$nbworkboardempty=0;
if (! empty($valid_dashboardlines))
{
$boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">';
$boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">';
foreach($valid_dashboardlines as $board)
{
if (empty($board->nbtodo)) $nbworkboardempty++;
@ -567,9 +567,9 @@ if (! empty($valid_dashboardlines))
$boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>';
$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0)?' dashboardlineok':'').'">'.$board->nbtodo.'</span></a>';
if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX))
{
$boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0)?' dashboardlineok':'').'">'.price($board->total) .'</span></a>';
}
{
$boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0)?' dashboardlineok':'').'">'.price($board->total) .'</span></a>';
}
$boxwork .= '</div>';
if ($board->nbtodolate > 0)
{
@ -593,7 +593,7 @@ if (! empty($valid_dashboardlines))
$boxwork .='<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
$boxwork .='<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
$boxwork .='<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
$boxwork .='</div>';
$boxwork .='</td></tr>';
}

View File

@ -312,19 +312,19 @@ else
}
else
{
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
// If password is encoded, we decode it
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
{
require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
if (preg_match('/crypted:/i', $dolibarr_main_db_pass))
{
$dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
// If password is encoded, we decode it
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
{
require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
if (preg_match('/crypted:/i', $dolibarr_main_db_pass))
{
$dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
// $conf already created in inc.php
$conf->db->type = $dolibarr_main_db_type;
@ -333,12 +333,12 @@ else
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
$db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
if ($db->connected && $db->database_selected)
{
$ok=true;
}
}
}
}
}
@ -569,7 +569,7 @@ else
print '</table>'."\n";
print '</div>';
}
}
}
}
print '<script type="text/javascript">

View File

@ -156,8 +156,8 @@ DocForAllMembersCards=Generate business cards for all members
DocForOneMemberCards=Generate business cards for a particular member
DocForLabels=Generate address sheets
SubscriptionPayment=Subscription payment
LastSubscriptionDate=Latest subscription date
LastSubscriptionAmount=Latest subscription amount
LastSubscriptionDate=Date of latest subscription payment
LastSubscriptionAmount=Amount of latest subscription
MembersStatisticsByCountries=Members statistics by country
MembersStatisticsByState=Members statistics by state/province
MembersStatisticsByTown=Members statistics by town
@ -187,7 +187,7 @@ MembersStatisticsByProperties=Members statistics by nature
MembersByNature=This screen show you statistics on members by nature.
MembersByRegion=This screen show you statistics on members by region.
VATToUseForSubscriptions=VAT rate to use for subscriptions
NoVatOnSubscription=No TVA for subscriptions
NoVatOnSubscription=No VAT for subscriptions
ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS=Product used for subscription line into invoice: %s
NameOrCompany=Name or company
SubscriptionRecorded=Subscription recorded
@ -195,3 +195,5 @@ NoEmailSentToMember=No email sent to member
EmailSentToMember=Email sent to member at %s
SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subscription
SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5')
MembershipPaid=Membership paid for current period (until %s)
YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email

View File

@ -147,7 +147,7 @@ CloneProduct=Clone product or service
ConfirmCloneProduct=Are you sure you want to clone product or service <b>%s</b>?
CloneContentProduct=Clone all main information of product/service
ClonePricesProduct=Clone prices
CloneCompositionProduct=Clone packaged product/service
CloneCompositionProduct=Clone virtual product/service
CloneCombinationsProduct=Clone product variants
ProductIsUsed=This product is used
NewRefForClone=Ref. of new product/service

View File

@ -195,3 +195,4 @@ NoEmailSentToMember=Aucun e-mail envoyé à l'adhérent
EmailSentToMember=Email envoyé à l'adhérent à %s
SendReminderForExpiredSubscriptionTitle=Envoyer une relance par mail pour les cotisations expirées
SendReminderForExpiredSubscription=Envoyer un rappel par e-mail aux membres lorsque l'adhésion est sur le point d'expirer (le paramètre est le nombre de jours avant la fin de l'adhésion pour envoyer le rappel. Il peut s'agir d'une liste de jours séparé par un point-virgule, par exemple '10;5;0;-5')
YouMayFindYourInvoiceInThisEmail=You pourrez trouver votre facture en pièce jointe à cet email

View File

@ -35,10 +35,9 @@ $backtopage = GETPOST('backtopage', 'alpha');
/*
* Actions
*/
if($action=="update"){
$res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0)
{
if ($action=="update"){
$res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback();
}

View File

@ -40,274 +40,274 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
*/
class InterfaceMyModuleTriggers extends DolibarrTriggers
{
/**
* @var DoliDB Database handler
*/
protected $db;
/**
* @var DoliDB Database handler
*/
protected $db;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i', '', get_class($this));
$this->family = "demo";
$this->description = "MyModule triggers.";
// 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->picto = 'mymodule@mymodule';
}
$this->name = preg_replace('/^Interface/i', '', get_class($this));
$this->family = "demo";
$this->description = "MyModule triggers.";
// 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->picto = 'mymodule@mymodule';
}
/**
* Trigger name
*
* @return string Name of trigger file
*/
public function getName()
{
return $this->name;
}
/**
* Trigger name
*
* @return string Name of trigger file
*/
public function getName()
{
return $this->name;
}
/**
* Trigger description
*
* @return string Description of trigger file
*/
public function getDesc()
{
return $this->description;
}
/**
* Trigger description
*
* @return string Description of trigger file
*/
public function getDesc()
{
return $this->description;
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "runTrigger" are triggered if file
* is inside directory core/triggers
*
* @param string $action Event action code
* @param CommonObject $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
/**
* Function called when a Dolibarrr business event is done.
* All functions "runTrigger" are triggered if file
* is inside directory core/triggers
*
* @param string $action Event action code
* @param CommonObject $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->mymodule->enabled)) return 0; // Module not active, we do nothing
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
switch ($action) {
// Users
//case 'USER_CREATE':
//case 'USER_MODIFY':
//case 'USER_NEW_PASSWORD':
//case 'USER_ENABLEDISABLE':
//case 'USER_DELETE':
//case 'USER_SETINGROUP':
//case 'USER_REMOVEFROMGROUP':
//case 'USER_CREATE':
//case 'USER_MODIFY':
//case 'USER_NEW_PASSWORD':
//case 'USER_ENABLEDISABLE':
//case 'USER_DELETE':
//case 'USER_SETINGROUP':
//case 'USER_REMOVEFROMGROUP':
// Actions
//case 'ACTION_MODIFY':
//case 'ACTION_CREATE':
//case 'ACTION_DELETE':
// Actions
//case 'ACTION_MODIFY':
//case 'ACTION_CREATE':
//case 'ACTION_DELETE':
// Groups
//case 'GROUP_CREATE':
//case 'GROUP_MODIFY':
//case 'GROUP_DELETE':
// Groups
//case 'GROUP_CREATE':
//case 'GROUP_MODIFY':
//case 'GROUP_DELETE':
// Companies
//case 'COMPANY_CREATE':
//case 'COMPANY_MODIFY':
//case 'COMPANY_DELETE':
// Companies
//case 'COMPANY_CREATE':
//case 'COMPANY_MODIFY':
//case 'COMPANY_DELETE':
// Contacts
//case 'CONTACT_CREATE':
//case 'CONTACT_MODIFY':
//case 'CONTACT_DELETE':
//case 'CONTACT_ENABLEDISABLE':
// Contacts
//case 'CONTACT_CREATE':
//case 'CONTACT_MODIFY':
//case 'CONTACT_DELETE':
//case 'CONTACT_ENABLEDISABLE':
// Products
//case 'PRODUCT_CREATE':
//case 'PRODUCT_MODIFY':
//case 'PRODUCT_DELETE':
//case 'PRODUCT_PRICE_MODIFY':
//case 'PRODUCT_SET_MULTILANGS':
//case 'PRODUCT_DEL_MULTILANGS':
// Products
//case 'PRODUCT_CREATE':
//case 'PRODUCT_MODIFY':
//case 'PRODUCT_DELETE':
//case 'PRODUCT_PRICE_MODIFY':
//case 'PRODUCT_SET_MULTILANGS':
//case 'PRODUCT_DEL_MULTILANGS':
//Stock mouvement
//case 'STOCK_MOVEMENT':
//Stock mouvement
//case 'STOCK_MOVEMENT':
//MYECMDIR
//case 'MYECMDIR_CREATE':
//case 'MYECMDIR_MODIFY':
//case 'MYECMDIR_DELETE':
//MYECMDIR
//case 'MYECMDIR_CREATE':
//case 'MYECMDIR_MODIFY':
//case 'MYECMDIR_DELETE':
// Customer orders
//case 'ORDER_CREATE':
//case 'ORDER_MODIFY':
//case 'ORDER_VALIDATE':
//case 'ORDER_DELETE':
//case 'ORDER_CANCEL':
//case 'ORDER_SENTBYMAIL':
//case 'ORDER_CLASSIFY_BILLED':
//case 'ORDER_SETDRAFT':
//case 'LINEORDER_INSERT':
//case 'LINEORDER_UPDATE':
//case 'LINEORDER_DELETE':
// Customer orders
//case 'ORDER_CREATE':
//case 'ORDER_MODIFY':
//case 'ORDER_VALIDATE':
//case 'ORDER_DELETE':
//case 'ORDER_CANCEL':
//case 'ORDER_SENTBYMAIL':
//case 'ORDER_CLASSIFY_BILLED':
//case 'ORDER_SETDRAFT':
//case 'LINEORDER_INSERT':
//case 'LINEORDER_UPDATE':
//case 'LINEORDER_DELETE':
// Supplier orders
//case 'ORDER_SUPPLIER_CREATE':
//case 'ORDER_SUPPLIER_MODIFY':
//case 'ORDER_SUPPLIER_VALIDATE':
//case 'ORDER_SUPPLIER_DELETE':
//case 'ORDER_SUPPLIER_APPROVE':
//case 'ORDER_SUPPLIER_REFUSE':
//case 'ORDER_SUPPLIER_CANCEL':
//case 'ORDER_SUPPLIER_SENTBYMAIL':
//case 'ORDER_SUPPLIER_DISPATCH':
//case 'LINEORDER_SUPPLIER_DISPATCH':
//case 'LINEORDER_SUPPLIER_CREATE':
//case 'LINEORDER_SUPPLIER_UPDATE':
//case 'LINEORDER_SUPPLIER_DELETE':
// Supplier orders
//case 'ORDER_SUPPLIER_CREATE':
//case 'ORDER_SUPPLIER_MODIFY':
//case 'ORDER_SUPPLIER_VALIDATE':
//case 'ORDER_SUPPLIER_DELETE':
//case 'ORDER_SUPPLIER_APPROVE':
//case 'ORDER_SUPPLIER_REFUSE':
//case 'ORDER_SUPPLIER_CANCEL':
//case 'ORDER_SUPPLIER_SENTBYMAIL':
//case 'ORDER_SUPPLIER_DISPATCH':
//case 'LINEORDER_SUPPLIER_DISPATCH':
//case 'LINEORDER_SUPPLIER_CREATE':
//case 'LINEORDER_SUPPLIER_UPDATE':
//case 'LINEORDER_SUPPLIER_DELETE':
// Proposals
//case 'PROPAL_CREATE':
//case 'PROPAL_MODIFY':
//case 'PROPAL_VALIDATE':
//case 'PROPAL_SENTBYMAIL':
//case 'PROPAL_CLOSE_SIGNED':
//case 'PROPAL_CLOSE_REFUSED':
//case 'PROPAL_DELETE':
//case 'LINEPROPAL_INSERT':
//case 'LINEPROPAL_UPDATE':
//case 'LINEPROPAL_DELETE':
// Proposals
//case 'PROPAL_CREATE':
//case 'PROPAL_MODIFY':
//case 'PROPAL_VALIDATE':
//case 'PROPAL_SENTBYMAIL':
//case 'PROPAL_CLOSE_SIGNED':
//case 'PROPAL_CLOSE_REFUSED':
//case 'PROPAL_DELETE':
//case 'LINEPROPAL_INSERT':
//case 'LINEPROPAL_UPDATE':
//case 'LINEPROPAL_DELETE':
// SupplierProposal
//case 'SUPPLIER_PROPOSAL_CREATE':
//case 'SUPPLIER_PROPOSAL_MODIFY':
//case 'SUPPLIER_PROPOSAL_VALIDATE':
//case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
//case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED':
//case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
//case 'SUPPLIER_PROPOSAL_DELETE':
//case 'LINESUPPLIER_PROPOSAL_INSERT':
//case 'LINESUPPLIER_PROPOSAL_UPDATE':
//case 'LINESUPPLIER_PROPOSAL_DELETE':
// SupplierProposal
//case 'SUPPLIER_PROPOSAL_CREATE':
//case 'SUPPLIER_PROPOSAL_MODIFY':
//case 'SUPPLIER_PROPOSAL_VALIDATE':
//case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
//case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED':
//case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
//case 'SUPPLIER_PROPOSAL_DELETE':
//case 'LINESUPPLIER_PROPOSAL_INSERT':
//case 'LINESUPPLIER_PROPOSAL_UPDATE':
//case 'LINESUPPLIER_PROPOSAL_DELETE':
// Contracts
//case 'CONTRACT_CREATE':
//case 'CONTRACT_MODIFY':
//case 'CONTRACT_ACTIVATE':
//case 'CONTRACT_CANCEL':
//case 'CONTRACT_CLOSE':
//case 'CONTRACT_DELETE':
//case 'LINECONTRACT_INSERT':
//case 'LINECONTRACT_UPDATE':
//case 'LINECONTRACT_DELETE':
// Contracts
//case 'CONTRACT_CREATE':
//case 'CONTRACT_MODIFY':
//case 'CONTRACT_ACTIVATE':
//case 'CONTRACT_CANCEL':
//case 'CONTRACT_CLOSE':
//case 'CONTRACT_DELETE':
//case 'LINECONTRACT_INSERT':
//case 'LINECONTRACT_UPDATE':
//case 'LINECONTRACT_DELETE':
// Bills
//case 'BILL_CREATE':
//case 'BILL_MODIFY':
//case 'BILL_VALIDATE':
//case 'BILL_UNVALIDATE':
//case 'BILL_SENTBYMAIL':
//case 'BILL_CANCEL':
//case 'BILL_DELETE':
//case 'BILL_PAYED':
//case 'LINEBILL_INSERT':
//case 'LINEBILL_UPDATE':
//case 'LINEBILL_DELETE':
// Bills
//case 'BILL_CREATE':
//case 'BILL_MODIFY':
//case 'BILL_VALIDATE':
//case 'BILL_UNVALIDATE':
//case 'BILL_SENTBYMAIL':
//case 'BILL_CANCEL':
//case 'BILL_DELETE':
//case 'BILL_PAYED':
//case 'LINEBILL_INSERT':
//case 'LINEBILL_UPDATE':
//case 'LINEBILL_DELETE':
//Supplier Bill
//case 'BILL_SUPPLIER_CREATE':
//case 'BILL_SUPPLIER_UPDATE':
//case 'BILL_SUPPLIER_DELETE':
//case 'BILL_SUPPLIER_PAYED':
//case 'BILL_SUPPLIER_UNPAYED':
//case 'BILL_SUPPLIER_VALIDATE':
//case 'BILL_SUPPLIER_UNVALIDATE':
//case 'LINEBILL_SUPPLIER_CREATE':
//case 'LINEBILL_SUPPLIER_UPDATE':
//case 'LINEBILL_SUPPLIER_DELETE':
//Supplier Bill
//case 'BILL_SUPPLIER_CREATE':
//case 'BILL_SUPPLIER_UPDATE':
//case 'BILL_SUPPLIER_DELETE':
//case 'BILL_SUPPLIER_PAYED':
//case 'BILL_SUPPLIER_UNPAYED':
//case 'BILL_SUPPLIER_VALIDATE':
//case 'BILL_SUPPLIER_UNVALIDATE':
//case 'LINEBILL_SUPPLIER_CREATE':
//case 'LINEBILL_SUPPLIER_UPDATE':
//case 'LINEBILL_SUPPLIER_DELETE':
// Payments
//case 'PAYMENT_CUSTOMER_CREATE':
//case 'PAYMENT_SUPPLIER_CREATE':
//case 'PAYMENT_ADD_TO_BANK':
//case 'PAYMENT_DELETE':
// Payments
//case 'PAYMENT_CUSTOMER_CREATE':
//case 'PAYMENT_SUPPLIER_CREATE':
//case 'PAYMENT_ADD_TO_BANK':
//case 'PAYMENT_DELETE':
// Online
//case 'PAYMENT_PAYBOX_OK':
//case 'PAYMENT_PAYPAL_OK':
//case 'PAYMENT_STRIPE_OK':
// Online
//case 'PAYMENT_PAYBOX_OK':
//case 'PAYMENT_PAYPAL_OK':
//case 'PAYMENT_STRIPE_OK':
// Donation
//case 'DON_CREATE':
//case 'DON_UPDATE':
//case 'DON_DELETE':
// Donation
//case 'DON_CREATE':
//case 'DON_UPDATE':
//case 'DON_DELETE':
// Interventions
//case 'FICHINTER_CREATE':
//case 'FICHINTER_MODIFY':
//case 'FICHINTER_VALIDATE':
//case 'FICHINTER_DELETE':
//case 'LINEFICHINTER_CREATE':
//case 'LINEFICHINTER_UPDATE':
//case 'LINEFICHINTER_DELETE':
// Interventions
//case 'FICHINTER_CREATE':
//case 'FICHINTER_MODIFY':
//case 'FICHINTER_VALIDATE':
//case 'FICHINTER_DELETE':
//case 'LINEFICHINTER_CREATE':
//case 'LINEFICHINTER_UPDATE':
//case 'LINEFICHINTER_DELETE':
// Members
//case 'MEMBER_CREATE':
//case 'MEMBER_VALIDATE':
//case 'MEMBER_SUBSCRIPTION':
//case 'MEMBER_MODIFY':
//case 'MEMBER_NEW_PASSWORD':
//case 'MEMBER_RESILIATE':
//case 'MEMBER_DELETE':
// Members
//case 'MEMBER_CREATE':
//case 'MEMBER_VALIDATE':
//case 'MEMBER_SUBSCRIPTION':
//case 'MEMBER_MODIFY':
//case 'MEMBER_NEW_PASSWORD':
//case 'MEMBER_RESILIATE':
//case 'MEMBER_DELETE':
// Categories
//case 'CATEGORY_CREATE':
//case 'CATEGORY_MODIFY':
//case 'CATEGORY_DELETE':
//case 'CATEGORY_SET_MULTILANGS':
// Categories
//case 'CATEGORY_CREATE':
//case 'CATEGORY_MODIFY':
//case 'CATEGORY_DELETE':
//case 'CATEGORY_SET_MULTILANGS':
// Projects
//case 'PROJECT_CREATE':
//case 'PROJECT_MODIFY':
//case 'PROJECT_DELETE':
// Projects
//case 'PROJECT_CREATE':
//case 'PROJECT_MODIFY':
//case 'PROJECT_DELETE':
// Project tasks
//case 'TASK_CREATE':
//case 'TASK_MODIFY':
//case 'TASK_DELETE':
// Project tasks
//case 'TASK_CREATE':
//case 'TASK_MODIFY':
//case 'TASK_DELETE':
// Task time spent
//case 'TASK_TIMESPENT_CREATE':
//case 'TASK_TIMESPENT_MODIFY':
//case 'TASK_TIMESPENT_DELETE':
// Task time spent
//case 'TASK_TIMESPENT_CREATE':
//case 'TASK_TIMESPENT_MODIFY':
//case 'TASK_TIMESPENT_DELETE':
// Shipping
//case 'SHIPPING_CREATE':
//case 'SHIPPING_MODIFY':
//case 'SHIPPING_VALIDATE':
//case 'SHIPPING_SENTBYMAIL':
//case 'SHIPPING_BILLED':
//case 'SHIPPING_CLOSED':
//case 'SHIPPING_REOPEN':
//case 'SHIPPING_DELETE':
// break;
default:
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
break;
}
// Shipping
//case 'SHIPPING_CREATE':
//case 'SHIPPING_MODIFY':
//case 'SHIPPING_VALIDATE':
//case 'SHIPPING_SENTBYMAIL':
//case 'SHIPPING_BILLED':
//case 'SHIPPING_CLOSED':
//case 'SHIPPING_REOPEN':
//case 'SHIPPING_DELETE':
// break;
default:
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
break;
}
return 0;
}
return 0;
}
}

View File

@ -115,31 +115,31 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
$error=0;
$error=0;
$permissiontoadd = $user->rights->mymodule->write;
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).($id > 0 ? $id : '__ID__');
}
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
$permissiontoadd = $user->rights->mymodule->write;
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).($id > 0 ? $id : '__ID__');
}
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
$trigger_name='MYOBJECT_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
$trackid='myobject'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Actions to send emails
$trigger_name='MYOBJECT_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
$trackid='myobject'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}

View File

@ -419,7 +419,7 @@ class MultiCurrency extends CommonObject
$this->rate = null;
return -1;
}
}
}
/**
* Try get label of code in llx_currency then add rate.
@ -466,8 +466,8 @@ class MultiCurrency extends CommonObject
*/
public function updateRate($rate)
{
return $this->addRate($rate);
}
return $this->addRate($rate);
}
/**
* Fetch CurrencyRate object in $this->rate
@ -487,7 +487,7 @@ class MultiCurrency extends CommonObject
$this->rate = new CurrencyRate($this->db);
return $this->rate->fetch($obj->rowid);
}
}
}
/**
* Get id of currency from code
@ -507,7 +507,7 @@ class MultiCurrency extends CommonObject
$resql = $db->query($sql);
if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid;
else return 0;
}
}
/**
* Get id and rate of currency from code
@ -545,30 +545,30 @@ class MultiCurrency extends CommonObject
return array(0, 1);
}
}
}
/**
* Get the conversion of amount with invoice rate
*
* @param int $fk_facture id of facture
* @param double $amount amount to convert
* @param string $way dolibarr mean the amount is in dolibarr currency
* @param string $table facture or facture_fourn
* @return double amount converted
*/
public static function getAmountConversionFromInvoiceRate($fk_facture, $amount, $way = 'dolibarr', $table = 'facture')
{
global $db;
/**
* Get the conversion of amount with invoice rate
*
* @param int $fk_facture id of facture
* @param double $amount amount to convert
* @param string $way dolibarr mean the amount is in dolibarr currency
* @param string $table facture or facture_fourn
* @return double amount converted
*/
public static function getAmountConversionFromInvoiceRate($fk_facture, $amount, $way = 'dolibarr', $table = 'facture')
{
global $db;
$multicurrency_tx = self::getInvoiceRate($fk_facture, $table);
$multicurrency_tx = self::getInvoiceRate($fk_facture, $table);
if ($multicurrency_tx)
{
if ($way == 'dolibarr') return $amount * $multicurrency_tx;
else return $amount / $multicurrency_tx;
}
else return $amount;
}
if ($multicurrency_tx)
{
if ($way == 'dolibarr') return $amount * $multicurrency_tx;
else return $amount / $multicurrency_tx;
}
else return $amount;
}
/**
* Get current invoite rate
@ -633,14 +633,13 @@ class MultiCurrency extends CommonObject
{
global $db,$conf;
$ch = curl_init('http://apilayer.net/api/live?access_key='.$key.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);
$ch = curl_init('http://apilayer.net/api/live?access_key='.$key.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);
if ($response->success)
{
if ($response->success) {
$TRate = $response->quotes;
$timestamp = $response->timestamp;

View File

@ -4326,7 +4326,7 @@ class Product extends CommonObject
$this->stock_theorique=$this->stock_reel-$stock_commande_client;
}
// Stock Increase mode
if (! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
if (! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$this->stock_theorique+=$stock_commande_fournisseur-$stock_reception_fournisseur;
}
if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {

View File

@ -275,21 +275,21 @@ class PriceExpression
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// if (! $error)
// {
// if (! $notrigger)
// {
// // Uncomment this and change MYOBJECT to your own tag if you
// // want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
// //// Call triggers
// //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
// //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
// //// End call triggers
// }
// }
// Commit or rollback
if ($error)

View File

@ -201,19 +201,19 @@ class PriceGlobalVariable
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// if (! $error)
// {
// if (! $notrigger)
// {
// // Uncomment this and change MYOBJECT to your own tag if you
// // want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
// //// Call triggers
// //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
// //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
// //// End call triggers
// }
// }
// Commit or rollback
if ($error)

View File

@ -225,19 +225,19 @@ class PriceGlobalVariableUpdater
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// if (! $error)
// {
// if (! $notrigger)
// {
// // Uncomment this and change MYOBJECT to your own tag if you
// // want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
// //// Call triggers
// //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
// //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
// //// End call triggers
// }
// }
// Commit or rollback
if ($error)

View File

@ -47,8 +47,8 @@ class StockMovements extends DolibarrApi
*/
function __construct()
{
global $db, $conf;
$this->db = $db;
global $db, $conf;
$this->db = $db;
$this->stockmovement = new MouvementStock($this->db);
}
@ -59,26 +59,26 @@ class StockMovements extends DolibarrApi
*
* @param int $id ID of movement
* @return array|mixed data without useless information
*
*
* @throws RestException
*/
/*
function get($id)
{
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
$result = $this->stockmovement->fetch($id);
if( ! $result ) {
throw new RestException(404, 'warehouse not found');
}
if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->stockmovement->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->stockmovement->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->stockmovement);
return $this->_cleanObjectDatas($this->stockmovement);
}*/
/**
@ -91,7 +91,7 @@ class StockMovements extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')"
* @return array Array of warehouse objects
*
* @throws RestException
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
@ -99,9 +99,9 @@ class StockMovements extends DolibarrApi
$obj_ret = array();
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as t";
@ -114,7 +114,7 @@ class StockMovements extends DolibarrApi
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -132,7 +132,7 @@ class StockMovements extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
$i=0;
$i=0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
@ -151,7 +151,7 @@ class StockMovements extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No stock movement found');
}
return $obj_ret;
return $obj_ret;
}
/*
@ -177,8 +177,8 @@ class StockMovements extends DolibarrApi
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
}
throw new RestException(401);
}
// Check mandatory fields
//$result = $this->_validate($request_data);
@ -216,17 +216,17 @@ class StockMovements extends DolibarrApi
function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
}
throw new RestException(401);
}
$result = $this->stockmovement->fetch($id);
if( ! $result ) {
throw new RestException(404, 'stock movement not found');
}
if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
@ -249,16 +249,16 @@ class StockMovements extends DolibarrApi
function delete($id)
{
if(! DolibarrApiAccess::$user->rights->stock->supprimer) {
throw new RestException(401);
}
throw new RestException(401);
}
$result = $this->stockmovement->fetch($id);
if( ! $result ) {
throw new RestException(404, 'stock movement not found');
}
if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (! $this->stockmovement->delete(DolibarrApiAccess::$user)) {
throw new RestException(401,'error when delete stock movement');

View File

@ -45,8 +45,8 @@ class Warehouses extends DolibarrApi
*/
function __construct()
{
global $db, $conf;
$this->db = $db;
global $db, $conf;
$this->db = $db;
$this->warehouse = new Entrepot($this->db);
}
@ -57,25 +57,25 @@ class Warehouses extends DolibarrApi
*
* @param int $id ID of warehouse
* @return array|mixed data without useless information
*
*
* @throws RestException
*/
function get($id)
{
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
if (! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
$result = $this->warehouse->fetch($id);
if( ! $result ) {
if ( ! $result ) {
throw new RestException(404, 'warehouse not found');
}
if( ! DolibarrApi::_checkAccessToResource('warehouse', $this->warehouse->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('warehouse', $this->warehouse->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->warehouse);
return $this->_cleanObjectDatas($this->warehouse);
}
/**
@ -90,7 +90,7 @@ class Warehouses extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')"
* @return array Array of warehouse objects
*
* @throws RestException
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
@ -98,9 +98,9 @@ class Warehouses extends DolibarrApi
$obj_ret = array();
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as t";
@ -112,7 +112,7 @@ class Warehouses extends DolibarrApi
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -130,7 +130,7 @@ class Warehouses extends DolibarrApi
$result = $db->query($sql);
if ($result)
{
$i=0;
$i=0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
@ -149,7 +149,7 @@ class Warehouses extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No warehouse found');
}
return $obj_ret;
return $obj_ret;
}
@ -162,8 +162,8 @@ class Warehouses extends DolibarrApi
function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
}
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -187,17 +187,17 @@ class Warehouses extends DolibarrApi
function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
}
throw new RestException(401);
}
$result = $this->warehouse->fetch($id);
if( ! $result ) {
if ( ! $result ) {
throw new RestException(404, 'warehouse not found');
}
if( ! DolibarrApi::_checkAccessToResource('stock', $this->warehouse->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('stock', $this->warehouse->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
@ -219,16 +219,16 @@ class Warehouses extends DolibarrApi
function delete($id)
{
if(! DolibarrApiAccess::$user->rights->stock->supprimer) {
throw new RestException(401);
}
throw new RestException(401);
}
$result = $this->warehouse->fetch($id);
if( ! $result ) {
throw new RestException(404, 'warehouse not found');
}
if( ! DolibarrApi::_checkAccessToResource('stock', $this->warehouse->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('stock', $this->warehouse->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (! $this->warehouse->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when delete warehouse');

Some files were not shown because too many files have changed in this diff Show More