This commit is contained in:
Maxime Kohlhaas 2017-08-28 10:32:04 +02:00
commit c3152a6343
54 changed files with 739 additions and 508 deletions

View File

@ -3,6 +3,37 @@ English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
FIX: #7075 : bad path for document
FIX: #7156
FIX: #7173
FIX: #7224
FIX: #7226
FIX: #7239
FIX: add supplierproposaldet without price (new product)
FIX: amount overlap other amount when a pagebreak is done due to an image at the bottom of page.
FIX: Bad tax calculation with expense report
FIX: Best buy price calculation
FIX: Buying prices must always be in positive value.
FIX: calculate correct remain to pay for planned bank transactions
FIX: delete linked element on facture rec
FIX: edit sociale was emptying label
FIX: Error when updating thirdparty not returned
FIX: holidays with postgresql like on rowid integer
FIX: id of user not saved when making a payment of expense report
FIX: invoice page list
FIX: invoice situation VAT total rounding into PDF crabe
FIX: PgSQL compatibility.
FIX: remove order rights on invoice page
FIX: status were wrong on product referent list
FIX: supplier id was not passed to hooks
FIX: Support of vat code when using price per customer
FIX: User id correction on holiday request
FIX: value of user id filled to 0 in llx_bank_url when recording an expense report.
FIX: we have to check if contact doesn't already exist on add_contact() function
FIX: We should be able to insert data with value '0' into const
FIX: install process with DoliWamp
***** ChangeLog for 5.0.4 compared to 5.0.3 ***** ***** ChangeLog for 5.0.4 compared to 5.0.3 *****
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
@ -507,7 +538,7 @@ NEW: Disabled users are striked.
NEW: Enhance navigation of project module NEW: Enhance navigation of project module
NEW: fichinter lines ordered by rang AND DATE NEW: fichinter lines ordered by rang AND DATE
NEW: hidden conf to use input file multiple from mail form NEW: hidden conf to use input file multiple from mail form
NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined NEW: hidden feature: SUPPLIER_ORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param). NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param).
NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy. NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy.
NEW: If error is reported during migration process, you can ignore it to avoid to be locked. NEW: If error is reported during migration process, you can ignore it to avoid to be locked.

View File

@ -54,7 +54,7 @@ if ($release != DOL_VERSION)
} }
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
$outputdir=dirname(__FILE__).'/../htdocs/install'; $outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n"; print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
dol_delete_file($outputdir.'/filelist*.xml',0,1,1); dol_delete_file($outputdir.'/filelist*.xml',0,1,1);

View File

@ -245,7 +245,7 @@ class AdherentType extends CommonObject
$sql = "SELECT rowid, libelle"; $sql = "SELECT rowid, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity IN (".getEntity('adherent').")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -113,7 +113,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error);
setEventMessages($company->error, $company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} }
else else
@ -123,7 +122,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
} }
else else
{ {
$errmsg=$object->error; setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -211,7 +210,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]); $paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
} }
$subscription=$_POST["subscription"]; // Amount of subscription $subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
$label=$_POST["label"]; $label=$_POST["label"];
// Payment informations // Payment informations
@ -229,6 +228,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription")); $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
if (GETPOST('end') && ! $datesubend) if (GETPOST('end') && ! $datesubend)
@ -236,6 +236,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription")); $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
if (! $datesubend) if (! $datesubend)
@ -246,16 +247,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")); $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
$amount = price2num(GETPOST("subscription",'alpha'));
// Check if a payment is mandatory or not // Check if a payment is mandatory or not
if (! $error && $adht->subscription) // Member type need subscriptions if (! $error && $adht->subscription) // Member type need subscriptions
{ {
if (! is_numeric($_POST["subscription"])) if (! is_numeric($amount))
{ {
// If field is '' or not a numeric value // If field is '' or not a numeric value
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
$action='addsubscription'; $action='addsubscription';
} }
@ -273,7 +278,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount"); if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
} }
if ($errmsg) $action='addsubscription'; if ($errmsg)
{
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
} }
} }
} }
@ -319,6 +328,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg=$db->lasterror(); $errmsg=$db->lasterror();
setEventMessages($errmsg, null, 'errors');
} }
} }
else else
@ -326,6 +336,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$errmsg=$acct->error; $errmsg=$acct->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
} }
} }
else else
@ -333,6 +344,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$errmsg=$acct->error; $errmsg=$acct->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
} }
} }
@ -351,6 +363,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); $errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
} }
} }
@ -361,6 +374,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$customer->error; $errmsg=$customer->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -378,6 +392,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg='ErrorNoPaymentTermRECEPFound'; $errmsg='ErrorNoPaymentTermRECEPFound';
setEventMessages($errmsg, null, 'errors');
} }
} }
$invoice->socid=$object->fk_soc; $invoice->socid=$object->fk_soc;
@ -395,6 +410,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
$errmsgs=$invoice->errors; $errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -415,6 +431,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result <= 0) if ($result <= 0)
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
} }
} }
@ -427,6 +444,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
$errmsgs=$invoice->errors; $errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -454,6 +472,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
$errmsgs=$paiement->errors; $errmsgs=$paiement->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -535,6 +554,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) if ($result < 0)
{ {
$errmsg=$object->error; $errmsg=$object->error;
setEventMessages($errmsg, null, 'errors');
} }
} }

View File

@ -40,7 +40,7 @@ $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$param = GETPOST('param','alpha'); $param = GETPOST('param','alpha');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type = 'action'; $type = 'action';
@ -286,7 +286,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '<td align="center">'."\n"; print '<td align="center">'."\n";
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} }
@ -299,7 +299,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -311,7 +311,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -43,7 +43,7 @@ if (!$user->admin)
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type = 'bankaccount'; $type = 'bankaccount';
@ -324,7 +324,7 @@ foreach ($dirmodels as $reldir)
print '</td>'; print '</td>';
} else { } else {
print '<td align="center">' . "\n"; print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
print "</td>"; print "</td>";
} }
@ -333,7 +333,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->BANKADDON_PDF == $name) { if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
} }
print '</td>'; print '</td>';

View File

@ -189,7 +189,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -45,7 +45,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type = 'order'; $type = 'order';
@ -490,7 +490,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -502,7 +502,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -36,7 +36,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='contract'; $type='contract';
if (empty($conf->global->CONTRACT_ADDON)) if (empty($conf->global->CONTRACT_ADDON))
@ -425,7 +425,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -437,7 +437,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -44,7 +44,7 @@ if (! $user->admin)
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$value=GETPOST('value','alpha'); $value=GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='shipping'; $type='shipping';
if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
@ -291,7 +291,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>'; print '</a>';
} }
@ -432,7 +432,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -444,7 +444,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';
@ -470,7 +470,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">'; print '<td align="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
} }
else else
{ {

View File

@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='expensereport'; $type='expensereport';
@ -423,7 +423,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
@ -431,7 +431,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -443,7 +443,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='ficheinter'; $type='ficheinter';
@ -458,7 +458,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
@ -466,7 +466,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -478,7 +478,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -43,7 +43,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='delivery'; $type='delivery';
/* /*
@ -412,7 +412,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -432,7 +432,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='invoice'; $type='invoice';
if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php'; if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php';
@ -201,7 +201,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -42,7 +42,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='propal'; $type='propal';
/* /*
@ -469,7 +469,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -481,7 +481,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -43,7 +43,7 @@ accessforbidden();
$type=GETPOST('type', 'alpha'); $type=GETPOST('type', 'alpha');
$value=GETPOST('value', 'alpha'); $value=GETPOST('value', 'alpha');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$specimenthirdparty=new Societe($db); $specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen(); $specimenthirdparty->initAsSpecimen();
@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir)
//if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
//{ //{
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
/*} /*}
@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -421,11 +421,11 @@ foreach ($dirmodels as $reldir)
{ {
//print img_picto($langs->trans("Default"),'on'); //print img_picto($langs->trans("Default"),'on');
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -44,7 +44,7 @@ $type=GETPOST('type', 'alpha');
$value=GETPOST('value', 'alpha'); $value=GETPOST('value', 'alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$specimenthirdparty=new Societe($db); $specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen(); $specimenthirdparty->initAsSpecimen();
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">'."\n"; print '<td align="center">'."\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} }
@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -445,7 +445,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
/* /*
@ -172,7 +172,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -37,7 +37,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='supplier_proposal'; $type='supplier_proposal';
/* /*
@ -446,7 +446,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -458,7 +458,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
@ -572,6 +572,11 @@ if ($action == 'mupdate')
} }
// Actions to delete doc
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
$permissioncreate = ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete));
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
/* /*
* View * View
@ -1449,7 +1454,7 @@ if ($id > 0)
*/ */
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id; $filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$user->rights->agenda->myactions->create; $genallowed=$user->rights->agenda->myactions->create;
$delallowed=$user->rights->agenda->myactions->delete; $delallowed=$user->rights->agenda->myactions->delete;

View File

@ -73,9 +73,9 @@ $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state")); $search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int'); $search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$viewstatut=GETPOST('viewstatut'); $viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$object_statut=GETPOST('propal_statut'); $object_statut=GETPOST('propal_statut','alpha');
$sall=GETPOST('sall', 'alphanohtml'); $sall=GETPOST('sall', 'alphanohtml');
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));

View File

@ -433,7 +433,7 @@ if ($id > 0 || ! empty($ref))
if ($object->canBeConciliated() > 0) { if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) { if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.(!empty($page)?('&page='.$page):'').'">'.$langs->trans("Conciliate").'</a>';
} else { } else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }

View File

@ -275,6 +275,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$refcomp=$societestatic->getNomUrl(1,'',24); $refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done $paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
} }
if ($obj->family == 'social_contribution') if ($obj->family == 'social_contribution')
{ {

View File

@ -2207,10 +2207,6 @@ class Form
unset($producttmpselect); unset($producttmpselect);
} }
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
{
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
}
// mode=2 means suppliers products // mode=2 means suppliers products
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; $urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
@ -2218,11 +2214,6 @@ class Form
} }
else else
{ {
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
{
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
}
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice); print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice);
} }
} }

View File

@ -146,7 +146,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
$buf = fgets($fp, 4096); $buf = fgets($fp, 4096);
// Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment)
if (preg_match('/^--\sV(MYSQL|PGSQL|)([0-9\.]+)/i',$buf,$reg)) if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg))
{ {
$qualified=1; $qualified=1;
@ -159,7 +159,10 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
// restrict on version // restrict on version
if ($qualified) if ($qualified)
{ {
if (! empty($reg[2]))
{
if (is_numeric($reg[2])) // This is a version
{
$versionrequest=explode('.',$reg[2]); $versionrequest=explode('.',$reg[2]);
//print var_dump($versionrequest); //print var_dump($versionrequest);
//print var_dump($versionarray); //print var_dump($versionarray);
@ -168,11 +171,17 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
$qualified=0; $qualified=0;
} }
} }
else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE
{
if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)))) $qualified=0;
}
}
}
if ($qualified) if ($qualified)
{ {
// Version qualified, delete SQL comments // Version qualified, delete SQL comments
$buf=preg_replace('/^--\sV(MYSQL|PGSQL|)([0-9\.]+)/i','',$buf); $buf=preg_replace('/^--\sV(MYSQL|PGSQL)([^\s]*)/i','',$buf);
//print "Ligne $i qualifi?e par version: ".$buf.'<br>'; //print "Ligne $i qualifi?e par version: ".$buf.'<br>';
} }
} }

View File

@ -40,6 +40,7 @@
* Ex: array('disabled'=> * Ex: array('disabled'=>
* Ex: array('show'=> * Ex: array('show'=>
* Ex: array('update_textarea'=> * Ex: array('update_textarea'=>
* Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
* @return string Script * @return string Script
*/ */
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
@ -140,6 +141,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element // Disable an element
if (options.option_disabled) { if (options.option_disabled) {
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
if (ui.item.disabled) { if (ui.item.disabled) {
$("#" + options.option_disabled).prop("disabled", true); $("#" + options.option_disabled).prop("disabled", true);
if (options.error) { if (options.error) {
@ -153,23 +155,27 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
} }
} }
if (options.disabled) { if (options.disabled) {
console.log("Make action disabled on each "+options.option_disabled)
$.each(options.disabled, function(key, value) { $.each(options.disabled, function(key, value) {
$("#" + value).prop("disabled", true); $("#" + value).prop("disabled", true);
}); });
} }
if (options.show) { if (options.show) {
console.log("Make action show on each "+options.show)
$.each(options.show, function(key, value) { $.each(options.show, function(key, value) {
$("#" + value).show().trigger("show"); $("#" + value).show().trigger("show");
}); });
} }
// Update an input // Update an input
if (ui.item.update) { if (ui.item.update) {
console.log("Make action update on each ui.item.update")
// loop on each "update" fields // loop on each "update" fields
$.each(ui.item.update, function(key, value) { $.each(ui.item.update, function(key, value) {
$("#" + key).val(value).trigger("change"); $("#" + key).val(value).trigger("change");
}); });
} }
if (ui.item.textarea) { if (ui.item.textarea) {
console.log("Make action textarea on each ui.item.textarea")
$.each(ui.item.textarea, function(key, value) { $.each(ui.item.textarea, function(key, value) {
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") { if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
CKEDITOR.instances[key].setData(value); CKEDITOR.instances[key].setData(value);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -419,7 +420,7 @@ function dol_get_next_week($day, $week, $month, $year)
{ {
$tmparray = dol_get_first_day_week($day, $month, $year); $tmparray = dol_get_first_day_week($day, $month, $year);
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0); $time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
$time+=24*60*60*7; $time+=24*60*60*7;
$tmparray=dol_getdate($time,true); $tmparray=dol_getdate($time,true);

View File

@ -375,7 +375,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company) $check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object $checksoc = array('societe'); // Test for societe object
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). $checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object $checkproject = array('projet','project'); // Test for project object
$checktask = array('projet_task'); $checktask = array('projet_task');
$nocheck = array('barcode','stock','fournisseur'); // No test $nocheck = array('barcode','stock','fournisseur'); // No test

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -583,11 +583,11 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
{ {
$oldrowid=$assoc['rowid']; $oldrowid=$assoc['rowid'];
$list[$assoc['rate']]['totalht'] += $assoc['total_ht']; $list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
$list[$assoc['rate']]['vat'] += $assoc['total_vat'];
$list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1']; $list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
$list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2']; $list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
} }
$list[$assoc['rate']]['vat'] = $assoc['total_vat'];
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc']; $list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
$list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment'; $list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment';
$list[$assoc['rate']]['datef'][] = $assoc['datef']; $list[$assoc['rate']]['datef'][] = $assoc['datef'];

View File

@ -451,8 +451,6 @@ class pdf_azur extends ModelePDFPropales
// Description of product line // Description of product line
$curX = $this->posxdesc-1; $curX = $this->posxdesc-1;
$showpricebeforepagebreak=1;
$pdf->startTransaction(); $pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();

View File

@ -26,7 +26,7 @@
* $langs * $langs
* $dateSelector * $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders) * $forceall (0 by default, 1 for supplier invoices/orders)
* $senderissupplier (0 by default, 1 for supplier invoices/orders) * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/ */
@ -200,12 +200,13 @@ else {
} }
else else
{ {
// $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum
if ($senderissupplier != 2) if ($senderissupplier != 2)
{ {
$ajaxoptions=array( $ajaxoptions=array(
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error' 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo)
); );
$alsoproductwithnosupplierprice=0; $alsoproductwithnosupplierprice=0;
} }
@ -214,6 +215,7 @@ else {
$ajaxoptions = array(); $ajaxoptions = array();
$alsoproductwithnosupplierprice=1; $alsoproductwithnosupplierprice=1;
} }
$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice); $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice);
} }
echo '</span>'; echo '</span>';

View File

@ -960,6 +960,7 @@ class Cronjob extends CommonObject
$object = new $this->objectname($this->db); $object = new $this->objectname($this->db);
$params_arr = array_map('trim', explode(",",$this->params)); $params_arr = array_map('trim', explode(",",$this->params));
if (!is_array($params_arr)) if (!is_array($params_arr))
{ {
$result = call_user_func(array($object, $this->methodename), $this->params); $result = call_user_func(array($object, $this->methodename), $this->params);
@ -969,7 +970,7 @@ class Cronjob extends CommonObject
$result = call_user_func_array(array($object, $this->methodename), $params_arr); $result = call_user_func_array(array($object, $this->methodename), $params_arr);
} }
if ($result===false || $result != 0) if ($result === false || (! is_bool($result) && $result != 0))
{ {
$langs->load("errors"); $langs->load("errors");
dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR); dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR);
@ -1018,7 +1019,7 @@ class Cronjob extends CommonObject
$result = call_user_func_array($this->methodename, $params_arr); $result = call_user_func_array($this->methodename, $params_arr);
} }
if ($result === false || $result != 0) if ($result === false || (! is_bool($result) && $result != 0))
{ {
$langs->load("errors"); $langs->load("errors");
dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR); dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR);

View File

@ -42,6 +42,8 @@ $typeconst=array('yesno','texte','chaine');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value'); $value = GETPOST('value');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='donation'; $type='donation';
@ -397,14 +399,14 @@ if (is_resource($handle))
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
print '</td>'; print '</td>';
} }
} }
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -418,7 +420,7 @@ if (is_resource($handle))
else else
{ {
print "<td align=\"center\">"; print "<td align=\"center\">";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '</td>'; print '</td>';
} }

View File

@ -2026,11 +2026,13 @@ else if ($id || $ref)
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>'; else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
} }
// Create bill and Close shipment // Create bill
if (! empty($conf->facture->enabled) && $object->statut > 0) if (! empty($conf->facture->enabled) && $object->statut > 0)
{ {
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
{ {
// TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))
// If we do that, we must also make this option official.
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
} }
} }

View File

@ -50,6 +50,7 @@ $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state")); $search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int'); $search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_billed=GETPOST("search_billed",'int');
$sall = GETPOST('sall', 'alphanohtml'); $sall = GETPOST('sall', 'alphanohtml');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
@ -100,7 +101,8 @@ $arrayfields=array(
'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled), 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled),
'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled) 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled),
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
); );
// Extra fields // Extra fields
@ -138,6 +140,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_type=''; $search_type='';
$search_country=''; $search_country='';
$search_type_thirdparty=''; $search_type_thirdparty='';
$search_billed='';
$viewstatut=''; $viewstatut='';
$search_array_options=array(); $search_array_options=array();
} }
@ -174,7 +177,7 @@ $formcompany=new FormCompany($db);
$helpurl='EN:Module_Shipments|FR:Module_Exp&eacute;ditions|ES:M&oacute;dulo_Expediciones'; $helpurl='EN:Module_Shipments|FR:Module_Exp&eacute;ditions|ES:M&oacute;dulo_Expediciones';
llxHeader('',$langs->trans('ListOfSendings'),$helpurl); llxHeader('',$langs->trans('ListOfSendings'),$helpurl);
$sql = "SELECT e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut,"; $sql = "SELECT e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,";
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,"; $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
@ -210,6 +213,7 @@ if ($socid)
if ($viewstatut <> '' && $viewstatut >= 0) { if ($viewstatut <> '' && $viewstatut >= 0) {
$sql.= " AND e.fk_statut = ".$viewstatut; $sql.= " AND e.fk_statut = ".$viewstatut;
} }
if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed;
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_state) $sql.= natural_search("state.nom",$search_state);
@ -340,7 +344,7 @@ if ($resql)
if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'],$_SERVER["PHP_SELF"],"e.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'],$_SERVER["PHP_SELF"],"e.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'],$_SERVER["PHP_SELF"],"e.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'],$_SERVER["PHP_SELF"],"e.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'],$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'],$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['l.fk_statut']['checked'])) print_liste_field_titre($arrayfields['l.fk_statut']['label'], $_SERVER["PHP_SELF"],"l.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'],$_SERVER["PHP_SELF"],"e.billed","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -455,6 +459,13 @@ if ($resql)
print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')),$viewstatut,1); print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')),$viewstatut,1);
print '</td>'; print '</td>';
} }
// Status billed
if (! empty($arrayfields['e.billed']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
print '</td>';
}
// Action column // Action column
print '<td class="liste_titre" align="middle">'; print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
@ -626,6 +637,13 @@ if ($resql)
print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut,5).'</td>'; print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut,5).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Billed
if (! empty($arrayfields['e.billed']['checked']))
{
print '<td align="center">'.yn($obj->billed).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column // Action column
print '<td></td>'; print '<td></td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.6'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -66,7 +66,7 @@ $hookmanager->initHooks(array('suppliercard','globalcard'));
* Action * Action
*/ */
$parameters=array('socid'=>$socid); $parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -1157,7 +1157,7 @@ class CommandeFournisseur extends CommonOrder
// insert products details into database // insert products details into database
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
$result = $this->addline( // This include test on qty if option SUPPLIERORDER_WITH_NOPRICEDEFINED is not set $result = $this->addline( // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set
$this->lines[$i]->desc, $this->lines[$i]->desc,
$this->lines[$i]->subprice, $this->lines[$i]->subprice,
$this->lines[$i]->qty, $this->lines[$i]->qty,
@ -1393,7 +1393,7 @@ class CommandeFournisseur extends CommonOrder
if ($fk_product > 0) if ($fk_product > 0)
{ {
if (empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED)) if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
{ {
// Check quantity is enough // Check quantity is enough
dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref); dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref);
@ -2833,8 +2833,9 @@ class CommandeFournisseur extends CommonOrder
$supplierorderdispatch = new CommandeFournisseurDispatch($this->db); $supplierorderdispatch = new CommandeFournisseurDispatch($this->db);
$filter=array('t.fk_commande'=>$this->id); $filter=array('t.fk_commande'=>$this->id);
if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) {
$filter['t.status']=1; $filter['t.status']=1; // Restrict to lines with status validated
} }
$ret=$supplierorderdispatch->fetchAll('','',0,0,$filter); $ret=$supplierorderdispatch->fetchAll('','',0,0,$filter);
if ($ret<0) if ($ret<0)
{ {
@ -2845,6 +2846,8 @@ class CommandeFournisseur extends CommonOrder
{ {
if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0) if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0)
{ {
$date_liv = dol_now();
// Build array with quantity deliverd by product // Build array with quantity deliverd by product
foreach($supplierorderdispatch->lines as $line) { foreach($supplierorderdispatch->lines as $line) {
$qtydelivered[$line->fk_product]+=$line->qty; $qtydelivered[$line->fk_product]+=$line->qty;
@ -2852,13 +2855,18 @@ class CommandeFournisseur extends CommonOrder
foreach($this->lines as $line) { foreach($this->lines as $line) {
$qtywished[$line->fk_product]+=$line->qty; $qtywished[$line->fk_product]+=$line->qty;
} }
$date_liv = dol_now();
//Compare array //Compare array
$diff_array=array_diff_assoc($qtydelivered,$qtywished); $diff_array=array_diff_assoc($qtydelivered,$qtywished); // Warning: $diff_array is done only on common keys.
$keysinwishednotindelivered=array_diff(array_keys($qtywished),array_keys($qtydelivered)); // To check we also have same number of keys
$keysindeliverednotinwished=array_diff(array_keys($qtydelivered),array_keys($qtywished)); // To check we also have same number of keys
/*var_dump(array_keys($qtydelivered));
var_dump(array_keys($qtywished));
var_dump($diff_array);
var_dump($keysinwishednotindelivered);
var_dump($keysindeliverednotinwished);
exit;*/
if (count($diff_array)==0) //No diff => mean everythings is received if (count($diff_array)==0 && count($keysinwishednotindelivered)==0 && count($keysindeliverednotinwished)==0) //No diff => mean everythings is received
{ {
if ($closeopenorder) if ($closeopenorder)
{ {

View File

@ -588,7 +588,8 @@ class ProductFournisseur extends Product
foreach($record_array as $record) foreach($record_array as $record)
{ {
$fourn_price = $record["price"]; $fourn_price = $record["price"];
$fourn_unitprice = $record["unitprice"]; // discount calculated buy price
$fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) + $record["unitcharges"] - $record["remise"];
if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) { if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) {
$prod_supplier = new ProductFournisseur($this->db); $prod_supplier = new ProductFournisseur($this->db);
$prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"]; $prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"];
@ -620,7 +621,7 @@ class ProductFournisseur extends Product
$this->fourn_qty = $record["quantity"]; $this->fourn_qty = $record["quantity"];
$this->fourn_remise_percent = $record["remise_percent"]; $this->fourn_remise_percent = $record["remise_percent"];
$this->fourn_remise = $record["remise"]; $this->fourn_remise = $record["remise"];
$this->fourn_unitprice = $fourn_unitprice; $this->fourn_unitprice = $record["unitprice"];
$this->fourn_charges = $record["charges"]; // deprecated $this->fourn_charges = $record["charges"]; // deprecated
$this->fourn_unitcharges = $record["unitcharges"]; // deprecated $this->fourn_unitcharges = $record["unitcharges"]; // deprecated
$this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_tva_tx = $record["tva_tx"];
@ -629,7 +630,7 @@ class ProductFournisseur extends Product
$this->delivery_time_days = $record["delivery_time_days"]; $this->delivery_time_days = $record["delivery_time_days"];
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; $this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$this->id = $prodid; $this->id = $prodid;
$min = $this->fourn_unitprice; $min = $fourn_unitprice;
} }
} }
} }

View File

@ -346,21 +346,29 @@ if (empty($reshook))
{ {
$productsupplier = new ProductFournisseur($db); $productsupplier = new ProductFournisseur($db);
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) // TODO this test seems useless
{ {
$idprod=0; $idprod=0;
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
} }
if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg))
if (GETPOST('idprodfournprice') > 0)
{ {
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. $idprod=$reg[1];
$res=$productsupplier->fetch($idprod);
// Call to init properties of $productsupplier
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
$productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist
}
elseif (GETPOST('idprodfournprice') > 0)
{
$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
//$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
$res=$productsupplier->fetch($idprod);
} }
if ($idprod > 0) if ($idprod > 0)
{ {
$res=$productsupplier->fetch($idprod);
$label = $productsupplier->label; $label = $productsupplier->label;
$desc = $productsupplier->description; $desc = $productsupplier->description;
@ -381,8 +389,8 @@ if (empty($reshook))
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$idprod,
$productsupplier->id, $productsupplier->id,
GETPOST('idprodfournprice'),
$productsupplier->fourn_ref, $productsupplier->fourn_ref,
$remise_percent, $remise_percent,
'HT', 'HT',
@ -2074,6 +2082,7 @@ elseif (! empty($object->id))
// Add free products/services form // Add free products/services form
global $forceall, $senderissupplier, $dateSelector; global $forceall, $senderissupplier, $dateSelector;
$forceall=1; $senderissupplier=1; $dateSelector=0; $forceall=1; $senderissupplier=1; $dateSelector=0;
if (! empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) $senderissupplier=2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum.
// Show object lines // Show object lines
$inputalsopricewithtax=0; $inputalsopricewithtax=0;

View File

@ -28,6 +28,7 @@
* \ingroup commande * \ingroup commande
* \brief Page to dispatch receiving * \brief Page to dispatch receiving
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php'; require_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php';
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
@ -84,17 +85,33 @@ if ($id > 0 || ! empty($ref)) {
* Actions * Actions
*/ */
if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))))
{
$error=0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db);
$db->begin();
$result = $supplierorderdispatch->fetch($lineid); $result = $supplierorderdispatch->fetch($lineid);
if (! $result) if (! $result)
dol_print_error($db); {
$error++;
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
$action = '';
}
if (! $error)
{
$result = $supplierorderdispatch->setStatut(1); $result = $supplierorderdispatch->setStatut(1);
if ($result < 0) { if ($result < 0) {
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
$error++; $error++;
$action = ''; $action = '';
} else { }
}
if (! $error)
{
$result = $object->calcAndSetStatusDispatch($user); $result = $object->calcAndSetStatusDispatch($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -102,19 +119,42 @@ if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED
$action = ''; $action = '';
} }
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))))
{
$error=0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db);
$db->begin();
$result = $supplierorderdispatch->fetch($lineid); $result = $supplierorderdispatch->fetch($lineid);
if (! $result) if (! $result)
dol_print_error($db); {
$error++;
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
$action = '';
}
if (! $error)
{
$result = $supplierorderdispatch->setStatut(0); $result = $supplierorderdispatch->setStatut(0);
if ($result < 0) { if ($result < 0) {
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
$error ++; $error ++;
$action = ''; $action = '';
} else { }
}
if (! $error)
{
$result = $object->calcAndSetStatusDispatch($user); $result = $object->calcAndSetStatusDispatch($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -122,19 +162,42 @@ if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANC
$action = ''; $action = '';
} }
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))))
{
$error=0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db);
$db->begin();
$result = $supplierorderdispatch->fetch($lineid); $result = $supplierorderdispatch->fetch($lineid);
if (! $result) if (! $result)
dol_print_error($db); {
$error++;
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
$action = '';
}
if (! $error)
{
$result = $supplierorderdispatch->setStatut(2); $result = $supplierorderdispatch->setStatut(2);
if ($result < 0) { if ($result < 0) {
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
$error ++; $error ++;
$action = ''; $action = '';
} else { }
}
if (! $error)
{
$result = $object->calcAndSetStatusDispatch($user); $result = $object->calcAndSetStatusDispatch($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -142,6 +205,14 @@ if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_
$action = ''; $action = '';
} }
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) { if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) {
@ -699,7 +770,8 @@ if ($id > 0 || ! empty($ref)) {
// Add button to check/uncheck disaptching // Add button to check/uncheck disaptching
print '<td align="center">'; print '<td align="center">';
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))
{
if (empty($objp->status)) { if (empty($objp->status)) {
print '<a class="button buttonRefused" href="#">' . $langs->trans("Approve") . '</a>'; print '<a class="button buttonRefused" href="#">' . $langs->trans("Approve") . '</a>';
print '<a class="button buttonRefused" href="#">' . $langs->trans("Deny") . '</a>'; print '<a class="button buttonRefused" href="#">' . $langs->trans("Deny") . '</a>';

View File

@ -269,7 +269,7 @@ if (empty($reshook))
} }
// Set supplier ref // Set supplier ref
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) if ($action == 'setref_supplier' && $user->rights->fournisseur->facture->creer)
{ {
$object->ref_supplier = GETPOST('ref_supplier', 'alpha'); $object->ref_supplier = GETPOST('ref_supplier', 'alpha');
@ -297,13 +297,13 @@ if (empty($reshook))
} }
// payments conditions // payments conditions
if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer) if ($action == 'setconditions' && $user->rights->fournisseur->facture->creer)
{ {
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
} }
// payment mode // payment mode
else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) else if ($action == 'setmode' && $user->rights->fournisseur->facture->creer)
{ {
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
} }
@ -945,21 +945,30 @@ if (empty($reshook))
if (GETPOST('prod_entry_mode') != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' if (GETPOST('prod_entry_mode') != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
{ {
$idprod=0;
$productsupplier=new ProductFournisseur($db); $productsupplier=new ProductFournisseur($db);
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-2; // Same behaviour than with combolist. When not select idprodfournprice is now -2 (to avoid conflict with next action that may return -1) $idprod=0;
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
if (GETPOST('idprodfournprice') > 0) if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg))
{ {
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. $idprod=$reg[1];
$res=$productsupplier->fetch($idprod);
// Call to init properties of $productsupplier
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
$productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist
}
elseif (GETPOST('idprodfournprice') > 0)
{
$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
//$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
$res=$productsupplier->fetch($idprod);
} }
//Replaces $fk_unit with the product's //Replaces $fk_unit with the product's
if ($idprod > 0) if ($idprod > 0)
{ {
$result=$productsupplier->fetch($idprod);
$label = $productsupplier->label; $label = $productsupplier->label;
$desc = $productsupplier->description; $desc = $productsupplier->description;
@ -974,10 +983,29 @@ if (empty($reshook))
$type = $productsupplier->type; $type = $productsupplier->type;
$price_base_type = 'HT'; $price_base_type = 'HT';
// TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) // TODO Save the product supplier ref into database (like done for supplier propal and order) into field ref_supplier (must rename field ref into ref_supplier first)
$result=$object->addline($desc, $productsupplier->fourn_pu, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $productsupplier->fk_unit); $result=$object->addline(
$desc,
$productsupplier->fourn_pu,
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$qty,
$idprod,
$remise_percent,
$date_start,
$date_end,
0,
$tva_npr,
$price_base_type,
$type,
-1,
0,
$array_options,
$productsupplier->fk_unit
);
} }
if ($idprod == -2 || $idprod == 0) if ($idprod == -99 || $idprod == 0)
{ {
// Product not selected // Product not selected
$error++; $error++;
@ -1989,8 +2017,8 @@ else
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref supplier // Ref supplier
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->facture->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project // Project
@ -1998,7 +2026,7 @@ else
{ {
$langs->load("projects"); $langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->facture->creer)
{ {
if ($action != 'classify') if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';

View File

@ -34,6 +34,7 @@ ALTER TABLE llx_product_customer_price ADD COLUMN localtax1_type varchar(10) NO
ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_supplier_proposal integer NOT NULL;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin; ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin;

View File

@ -13,11 +13,28 @@
-- flush privileges; -- flush privileges;
-- Requests to change character set and collation of a column -- Request to change default pagecode + colation of database
-- ALTER DATABASE name_of_database CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- Request to change default pagecode + colation of table
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; -- ALTER TABLE name_of_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- You can check with "show full columns from llx_accountingaccount";
-- Request to change character set and collation of a varchar column.
-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+)
-- ALTER TABLE name_of_table MODIFY field VARCHAR(20) CHARACTER SET utf8;
-- ALTER TABLE name_of_table MODIFY field VARCHAR(20) COLLATE utf8_unicode_ci;
-- You can check with 'show full columns from mytablename';
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batchlot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;

View File

@ -510,7 +510,7 @@ if (! $error && $db->connected && $action == "set")
print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>'; print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
// Si creation utilisateur admin demandee, on le cree // Si creation utilisateur admin demandee, on le cree
if (isset($db_create_user) && $db_create_user == "on") { if (isset($db_create_user) && ($db_create_user == "1" || $db_create_user == "on")) {
dolibarr_install_syslog("step1: create database user: " . $dolibarr_main_db_user); dolibarr_install_syslog("step1: create database user: " . $dolibarr_main_db_user);
//print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port; //print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port;
@ -614,7 +614,7 @@ if (! $error && $db->connected && $action == "set")
// If database creation is asked, we create it // If database creation is asked, we create it
if (!$error && (isset($db_create_database) && $db_create_database == "on")) { if (!$error && (isset($db_create_database) && ($db_create_database == "1" || $db_create_database == "on"))) {
dolibarr_install_syslog("step1: create database: " . $dolibarr_main_db_name . " " . $dolibarr_main_db_character_set . " " . $dolibarr_main_db_collation . " " . $dolibarr_main_db_user); dolibarr_install_syslog("step1: create database: " . $dolibarr_main_db_name . " " . $dolibarr_main_db_character_set . " " . $dolibarr_main_db_collation . " " . $dolibarr_main_db_user);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port); $newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
//print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit; //print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;

View File

@ -46,7 +46,7 @@ $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$type = GETPOST('type','alpha'); $type = GETPOST('type','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
// Pricing Rules // Pricing Rules
$select_pricing_rules=array( $select_pricing_rules=array(
@ -479,7 +479,7 @@ if ($resql)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=product&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=product&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
@ -495,7 +495,7 @@ if ($resql)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=product&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=product&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
} }

View File

@ -169,12 +169,12 @@ class Productcustomerprice extends CommonObject
$sql .= " " . (empty($this->price_min_ttc) ? '0' : "'" . $this->price_min_ttc . "'") . ","; $sql .= " " . (empty($this->price_min_ttc) ? '0' : "'" . $this->price_min_ttc . "'") . ",";
$sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ","; $sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ",";
$sql .= " ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").","; $sql .= " ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").",";
$sql .= " " . (! isset($this->tva_tx) ? 'NULL' : "'" . $this->tva_tx . "'") . ","; $sql .= " " . (! isset($this->tva_tx) ? 'NULL' : (empty($this->tva_tx)?0:$this->tva_tx)) . ",";
$sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->recuperableonly . "'") . ","; $sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->recuperableonly . "'") . ",";
$sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->localtax1_type . "'") . ","; $sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->localtax1_type . "'") . ",";
$sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : "'" . $this->localtax1_tx . "'") . ","; $sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : (empty($this->localtax1_tx)?0:$this->localtax1_tx)) . ",";
$sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->localtax2_type . "'") . ","; $sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->localtax2_type . "'") . ",";
$sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : "'" . $this->localtax2_tx . "'") . ","; $sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : (empty($this->localtax2_tx)?0:$this->localtax2_tx)) . ",";
$sql .= " " . $user->id . ","; $sql .= " " . $user->id . ",";
$sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ""; $sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . "";
$sql .= ")"; $sql .= ")";
@ -656,10 +656,10 @@ class Productcustomerprice extends CommonObject
$sql .= " price_min_ttc=" . (isset($this->price_min_ttc) ? $this->price_min_ttc : "null") . ","; $sql .= " price_min_ttc=" . (isset($this->price_min_ttc) ? $this->price_min_ttc : "null") . ",";
$sql .= " price_base_type=" . (isset($this->price_base_type) ? "'" . $this->db->escape($this->price_base_type) . "'" : "null") . ","; $sql .= " price_base_type=" . (isset($this->price_base_type) ? "'" . $this->db->escape($this->price_base_type) . "'" : "null") . ",";
$sql .= " default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").","; $sql .= " default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").",";
$sql .= " tva_tx=" . (isset($this->tva_tx) ? $this->tva_tx : "null") . ","; $sql .= " tva_tx=" . (isset($this->tva_tx) ? (empty($this->tva_tx)?0:$this->tva_tx) : "null") . ",";
$sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ","; $sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ",";
$sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? $this->localtax1_tx : "null") . ","; $sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? (empty($this->localtax1_tx)?0:$this->localtax1_tx) : "null") . ",";
$sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? $this->localtax2_tx : "null") . ","; $sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? (empty($this->localtax2_tx)?0:$this->localtax2_tx) : "null") . ",";
$sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->localtax1_type."'": "'0'") . ","; $sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->localtax1_type."'": "'0'") . ",";
$sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->localtax2_type."'": "'0'") . ","; $sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->localtax2_type."'": "'0'") . ",";
$sql .= " fk_user=" . $user->id . ","; $sql .= " fk_user=" . $user->id . ",";

View File

@ -1172,6 +1172,9 @@ if ($action == 'edit_price' && $object->getRights()->creer)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$parameters=array('colspan' => 2);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@ -43,7 +43,7 @@ if (!$user->admin) accessforbidden();
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='project'; $type='project';
@ -672,7 +672,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
@ -680,7 +680,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -692,7 +692,7 @@ foreach ($dirmodels as $reldir)
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';
@ -831,7 +831,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deltask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=deltask&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
@ -839,7 +839,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=settask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=settask&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -851,7 +851,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoctask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoctask&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -134,7 +134,7 @@ if ($action == 'setModuleOptions')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$type='company'; $type='company';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
@ -161,7 +161,7 @@ if ($action== 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST('label','alpha'); $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha'); $scandir = GETPOST('scan_dir','alpha');
$db->begin(); $db->begin();
@ -547,7 +547,7 @@ foreach ($dirsociete as $dirroot)
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
//if ($conf->global->COMPANY_ADDON_PDF != "$name") //if ($conf->global->COMPANY_ADDON_PDF != "$name")
//{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
//} //}
@ -568,7 +568,7 @@ foreach ($dirsociete as $dirroot)
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
} }

View File

@ -168,10 +168,13 @@ if (empty($reshook))
} }
// Merge extrafields // Merge extrafields
if (is_array($soc_origin->array_options))
{
foreach ($soc_origin->array_options as $key => $val) foreach ($soc_origin->array_options as $key => $val)
{ {
if (empty($object->array_options[$key])) $object->array_options[$key] = $val; if (empty($object->array_options[$key])) $object->array_options[$key] = $val;
} }
}
// TODO Merge categories // TODO Merge categories
$object->update($object->id, $user); $object->update($object->id, $user);

View File

@ -579,7 +579,7 @@ if (empty($reshook))
{ {
$productsupplier = new ProductFournisseur($db); $productsupplier = new ProductFournisseur($db);
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) // TODO this test seems useless
{ {
$idprod=0; $idprod=0;
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
@ -594,8 +594,9 @@ if (empty($reshook))
} }
elseif (GETPOST('idprodfournprice') > 0) elseif (GETPOST('idprodfournprice') > 0)
{ {
//$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. //$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist $qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
$res=$productsupplier->fetch($idprod); $res=$productsupplier->fetch($idprod);
} }

View File

@ -55,10 +55,10 @@ $key=$argv[1];
if (! isset($argv[2]) || ! $argv[2]) { if (! isset($argv[2]) || ! $argv[2]) {
usage($path,$script_file); usage($path,$script_file);
exit(-1); exit(-1);
} else {
$userlogin=$argv[2];
} }
$userlogin=$argv[2];
// Global variables // Global variables
$version=DOL_VERSION; $version=DOL_VERSION;
@ -68,9 +68,11 @@ $error=0;
/* /*
* Main * Main
*/ */
// current date
$now=dol_now();
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . $now . " *****\n";
// Check security key // Check security key
if ($key != $conf->global->CRON_KEY) if ($key != $conf->global->CRON_KEY)
@ -114,6 +116,7 @@ else
exit(-1); exit(-1);
} }
} }
$user->getrights();
if (isset($argv[3]) || $argv[3]) if (isset($argv[3]) || $argv[3])
{ {
@ -138,9 +141,6 @@ if ($result<0)
// TODO This sequence of code must be shared with code into cron_run_jobs.php php page. // TODO This sequence of code must be shared with code into cron_run_jobs.php php page.
// current date
$now=dol_now();
if(is_array($object->lines) && (count($object->lines)>0)) if(is_array($object->lines) && (count($object->lines)>0))
{ {
// Loop over job // Loop over job