Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
396ac5fb2b
@ -56,6 +56,8 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.1 compared to 3.5.0 *****
|
||||
Fix: Do not report trigger errors twice.
|
||||
Fix: Error when creating event was not reported.
|
||||
Fix: Bug of import of agenda when using https link
|
||||
Fix: Field nature not saved correctly
|
||||
Fix: Substituion of extra field was ko for order
|
||||
@ -72,6 +74,11 @@ Fix: Page load not ending when large number of thirdparies. We
|
||||
combo feature that is root cause of problem.
|
||||
Fix: [ bug #1231 ] PDF always generated in interventions
|
||||
Fix: Be sure there is no duplicate default rib.
|
||||
Fix: Enable extrafields for customer order, proposal and invoice lines. This feature
|
||||
was developed for 3.5 but was disabled (hidden) because of a bug not possible to
|
||||
fix enough quickly for 3.5.0 release.
|
||||
Fix: user right on Holiday for month report nor working.
|
||||
Fix: [ bug #1250 ] "Supplier Ref. product" sidebar search box does not work
|
||||
|
||||
***** ChangeLog for 3.5 compared to 3.4.* *****
|
||||
For users:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# \file build/makepack-dolibarrmodule.pl
|
||||
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
||||
# \author (c)2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
use Cwd;
|
||||
@ -20,8 +20,8 @@ $GROUP="ldestailleur";
|
||||
|
||||
|
||||
use vars qw/ $REVISION $VERSION /;
|
||||
$REVISION='1.20';
|
||||
$VERSION="1.0 (build $REVISION)";
|
||||
$REVISION='1.0';
|
||||
$VERSION="3.5 (build $REVISION)";
|
||||
|
||||
|
||||
|
||||
@ -245,18 +245,30 @@ foreach my $PROJECT (@PROJECTLIST) {
|
||||
if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; }
|
||||
while(<IN>)
|
||||
{
|
||||
if ($_ =~ /^#/) { next; } # Do not process comments
|
||||
$entry=$_;
|
||||
|
||||
if ($entry =~ /^#/) { next; } # Do not process comments
|
||||
|
||||
$_ =~ s/\n//;
|
||||
$_ =~ /^(.*)\/[^\/]+/;
|
||||
$entry =~ s/\n//;
|
||||
|
||||
if ($entry =~ /^!(.*)$/) # Exclude so remove file/dir
|
||||
{
|
||||
print "Remove $BUILDROOT/$PROJECTLC/$1\n";
|
||||
$ret=`rm -fr "$BUILDROOT/$PROJECTLC/"$1`;
|
||||
if ($? != 0) { die "Failed to delete a file to exclude declared into makepack-".$PROJECT.".conf file (Fails on line ".$entry.")\n"; }
|
||||
next;
|
||||
}
|
||||
|
||||
$entry =~ /^(.*)\/[^\/]+/;
|
||||
print "Create directory $BUILDROOT/$PROJECTLC/$1\n";
|
||||
$ret=`mkdir -p "$BUILDROOT/$PROJECTLC/$1"`;
|
||||
if ($_ !~ /version\-/)
|
||||
if ($entry !~ /version\-/)
|
||||
{
|
||||
print "Copy $SOURCE/$_ into $BUILDROOT/$PROJECTLC/$_\n";
|
||||
$ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$PROJECTLC/$_"`;
|
||||
if ($? != 0) { die "Failed to make copy of a file declared into makepack-".$PROJECT.".conf file (Fails on line ".$_.")\n"; }
|
||||
print "Copy $SOURCE/$entry into $BUILDROOT/$PROJECTLC/$entry\n";
|
||||
$ret=`cp -pr "$SOURCE/$entry" "$BUILDROOT/$PROJECTLC/$entry"`;
|
||||
if ($? != 0) { die "Failed to make copy of a file declared into makepack-".$PROJECT.".conf file (Fails on line ".$entry.")\n"; }
|
||||
}
|
||||
|
||||
}
|
||||
close IN;
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ $tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_fac
|
||||
$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c";
|
||||
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, p.code as country_code, p.libelle as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_pays as p WHERE e.fk_pays=p.rowid and p.active=1";
|
||||
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
$tabsql[16]= "SELECT code, label as libelle, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$tabsql[17]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_fees";
|
||||
$tabsql[18]= "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$tabsql[19]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||
@ -201,7 +201,7 @@ $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
|
||||
$tabfield[13]= "code,libelle,type";
|
||||
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||
$tabfield[15]= "code,libelle,width,height,unit";
|
||||
$tabfield[16]= "code,libelle";
|
||||
$tabfield[16]= "code,libelle,sortorder";
|
||||
$tabfield[17]= "code,libelle";
|
||||
$tabfield[18]= "code,libelle,tracking";
|
||||
$tabfield[19]= "code,libelle";
|
||||
@ -229,7 +229,7 @@ $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
|
||||
$tabfieldvalue[13]= "code,libelle,type";
|
||||
$tabfieldvalue[14]= "code,libelle,price,organization,country";
|
||||
$tabfieldvalue[15]= "code,libelle,width,height,unit";
|
||||
$tabfieldvalue[16]= "code,libelle";
|
||||
$tabfieldvalue[16]= "code,libelle,sortorder";
|
||||
$tabfieldvalue[17]= "code,libelle";
|
||||
$tabfieldvalue[18]= "code,libelle,tracking";
|
||||
$tabfieldvalue[19]= "code,libelle";
|
||||
@ -257,7 +257,7 @@ $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
|
||||
$tabfieldinsert[13]= "code,libelle,type";
|
||||
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||
$tabfieldinsert[16]= "code,label";
|
||||
$tabfieldinsert[16]= "code,label,sortorder";
|
||||
$tabfieldinsert[17]= "code,libelle";
|
||||
$tabfieldinsert[18]= "code,libelle,tracking";
|
||||
$tabfieldinsert[19]= "code,libelle";
|
||||
@ -440,6 +440,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||
|
||||
setEventMessage($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),'errors');
|
||||
}
|
||||
@ -767,6 +768,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); }
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
@ -881,10 +883,11 @@ if ($id)
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
|
||||
@ -41,45 +41,43 @@ $action = GETPOST('action','alpha');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
|
||||
{
|
||||
$db->begin();
|
||||
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
// Mode of stock decrease
|
||||
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
||||
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SHIPMENT')
|
||||
{
|
||||
$db->begin();
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
// Mode of stock increase
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
|
||||
{
|
||||
$db->begin();
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if($action == 'USE_VIRTUAL_STOCK') {
|
||||
$db->begin();
|
||||
$res = dolibarr_set_const($db, "USE_VIRTUAL_STOCK", GETPOST('USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if($action)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
// Mode of stock decrease
|
||||
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
||||
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SHIPMENT')
|
||||
{
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
// Mode of stock increase
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
|
||||
{
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if($action == 'STOCK_USE_VIRTUAL_STOCK') {
|
||||
$res = dolibarr_set_const($db, "STOCK_USE_VIRTUAL_STOCK", GETPOST('STOCK_USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
@ -249,25 +247,34 @@ if (! empty($conf->fournisseur->enabled))
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockReplenishment")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("UseVirtualStock").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"USE_VIRTUAL_STOCK\">";
|
||||
print $form->selectyesno("USE_VIRTUAL_STOCK",$conf->global->USE_VIRTUAL_STOCK,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
|
||||
$virtualdiffersfromphysical=0;
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||
) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
|
||||
if ($virtualdiffersfromphysical)
|
||||
{
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("UseVirtualStockByDefault").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
|
||||
print $form->selectyesno("STOCK_USE_VIRTUAL_STOCK",$conf->global->STOCK_USE_VIRTUAL_STOCK,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
@ -49,12 +49,18 @@ if (!function_exists('xdebug_is_enabled'))
|
||||
|
||||
if (function_exists('socket_create'))
|
||||
{
|
||||
$address = empty($conf->global->XDEBUG_SERVER)?'127.0.0.1':$conf->global->XDEBUG_SERVER;
|
||||
$port = empty($conf->global->XDEBUG_PORT)?9000:$conf->global->XDEBUG_PORT;
|
||||
$address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1';
|
||||
$port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000;
|
||||
|
||||
print 'XDEBUG_SERVER: '.$address."<br>\n";
|
||||
print 'XDEBUG_PORT: '.$port."<br>\n";
|
||||
print "<strong>Current xdebug setup:</strong><br>\n";
|
||||
print 'xdebug.remote_host = '.$address."<br>\n";
|
||||
print 'xdebug.remote_port = '.$port."<br>\n";
|
||||
print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."<br>\n";
|
||||
print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."<br>\n";
|
||||
print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print "<strong>Test debugger server (Eclipse for example):</strong><br>\n";
|
||||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
if (empty($socket)) die('Unable to prepare a socket');
|
||||
//socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port);
|
||||
@ -66,29 +72,29 @@ if (function_exists('socket_create'))
|
||||
echo "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
|
||||
echo "There is a Remote debug server at this address.<br>\n";
|
||||
echo "<br>\n";
|
||||
echo "To be sure this debugger accepts input from your PHP server, be sure to have\n";
|
||||
echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";
|
||||
echo "your php.ini file with this :<br>\n";
|
||||
echo 'xdebug.remote_enable=on<br>
|
||||
xdebug.remote_handle=dbgp<br>
|
||||
xdebug.remote_host=localhost<br>
|
||||
xdebug.remote_port=9000<br>
|
||||
xdebug.profiler_enable=0<br>
|
||||
xdebug.profiler_enable_trigger=1<br>
|
||||
xdebug.show_local_vars=off<br>
|
||||
xdebug.profiler_output_dir=/tmp/xdebug<br>
|
||||
xdebug.profiler_append=0<br>
|
||||
<br>
|
||||
xdebug.trace_enable_trigger=1<br>
|
||||
xdebug.show_mem_delta=1<br>
|
||||
xdebug.trace_output_dir=/tmp/trace<br>
|
||||
xdebug.auto_trace=0<br>
|
||||
'."\n";
|
||||
print "<br>\n";
|
||||
echo '<textarea cols="80" rows="16">'."xdebug.remote_enable=on
|
||||
xdebug.remote_handle=dbgp
|
||||
xdebug.remote_host=localhost
|
||||
xdebug.remote_port=9000
|
||||
xdebug.profiler_enable=0
|
||||
xdebug.profiler_enable_trigger=1
|
||||
xdebug.show_local_vars=off
|
||||
xdebug.profiler_output_dir=/tmp/xdebug
|
||||
xdebug.profiler_append=0
|
||||
; for xdebug 2.2+
|
||||
xdebug.trace_enable_trigger=1
|
||||
xdebug.show_mem_delta=1
|
||||
xdebug.trace_output_dir=/tmp/trace
|
||||
xdebug.auto_trace=0
|
||||
</textarea>\n";
|
||||
print "<br><br>\n";
|
||||
echo 'Then check in your debug server (Eclipse), you have setup:<br>
|
||||
XDebug with same port than in php.ini<br>
|
||||
Allow Remote debug=yes or prompt<br>'."\n";
|
||||
print "<br>\n";
|
||||
echo "Then, to run a debug session, add parameter XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.\n";
|
||||
echo "Then, to run a debug session (when xdebug.profiler_enable_trigger=1), add parameter XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -65,6 +65,21 @@ if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL &&
|
||||
exit;
|
||||
}
|
||||
|
||||
// If stock decrease on bill validation, check user has stock edit permissions
|
||||
if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! empty($username))
|
||||
{
|
||||
$testuser=new User($db);
|
||||
$testuser->fetch(0,$username);
|
||||
$testuser->getrights('stock');
|
||||
if (empty($testuser->rights->stock->creer))
|
||||
{
|
||||
$retour=$langs->trans("UserNeedPermissionToEditStockToUsePos");
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
|
||||
{
|
||||
|
||||
@ -226,7 +226,7 @@ if ($action == 'add_action')
|
||||
|
||||
// On cree l'action
|
||||
$idaction=$object->add($user);
|
||||
|
||||
|
||||
if ($idaction > 0)
|
||||
{
|
||||
if (! $object->error)
|
||||
@ -261,8 +261,10 @@ if ($action == 'add_action')
|
||||
{
|
||||
$db->rollback();
|
||||
$langs->load("errors");
|
||||
|
||||
if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors');
|
||||
if (count($object->errors)) setEventMessage($object->errors, 'errors');
|
||||
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
//Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
|
||||
//Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
|
||||
@ -591,7 +591,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
//Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
|
||||
//Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
@ -605,12 +605,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
if (empty($idprod) && GETPOST('type') < 0)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
@ -620,12 +620,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
if ($qty == '')
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
if (empty($idprod) && empty($product_desc))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
||||
|
||||
@ -1135,7 +1135,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
$price_ht = '';
|
||||
$tva_tx = '';
|
||||
}
|
||||
if (GETPOST('usenewaddlineform')) {
|
||||
if (GETPOST('usenewaddlineform')) { // TODO Remove this
|
||||
$idprod=GETPOST('idprod', 'int');
|
||||
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
|
||||
$price_ht = GETPOST('price_ht');
|
||||
@ -1147,13 +1147,13 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
//Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
|
||||
//Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
unset($_POST["options_".$key]);
|
||||
unset($_POST["options_".$key.$predef]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1314,8 +1314,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
}
|
||||
|
||||
// Margin
|
||||
$fournprice=(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):'');
|
||||
$buyingprice=(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):'');
|
||||
$fournprice=price2num(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):'');
|
||||
$buyingprice=price2num(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):'');
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx= get_localtax($tva_tx, 1, $object->client);
|
||||
@ -1436,8 +1436,8 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
||||
$localtax2_rate=get_localtax($vat_rate,2,$object->client);
|
||||
|
||||
// Add buying price
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||
$fournprice=price2num(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||
$buyingprice=price2num(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||
|
||||
//Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
|
||||
@ -30,6 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("compta");
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
|
||||
$year=GETPOST("year","int");
|
||||
if ($year == 0)
|
||||
|
||||
@ -2268,13 +2268,14 @@ abstract class CommonObject
|
||||
/**
|
||||
* Function to show lines of extrafields with output datas
|
||||
*
|
||||
* @param object $extrafields extrafield Object
|
||||
* @param object $extrafields Extrafield Object
|
||||
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||
* @param array $params optionnal parameters
|
||||
* @param array $params Optionnal parameters
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function showOptionals($extrafields,$mode='view',$params=0)
|
||||
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
|
||||
{
|
||||
global $_POST;
|
||||
|
||||
@ -2342,7 +2343,7 @@ abstract class CommonObject
|
||||
$out .= $extrafields->showOutputField($key,$value);
|
||||
break;
|
||||
case "edit":
|
||||
$out .= $extrafields->showInputField($key,$value);
|
||||
$out .= $extrafields->showInputField($key,$value,'',$keyprefix);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2893,17 +2894,22 @@ abstract class CommonObject
|
||||
$product_static->ref=$line->ref;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
|
||||
// Define output language (TODO Does this works ?)
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||
// Define output language and label
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$this->fetch_thirdparty();
|
||||
if (! is_object($this->thirdparty))
|
||||
{
|
||||
dol_print_error('','Error: Method printObjectLine was called on an object and object->fetch_thirdparty was not done before');
|
||||
return;
|
||||
}
|
||||
|
||||
$prod = new Product($this->db);
|
||||
$prod->fetch($line->fk_product);
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if (empty($newlang)) $newlang=$this->client->default_lang;
|
||||
if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang)) $newlang=$this->thirdparty->default_lang; // For language to language of customer
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -571,14 +571,15 @@ class ExtraFields
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML string to put an input field into a page
|
||||
* Return HTML string to put an input field into a page
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show (for date type it must be in timestamp format)
|
||||
* @param string $moreparam To add more parametes on html input tag
|
||||
* @return void
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show (for date type it must be in timestamp format)
|
||||
* @param string $moreparam To add more parametes on html input tag
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @return void
|
||||
*/
|
||||
function showInputField($key,$value,$moreparam='')
|
||||
function showInputField($key,$value,$moreparam='',$keyprefix='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -620,23 +621,23 @@ class ExtraFields
|
||||
if(!$required && $value == '')
|
||||
$value = '-1';
|
||||
|
||||
$out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
|
||||
//$out='<input type="text" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out = $formstat->select_date($value, 'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
|
||||
// TODO Missing to add $moreparam
|
||||
}
|
||||
elseif (in_array($type,array('int')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
$newsize=$tmp[0];
|
||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'varchar')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'text')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('options_'.$key,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
|
||||
$doleditor=new DolEditor('options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
|
||||
$out=$doleditor->Create(1);
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
@ -647,36 +648,36 @@ class ExtraFields
|
||||
} else {
|
||||
$checked=' value="1" ';
|
||||
}
|
||||
$out='<input type="checkbox" class="flat" name="options_'.$key.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="checkbox" class="flat" name="options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'mail')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="32" value="'.$value.'">';
|
||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="32" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'phone')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="20" value="'.$value.'">';
|
||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'price')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="6" value="'.price($value).'"> '.$langs->getCurrencySymbol($conf->currency);
|
||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
{
|
||||
if (!empty($value)) {
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="6" value="'.$value.'"> ';
|
||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="6" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
}
|
||||
elseif ($type == 'select')
|
||||
{
|
||||
$out = '';
|
||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||
{
|
||||
$out.= ajax_combobox('options_'.$key, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
$out.='<select class="flat" name="options_'.$key.'" id="options_'.$key.'">';
|
||||
$out.='<select class="flat" name="options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
foreach ($param['options'] as $key=>$val )
|
||||
{
|
||||
list($val, $parent) = explode('|', $val);
|
||||
@ -692,10 +693,10 @@ class ExtraFields
|
||||
$out = '';
|
||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||
{
|
||||
$out.= ajax_combobox('options_'.$key, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
$out.='<select class="flat" name="options_'.$key.'" id="options_'.$key.'">';
|
||||
$out.='<select class="flat" name="options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if (is_array($param['options']))
|
||||
{
|
||||
$param_list=array_keys($param['options']);
|
||||
@ -836,7 +837,7 @@ class ExtraFields
|
||||
foreach ($param['options'] as $keyopt=>$val )
|
||||
{
|
||||
|
||||
$out.='<input class="flat" type="checkbox" name="options_'.$key.'[]"';
|
||||
$out.='<input class="flat" type="checkbox" name="options_'.$key.$keyprefix.'[]" '.($moreparam?$moreparam:'');
|
||||
$out.=' value="'.$keyopt.'"';
|
||||
|
||||
if ((is_array($value_arr)) && in_array($keyopt,$value_arr)) {
|
||||
@ -853,7 +854,7 @@ class ExtraFields
|
||||
$out='';
|
||||
foreach ($param['options'] as $keyopt=>$val )
|
||||
{
|
||||
$out.='<input class="flat" type="radio" name="options_'.$key.'"';
|
||||
$out.='<input class="flat" type="radio" name="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
||||
$out.=' value="'.$keyopt.'"';
|
||||
$out.= ($value==$keyopt?'checked="checked"':'');
|
||||
$out.='/>'.$val.'<br>';
|
||||
@ -1101,9 +1102,10 @@ class ExtraFields
|
||||
* return array_options array for object by extrafields value (using for data send by forms)
|
||||
*
|
||||
* @param array $extralabels $array of extrafields
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @return int 1 if array_options set / 0 if no value
|
||||
*/
|
||||
function getOptionalsFromPost($extralabels)
|
||||
function getOptionalsFromPost($extralabels,$keyprefix='')
|
||||
{
|
||||
global $_POST;
|
||||
|
||||
@ -1118,23 +1120,24 @@ class ExtraFields
|
||||
if (in_array($key_type,array('date','datetime')))
|
||||
{
|
||||
// Clean parameters
|
||||
$value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
|
||||
$value_key=dol_mktime($_POST["options_".$key.$keyprefix."hour"], $_POST["options_".$key.$keyprefix."min"], 0, $_POST["options_".$key.$keyprefix."month"], $_POST["options_".$key.$keyprefix."day"], $_POST["options_".$key.$keyprefix."year"]);
|
||||
}
|
||||
else if (in_array($key_type,array('checkbox')))
|
||||
{
|
||||
$value_arr=GETPOST("options_".$key);
|
||||
$value_arr=GETPOST("options_".$key.$keyprefix);
|
||||
$value_key=implode($value_arr,',');
|
||||
}
|
||||
else if (in_array($key_type,array('price','double')))
|
||||
{
|
||||
$value_arr=GETPOST("options_".$key);
|
||||
$value_arr=GETPOST("options_".$key.$keyprefix);
|
||||
$value_key=price2num($value_arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
$value_key=GETPOST("options_".$key);
|
||||
$value_key=GETPOST("options_".$key.$keyprefix);
|
||||
}
|
||||
$array_options["options_".$key]=$value_key;
|
||||
|
||||
$array_options["options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read.
|
||||
}
|
||||
|
||||
return $array_options;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
@ -146,7 +146,7 @@ class FormAdmin
|
||||
if (preg_match('/eldy_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files
|
||||
if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files
|
||||
if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files
|
||||
|
||||
|
||||
$filelib=preg_replace('/\.php$/i','',$file);
|
||||
$prefix='';
|
||||
// 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other
|
||||
@ -324,7 +324,7 @@ class FormAdmin
|
||||
*
|
||||
* @param string $selected Paper format pre-selected
|
||||
* @param string $htmlname Name of HTML select field
|
||||
* @param string $filter Key to filter
|
||||
* @param string $filter Value to filter on code
|
||||
* @param int $showempty Add empty value
|
||||
* @return string Return HTML output
|
||||
*/
|
||||
@ -332,8 +332,12 @@ class FormAdmin
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format where active=1";
|
||||
if ($filter) $sql.=" WHERE code LIKE '%".$filter."%'";
|
||||
$langs->load("dict");
|
||||
|
||||
$sql = "SELECT code, label, width, height, unit";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
$sql.= " WHERE active=1";
|
||||
if ($filter) $sql.=" AND code LIKE '%".$this->db->escape($filter)."%'";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -350,7 +354,11 @@ class FormAdmin
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return '';
|
||||
}
|
||||
$out='';
|
||||
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
@ -4523,26 +4523,23 @@ if (! function_exists('getmypid'))
|
||||
* Natural search
|
||||
*
|
||||
* @param mixed $fields String or array of strings filled with the fields names in the SQL query
|
||||
* @param string $value The value to look for
|
||||
* @param string $value The value to look for (example: "keyword1 keyword2")
|
||||
* @return string $res The statement to append to the SQL query
|
||||
*/
|
||||
function natural_search($fields, $value)
|
||||
{
|
||||
global $db;
|
||||
$crits = explode(' ', $value);
|
||||
$res = "";
|
||||
if (! is_array($fields)) {
|
||||
$fields = array($fields);
|
||||
}
|
||||
$res = '';
|
||||
if (! is_array($fields)) $fields = array($fields);
|
||||
|
||||
$end = count($fields);
|
||||
$end2 = count($crits);
|
||||
$j = 0;
|
||||
foreach ($crits as $crit) {
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
if ( $i > 0 && $i < $end){
|
||||
$res .= " OR ";
|
||||
}
|
||||
if ( $i > 0 && $i < $end) $res .= " OR ";
|
||||
$res .= $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -132,13 +132,10 @@ function invoice_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove');
|
||||
|
||||
|
||||
@ -138,13 +138,10 @@ function order_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove');
|
||||
|
||||
|
||||
@ -136,13 +136,10 @@ function propal_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove');
|
||||
|
||||
|
||||
@ -281,5 +281,5 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__);
|
||||
|
||||
|
||||
@ -1090,7 +1090,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write);
|
||||
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log);
|
||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->view_log);
|
||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,13 +126,20 @@ else {
|
||||
<input type="text" size="5" name="buying_price" class="flat" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
||||
</td>
|
||||
<?php
|
||||
$colspan++;
|
||||
$coldisplay++;
|
||||
|
||||
if ($user->rights->margins->creer)
|
||||
{
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'"><span class="hideonsmartphone">%</span></td>';
|
||||
$colspan++;
|
||||
$coldisplay++;
|
||||
}
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'"><span class="hideonsmartphone">%</span></td>';
|
||||
$colspan++;
|
||||
$coldisplay++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -164,7 +171,7 @@ else {
|
||||
$newline = new FactureLigne($this->db);
|
||||
}
|
||||
if (is_object($newline)) {
|
||||
print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+8));
|
||||
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -262,43 +269,57 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
||||
return false;
|
||||
}
|
||||
|
||||
var np_price = 0;
|
||||
if (remise.val().replace(',','.') != 100)
|
||||
var price = 0;
|
||||
remisejs=price2numjs(remise.val());
|
||||
|
||||
if (remisejs != 100)
|
||||
{
|
||||
if (npRate == "np_marginRate")
|
||||
np_price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
else {
|
||||
if (npRate == "np_markRate")
|
||||
np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
}
|
||||
bpjs=price2numjs(buying_price.val());
|
||||
ratejs=price2numjs(rate.val());
|
||||
|
||||
if (npRate == "marginRate")
|
||||
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
|
||||
else if (npRate == "markRate")
|
||||
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
|
||||
}
|
||||
$("input[name='price_ht']:first").val(roundFloat(np_price));
|
||||
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO This works for french numbers only
|
||||
function roundFloat(num)
|
||||
{
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
|
||||
|
||||
var amount = num.toString().replace(',','.'); // should be useless
|
||||
var nbdec = 0;
|
||||
var rounding = main_rounding;
|
||||
var pos = amount.indexOf('.');
|
||||
/* Function similar to price2num in PHP */
|
||||
function price2numjs(num)
|
||||
{
|
||||
<?php
|
||||
$dec=','; $thousand=' ';
|
||||
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
||||
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
|
||||
if ($thousand == 'None') $thousand='';
|
||||
print "var dec='".$dec."'; var thousand='".$thousand."';\n";
|
||||
?>
|
||||
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
|
||||
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
|
||||
|
||||
var amount = num.toString();
|
||||
|
||||
// rounding for unit price
|
||||
var rounding = main_rounding_unit;
|
||||
var pos = amount.indexOf(dec);
|
||||
var decpart = '';
|
||||
if (pos >= 0)
|
||||
decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
nbdec = decpart.length;
|
||||
if (nbdec > rounding)
|
||||
rounding = nbdec;
|
||||
// Si on depasse max
|
||||
if (rounding > main_max_dec_shown)
|
||||
{
|
||||
rounding = main_max_dec_shown;
|
||||
}
|
||||
//amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors
|
||||
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
var nbdec = decpart.length;
|
||||
if (nbdec > rounding) rounding = nbdec;
|
||||
// If rounding higher than max shown
|
||||
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
|
||||
|
||||
if (thousand != ',' && thousand != '.') amount=amount.replace(',','.');
|
||||
amount=amount.replace(' ',''); // To avoid spaces
|
||||
amount=amount.replace(thousand,''); // Replace of thousand before replace of dec to avoid pb if thousand is .
|
||||
amount=amount.replace(dec,'.');
|
||||
|
||||
return parseFloat(amount).toFixed(rounding);
|
||||
}
|
||||
|
||||
|
||||
@ -190,10 +190,10 @@ if (! empty($conf->margin->enabled)) {
|
||||
if ($user->rights->margins->creer)
|
||||
{
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
echo '<td align="right"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>';
|
||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>';
|
||||
}
|
||||
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
echo '<td align="right"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>';
|
||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -629,47 +629,63 @@ function checkFreeLine(e, npRate)
|
||||
return false;
|
||||
}
|
||||
|
||||
var np_price = 0;
|
||||
if (remise.val().replace(',','.') != 100)
|
||||
var price = 0;
|
||||
remisejs=price2numjs(remise.val());
|
||||
|
||||
if (remisejs != 100)
|
||||
{
|
||||
bpjs=price2numjs(buying_price.val());
|
||||
ratejs=price2numjs(rate.val());
|
||||
|
||||
if (npRate == "np_marginRate")
|
||||
np_price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
else {
|
||||
if (npRate == "np_markRate")
|
||||
np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
}
|
||||
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
|
||||
else if (npRate == "np_markRate")
|
||||
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
|
||||
}
|
||||
$("input[name='price_ht']:first").val(formatFloat(np_price));
|
||||
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
|
||||
|
||||
update_price('price_ht', 'price_ttc');
|
||||
|
||||
return true;
|
||||
}
|
||||
function roundFloat(num) {
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
|
||||
|
||||
var amount = num.toString().replace(',','.'); // should be useless
|
||||
var nbdec = 0;
|
||||
var rounding = main_rounding;
|
||||
var pos = amount.indexOf('.');
|
||||
|
||||
|
||||
/* Function similar to price2num in PHP */
|
||||
function price2numjs(num)
|
||||
{
|
||||
<?php
|
||||
$dec=','; $thousand=' ';
|
||||
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
||||
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
|
||||
if ($thousand == 'None') $thousand='';
|
||||
print "var dec='".$dec."'; var thousand='".$thousand."';\n";
|
||||
?>
|
||||
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
|
||||
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
|
||||
|
||||
var amount = num.toString();
|
||||
|
||||
// rounding for unit price
|
||||
var rounding = main_rounding_unit;
|
||||
var pos = amount.indexOf(dec);
|
||||
var decpart = '';
|
||||
if (pos >= 0)
|
||||
decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
nbdec = decpart.length;
|
||||
if (nbdec > rounding)
|
||||
rounding = nbdec;
|
||||
// Si on depasse max
|
||||
if (rounding > main_max_dec_shown)
|
||||
{
|
||||
rounding = main_max_dec_shown;
|
||||
}
|
||||
//amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors
|
||||
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
var nbdec = decpart.length;
|
||||
if (nbdec > rounding) rounding = nbdec;
|
||||
// If rounding higher than max shown
|
||||
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
|
||||
|
||||
if (thousand != ',' && thousand != '.') amount=amount.replace(',','.');
|
||||
amount=amount.replace(' ',''); // To avoid spaces
|
||||
amount=amount.replace(thousand,''); // Replace of thousand before replace of dec to avoid pb if thousand is .
|
||||
amount=amount.replace(dec,'.');
|
||||
|
||||
return parseFloat(amount).toFixed(rounding);
|
||||
}
|
||||
|
||||
function formatFloat(num) {
|
||||
return roundFloat(num).replace('.', ',');
|
||||
}
|
||||
<?php } ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -471,41 +471,55 @@ if (! empty($conf->margin->enabled))
|
||||
}
|
||||
|
||||
var price = 0;
|
||||
if (remise.val().replace(',','.') != 100)
|
||||
remisejs=price2numjs(remise.val());
|
||||
|
||||
if (remisejs != 100)
|
||||
{
|
||||
bpjs=price2numjs(buying_price.val());
|
||||
ratejs=price2numjs(rate.val());
|
||||
|
||||
if (npRate == "marginRate")
|
||||
price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
else {
|
||||
if (npRate == "markRate")
|
||||
price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
}
|
||||
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
|
||||
else if (npRate == "markRate")
|
||||
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
|
||||
}
|
||||
$("input[name='price_ht']:first").val(roundFloat(price));
|
||||
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO This works for french numbers only
|
||||
function roundFloat(num) {
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
|
||||
/* Function similar to price2num in PHP */
|
||||
function price2numjs(num)
|
||||
{
|
||||
<?php
|
||||
$dec=','; $thousand=' ';
|
||||
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
||||
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
|
||||
if ($thousand == 'None') $thousand='';
|
||||
print "var dec='".$dec."'; var thousand='".$thousand."';\n";
|
||||
?>
|
||||
|
||||
var amount = num.toString().replace(',','.'); // should be useless
|
||||
var nbdec = 0;
|
||||
var rounding = main_rounding;
|
||||
var pos = amount.indexOf('.');
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
|
||||
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
|
||||
|
||||
var amount = num.toString();
|
||||
|
||||
// rounding for unit price
|
||||
var rounding = main_rounding_unit;
|
||||
var pos = amount.indexOf(dec);
|
||||
var decpart = '';
|
||||
if (pos >= 0)
|
||||
decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
nbdec = decpart.length;
|
||||
if (nbdec > rounding)
|
||||
rounding = nbdec;
|
||||
// Si on depasse max
|
||||
if (rounding > main_max_dec_shown)
|
||||
{
|
||||
rounding = main_max_dec_shown;
|
||||
}
|
||||
//amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors
|
||||
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
var nbdec = decpart.length;
|
||||
if (nbdec > rounding) rounding = nbdec;
|
||||
// If rounding higher than max shown
|
||||
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
|
||||
|
||||
if (thousand != ',' && thousand != '.') amount=amount.replace(',','.');
|
||||
amount=amount.replace(' ',''); // To avoid spaces
|
||||
amount=amount.replace(thousand,''); // Replace of thousand before replace of dec to avoid pb if thousand is .
|
||||
amount=amount.replace(dec,'.');
|
||||
|
||||
return parseFloat(amount).toFixed(rounding);
|
||||
}
|
||||
|
||||
|
||||
@ -134,13 +134,20 @@ else {
|
||||
<input type="text" size="5" id="buying_price_predef" name="buying_price_predef" class="flat" value="<?php echo (isset($_POST["buying_price_predef"])?$_POST["buying_price_predef"]:''); ?>">
|
||||
</td>
|
||||
<?php
|
||||
$colspan++;
|
||||
$coldisplay++;
|
||||
|
||||
if ($user->rights->margins->creer)
|
||||
{
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
echo '<td align="right"><input type="text" size="2" name="np_marginRate_predef" value="'.(isset($_POST["np_marginRate_predef"])?$_POST["np_marginRate_predef"]:'').'">%</td>';
|
||||
$colspan++;
|
||||
$coldisplay++;
|
||||
}
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
echo '<td align="right"><input type="text" size="2" name="np_markRate_predef" value="'.(isset($_POST["np_markRate_predef"])?$_POST["np_markRate_predef"]:'').'">%</td>';
|
||||
$colspan++;
|
||||
$coldisplay++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -172,7 +179,7 @@ else {
|
||||
$newline = new FactureLigne($this->db);
|
||||
}
|
||||
if (is_object($newline)) {
|
||||
print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+5));
|
||||
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var],'colspan'=>$coldisplay+5), '_predef');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -270,42 +277,56 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
||||
return false;
|
||||
}
|
||||
|
||||
var np_price = 0;
|
||||
if (remise.val().replace(',','.') != 100)
|
||||
var price = 0;
|
||||
remisejs=price2numjs(remise.val());
|
||||
|
||||
if (remisejs != 100)
|
||||
{
|
||||
bpjs=price2numjs(buying_price.val());
|
||||
ratejs=price2numjs(rate.val());
|
||||
|
||||
if (npRate == "np_marginRate_predef")
|
||||
np_price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
else {
|
||||
if (npRate == "np_markRate_predef")
|
||||
np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
|
||||
}
|
||||
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
|
||||
else if (npRate == "np_markRate_predef")
|
||||
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
|
||||
}
|
||||
$("input[name='price_ht_predef']:last").val(roundFloat(np_price));
|
||||
$("input[name='price_ht_predef']:last").val(price); // TODO Must use a function like php price to have here a formated value
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO This works for french numbers only
|
||||
function roundFloat(num) {
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
|
||||
/* Function similar to price2num in PHP */
|
||||
function price2numjs(num)
|
||||
{
|
||||
<?php
|
||||
$dec=','; $thousand=' ';
|
||||
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
||||
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
|
||||
if ($thousand == 'None') $thousand='';
|
||||
print "var dec='".$dec."'; var thousand='".$thousand."';\n";
|
||||
?>
|
||||
|
||||
var amount = num.toString().replace(',','.'); // should be useless
|
||||
var nbdec = 0;
|
||||
var rounding = main_rounding;
|
||||
var pos = amount.indexOf('.');
|
||||
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
|
||||
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
|
||||
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
|
||||
|
||||
var amount = num.toString();
|
||||
|
||||
// rounding for unit price
|
||||
var rounding = main_rounding_unit;
|
||||
var pos = amount.indexOf(dec);
|
||||
var decpart = '';
|
||||
if (pos >= 0)
|
||||
decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
nbdec = decpart.length;
|
||||
if (nbdec > rounding)
|
||||
rounding = nbdec;
|
||||
// Si on depasse max
|
||||
if (rounding > main_max_dec_shown)
|
||||
{
|
||||
rounding = main_max_dec_shown;
|
||||
}
|
||||
//amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors
|
||||
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
var nbdec = decpart.length;
|
||||
if (nbdec > rounding) rounding = nbdec;
|
||||
// If rounding higher than max shown
|
||||
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
|
||||
|
||||
if (thousand != ',' && thousand != '.') amount=amount.replace(',','.');
|
||||
amount=amount.replace(' ',''); // To avoid spaces
|
||||
amount=amount.replace(thousand,''); // Replace of thousand before replace of dec to avoid pb if thousand is .
|
||||
amount=amount.replace(dec,'.');
|
||||
|
||||
return parseFloat(amount).toFixed(rounding);
|
||||
}
|
||||
|
||||
|
||||
@ -1315,9 +1315,24 @@ else if ($id > 0 || ! empty($ref))
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" name="addinter" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
if ($action == 'editline')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updateline">';
|
||||
print '<input type="hidden" name="line_id" value="'.GETPOST('line_id','int').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
}
|
||||
|
||||
/*
|
||||
* Lignes d'intervention
|
||||
*/
|
||||
*/
|
||||
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
|
||||
$sql.= ' ft.date as date_intervention';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
|
||||
@ -1405,11 +1420,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Ligne en mode update
|
||||
if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid)
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$objp->rowid.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateline">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="line_id" value="'.GETPOST('line_id','int').'">';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
@ -1433,8 +1443,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
print '</tr>' . "\n";
|
||||
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -1459,12 +1467,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td colspan="4"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ajout ligne d'intervention
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'#add" name="addinter" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
|
||||
$var=false;
|
||||
|
||||
print '<tr '.$bc[$var].">\n";
|
||||
@ -1492,8 +1494,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
if (! $num) print '</table>';
|
||||
}
|
||||
|
||||
@ -1504,6 +1504,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
print '</div>';
|
||||
print "\n";
|
||||
|
||||
|
||||
@ -94,37 +94,26 @@ if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.f
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ppf.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
||||
if (GETPOST('mode', 'alpha') == 'search')
|
||||
{
|
||||
$sql .= natural_search(array('p.ref', 'p.label'), GETPOST('mode', 'alpha'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GETPOST('type'))
|
||||
{
|
||||
$sql .= " AND p.fk_product_type = " . GETPOST('type','int');
|
||||
}
|
||||
if ($sref)
|
||||
{
|
||||
$sql .= natural_search('p.ref', $sref);
|
||||
}
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= natural_search('ppf.ref_fourn', $sRefSupplier);
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql .= natural_search('p.label', $snom);
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".$catid;
|
||||
}
|
||||
}
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= natural_search('ppf.ref_fourn', $sRefSupplier);
|
||||
}
|
||||
if (GETPOST('type'))
|
||||
{
|
||||
$sql .= " AND p.fk_product_type = " . GETPOST('type','int');
|
||||
}
|
||||
if ($sref)
|
||||
{
|
||||
$sql .= natural_search('p.ref', $sref);
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql .= natural_search('p.label', $snom);
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".$catid;
|
||||
}
|
||||
if ($fourn_id > 0)
|
||||
{
|
||||
$sql .= " AND ppf.fk_soc = ".$fourn_id;
|
||||
@ -132,9 +121,7 @@ if ($fourn_id > 0)
|
||||
$sql .= " ORDER BY ".$sortfield." ".$sortorder;
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
|
||||
dol_syslog("fourn/product/liste: sql=".$sql);
|
||||
|
||||
dol_syslog("fourn/product/liste.php: sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -142,10 +129,10 @@ if ($resql)
|
||||
|
||||
$i = 0;
|
||||
|
||||
if ($num == 1 && ( isset($_POST["sall"]) || $snom || $sref ) )
|
||||
if ($num == 1 && (GETPOST("mode") == 'search'))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
header("Location: fiche.php?id=".$objp->rowid);
|
||||
header("Location: ".DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -155,8 +142,8 @@ if ($resql)
|
||||
llxHeader("","",$texte);
|
||||
|
||||
|
||||
$param="&tobuy=$tobuy&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"");
|
||||
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
||||
$param="&tobuy=".$tobuy."&sref=".$sref."&snom=".$snom."&fourn_id=".$fourn_id.(isset($type)?"&type=".$type:"").(empty($sRefSupplier)?"":"&srefsupplier=".$sRefSupplier);
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
|
||||
|
||||
|
||||
if (isset($catid))
|
||||
@ -168,27 +155,27 @@ if ($resql)
|
||||
print "</div><br>";
|
||||
}
|
||||
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// Lignes des titres
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplierShort"),"liste.php", "ppf.ref_fourn",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Supplier"),"liste.php", "ppf.fk_soc",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("QtyMin"),"liste.php", "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("UnitPrice"),"liste.php", "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form action="liste.php" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
if ($fourn_id > 0) print '<input type="hidden" name="fourn_id" value="'.$fourn_id.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// Lignes des titres
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplierShort"),$_SERVER["PHP_SELF"], "ppf.ref_fourn",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Supplier"),$_SERVER["PHP_SELF"], "ppf.fk_soc",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("UnitPrice"),$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sref" value="'.$sref.'" size="12">';
|
||||
@ -205,7 +192,6 @@ if ($resql)
|
||||
print '<input type="image" class="liste_titre" value="button_removefilter" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
$oldid = '';
|
||||
$var=True;
|
||||
@ -245,7 +231,7 @@ if ($resql)
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
@ -87,7 +87,7 @@ class Holiday extends CommonObject
|
||||
$this->updateSoldeCP();
|
||||
|
||||
// Vérifie le nombre d'utilisateur et mets à jour si besoin
|
||||
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
|
||||
$this->verifNbUsers($this->countActiveUsersWithoutCP(),$this->getConfCP('nbUser'));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -923,13 +923,13 @@ class Holiday extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql2);
|
||||
$result= $this->db->query($sql2);
|
||||
|
||||
|
||||
if ($result) return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mise à jour pour un utilisateur
|
||||
@ -942,7 +942,7 @@ class Holiday extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($result) return 1;
|
||||
else return -1;
|
||||
}
|
||||
@ -1061,7 +1061,7 @@ class Holiday extends CommonObject
|
||||
|
||||
$sql = "SELECT u.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE statut > '0'";
|
||||
$sql.= " WHERE statut > 0";
|
||||
|
||||
dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1143,7 +1143,7 @@ class Holiday extends CommonObject
|
||||
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE statut > '0'";
|
||||
$sql.= " WHERE statut > 0";
|
||||
|
||||
dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1229,7 +1229,23 @@ class Holiday extends CommonObject
|
||||
|
||||
$sql = "SELECT count(u.rowid) as compteur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE statut > '0'";
|
||||
$sql.= " WHERE u.statut > 0";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$objet = $this->db->fetch_object($result);
|
||||
return $objet->compteur;
|
||||
|
||||
}
|
||||
/**
|
||||
* Compte le nombre d'utilisateur actifs dans Dolibarr sans CP
|
||||
*
|
||||
* @return int retourne le nombre d'utilisateur
|
||||
*/
|
||||
function countActiveUsersWithoutCP() {
|
||||
|
||||
$sql = "SELECT count(u.rowid) as compteur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u LEFT OUTER JOIN ".MAIN_DB_PREFIX."holiday_users hu ON (hu.fk_user=u.rowid)";
|
||||
$sql.= " WHERE u.statut > 0 AND hu.fk_user IS NULL ";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$objet = $this->db->fetch_object($result);
|
||||
@ -1240,17 +1256,17 @@ class Holiday extends CommonObject
|
||||
/**
|
||||
* Compare le nombre d'utilisateur actif de Dolibarr à celui des utilisateurs des congés payés
|
||||
*
|
||||
* @param int $userDolibarr nombre d'utilisateur actifs dans Dolibarr
|
||||
* @param int $userCP nombre d'utilisateur actifs dans le module congés payés
|
||||
* @param int $userDolibarrWithoutCP Number of active users in Dolibarr without holidays
|
||||
* @param int $userCP Number of active users into table of holidays
|
||||
* @return void
|
||||
*/
|
||||
function verifNbUsers($userDolibarr,$userCP) {
|
||||
function verifNbUsers($userDolibarrWithoutCP,$userCP) {
|
||||
|
||||
if (empty($userCP)) $userCP=0;
|
||||
dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarr.' userCP='.$userCP);
|
||||
|
||||
// Si il y a plus d'utilisateur Dolibarr que dans le module CP
|
||||
if ($userDolibarr > $userCP)
|
||||
// On vérifie les users Dolibarr sans CP
|
||||
if ($userDolibarrWithoutCP > 0)
|
||||
{
|
||||
$this->updateConfCP('nbUser',$userDolibarr);
|
||||
|
||||
@ -1311,7 +1327,7 @@ class Holiday extends CommonObject
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// On ajoute l'utilisateur
|
||||
// On supprime l'utilisateur
|
||||
$this->deleteCPuser($obj->fk_user);
|
||||
|
||||
$i++;
|
||||
@ -1654,7 +1670,7 @@ class Holiday extends CommonObject
|
||||
$sql.= " cpl.new_solde";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_logs as cpl";
|
||||
$sql.= " WHERE cpl.rowid > '0'"; // Hack pour la recherche sur le tableau
|
||||
$sql.= " WHERE cpl.rowid > 0"; // To avoid error with other search and criteria
|
||||
|
||||
// Filtrage de séléction
|
||||
if(!empty($filter)) {
|
||||
|
||||
@ -1269,7 +1269,7 @@ PerfDolibarr=Performance setup/optimizing report
|
||||
YouMayFindPerfAdviceHere=You will find on this page some checks or advices related to performance.
|
||||
NotInstalled=Not installed, so your server is not slow down by this.
|
||||
ApplicativeCache=Applicative cache
|
||||
MemcachedNotAvailable=No applicative cache found. You can enhance performance by installing a cache server Memcached and a module able to use this cache server. More information here http://wiki.dolibarr.org/index.php/Module_MemCached_EN. Note that a lot of web hosting provider does not provide such cache server.
|
||||
MemcachedNotAvailable=No applicative cache found. You can enhance performance by installing a cache server Memcached and a module able to use this cache server.<br>More information here <a href="http://wiki.dolibarr.org/index.php/Module_MemCached_EN">http://wiki.dolibarr.org/index.php/Module_MemCached_EN</a>.<br>Note that a lot of web hosting provider does not provide such cache server.
|
||||
OPCodeCache=OPCode cache
|
||||
NoOPCodeCacheFound=No OPCode cache found. May be you use another OPCode cache than XCache or eAccelerator (good), may be you don't have OPCode cache (very bad).
|
||||
HTTPCacheStaticResources=HTTP cache for static resources (css, img, javascript)
|
||||
|
||||
@ -36,4 +36,5 @@ BankToPay=Charge Account
|
||||
ShowCompany=Show company
|
||||
ShowStock=Show warehouse
|
||||
DeleteArticle=Click to remove this article
|
||||
FilterRefOrLabelOrBC=Search (Ref/Label)
|
||||
FilterRefOrLabelOrBC=Search (Ref/Label)
|
||||
UserNeedPermissionToEditStockToUsePos=You ask to decrease stock on invoice creation, so user that use POS need to have permission to edit stock.
|
||||
@ -173,8 +173,8 @@ CustomCode=Customs code
|
||||
CountryOrigin=Origin country
|
||||
HiddenIntoCombo=Hidden into select lists
|
||||
Nature=Nature
|
||||
ProductCodeModel=Product code template
|
||||
ServiceCodeModel=Service code template
|
||||
ProductCodeModel=Product ref template
|
||||
ServiceCodeModel=Service ref template
|
||||
AddThisProductCard=Create product card
|
||||
HelpAddThisProductCard=This option allows you to create or clone a product if it does not exist.
|
||||
AddThisServiceCard=Create service card
|
||||
@ -217,4 +217,4 @@ DefinitionOfBarCodeForThirdpartyNotComplete=Definition of type or value of bar c
|
||||
BarCodeDataForProduct=Barcode information of product %s :
|
||||
BarCodeDataForThirdparty=Barcode information of thirdparty %s :
|
||||
BarcodeStickersMask=xxx
|
||||
|
||||
|
||||
|
||||
@ -94,14 +94,20 @@ DesiredStock=Desired stock
|
||||
StockToBuy=To order
|
||||
Replenishment=Replenishment
|
||||
ReplenishmentOrders=Replenishment orders
|
||||
UseVirtualStock=Use virtual stock instead of physical stock
|
||||
VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical + current orders) may differs
|
||||
UseVirtualStockByDefault=Use virtual stock by default, instead of physical stock, for replenishment feature
|
||||
UseVirtualStock=Use virtual stock
|
||||
UsePhysicalStock=Use physical stock
|
||||
CurentSelectionMode=Curent selection mode
|
||||
CurentlyUsingVirtualStock=Virtual stock
|
||||
CurentlyUsingPhysicalStock=Physical stock
|
||||
RuleForStockReplenishment=Rule for stocks replenishment
|
||||
SelectProductWithNotNullQty=Select at least one product with a qty not null and a supplier
|
||||
AlertOnly= Alerts only
|
||||
WarehouseForStockDecrease=The warehouse <b>%s</b> will be used for stock decrease
|
||||
WarehouseForStockIncrease=The warehouse <b>%s</b> will be used for stock increase
|
||||
ForThisWarehouse=For this warehouse
|
||||
ReplenishmentStatusDesc=This is list of all product with a physical stock lower than desired stock (or alert value if checkbox "alert only" is checked) and suggest you to create supplier orders to fill the difference.
|
||||
ReplenishmentStatusDesc=This is list of all product with a stock lower than desired stock (or lower than alert value if checkbox "alert only" is checked), and suggest you to create supplier orders to fill the difference.
|
||||
ReplenishmentOrdersDesc=This is list of all opened supplier orders
|
||||
Replenishments=Replenishments
|
||||
NbOfProductBeforePeriod=Quantity of product %s in stock before selected period (< %s)
|
||||
|
||||
@ -37,3 +37,4 @@ ShowCompany=Voir société
|
||||
ShowStock=Voir entrepôt
|
||||
DeleteArticle=Cliquez pour enlever cet article
|
||||
FilterRefOrLabelOrBC=Recherche (Ref/Lib.)
|
||||
UserNeedPermissionToEditStockToUsePos=La configuration du module stock demande une réduction du stock sur facturation, aussi l'utilisateur du Point De Vente doit avoir les droits de modifier les stocks
|
||||
@ -51,7 +51,7 @@ StockLimitShort=Limiet
|
||||
StockLimit=Voorraad limiet voor signaleringen
|
||||
PhysicalStock=Fysieke voorraad
|
||||
RealStock=Reële voorraad
|
||||
TheoreticalStock=Therocial voorraad
|
||||
TheoreticalStock=Virtuele voorraad
|
||||
VirtualStock=Virtuele voorraad
|
||||
MininumStock=Minimumvoorraad
|
||||
StockUp=Voorraad op
|
||||
|
||||
@ -56,9 +56,9 @@ $pagenext = $page + 1;
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||
$startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
||||
$enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -90,16 +90,16 @@ print $form->select_dolusers($agentid,'agentid',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||
print '<td>'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').'</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td style="text-align: center;">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Launch').'" />';
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Launch')).'" />';
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
@ -131,9 +131,9 @@ if ($agentid > 0) {
|
||||
$sql .= " AND sc.fk_user = ".$agentid;
|
||||
}
|
||||
if (!empty($startdate))
|
||||
$sql.= " AND f.datef >= '".$startdate."'";
|
||||
$sql.= " AND f.datef >= '".$db->idate($startdate)."'";
|
||||
if (!empty($enddate))
|
||||
$sql.= " AND f.datef <= '".$enddate."'";
|
||||
$sql.= " AND f.datef <= '".$db->idate($enddate)."'";
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0";
|
||||
$sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname";
|
||||
|
||||
@ -49,9 +49,9 @@ $pagenext = $page + 1;
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||
$startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
||||
$enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -119,33 +119,39 @@ if (! $sortfield)
|
||||
}
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||
print '<td>'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').'</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td style="text-align: center;">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Launch').'" />';
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Launch')).'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Total Margin
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<tr><td width="20%">'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
// Margin Rate
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||
print '<tr><td width="20%">'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Mark Rate
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||
print '<tr><td width="20%">'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -167,11 +173,11 @@ $sql.= " AND f.fk_statut > 0";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($client)
|
||||
$sql.= " AND f.fk_soc = $socid";
|
||||
$sql.= " AND f.fk_soc = ".$socid;
|
||||
if (!empty($startdate))
|
||||
$sql.= " AND f.datef >= '".$startdate."'";
|
||||
$sql.= " AND f.datef >= '".$db->idate($startdate)."'";
|
||||
if (!empty($enddate))
|
||||
$sql.= " AND f.datef <= '".$enddate."'";
|
||||
$sql.= " AND f.datef <= '".$db->idate($enddate)."'";
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
@ -210,7 +216,7 @@ if ($result)
|
||||
|
||||
$cumul_achat = 0;
|
||||
$cumul_vente = 0;
|
||||
|
||||
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
if ($num > 0)
|
||||
@ -284,7 +290,7 @@ if ($result)
|
||||
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
print '<tr class="liste_total">';
|
||||
if ($client)
|
||||
print '<td colspan=2>';
|
||||
else
|
||||
@ -316,11 +322,9 @@ $db->close();
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$("div.fiche form input.button[type=submit]").hide();
|
||||
|
||||
$("#socid").change(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
$("#socid").change(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#totalMargin").html("<?php echo price($totalMargin, null, null, null, null, $rounding); ?>");
|
||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%"); ?>");
|
||||
|
||||
@ -71,9 +71,10 @@ $pagenext = $page + 1;
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||
$startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
||||
$enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -121,33 +122,39 @@ else {
|
||||
}
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||
print '<td>'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').'</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td style="text-align: center;">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Launch').'" />';
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Launch')).'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Total Margin
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<tr><td width="20%">'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
// Margin Rate
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||
print '<tr><td width="20%">'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Mark Rate
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||
print '<tr><td width="20%">'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -174,9 +181,9 @@ $sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($id > 0)
|
||||
$sql.= " AND d.fk_product =".$id;
|
||||
if (!empty($startdate))
|
||||
$sql.= " AND f.datef >= '".$startdate."'";
|
||||
$sql.= " AND f.datef >= '".$db->idate($startdate)."'";
|
||||
if (!empty($enddate))
|
||||
$sql.= " AND f.datef <= '".$enddate."'";
|
||||
$sql.= " AND f.datef <= '".$db->idate($enddate)."'";
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
@ -185,6 +192,7 @@ if ($id > 0)
|
||||
$sql.= " ORDER BY ".$sortfield." ".$sortorder;
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('margin::productMargins.php sql='.$sql,LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -289,7 +297,7 @@ if ($result)
|
||||
$marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
|
||||
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
|
||||
}
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
print '<tr class="liste_total">';
|
||||
if ($id > 0)
|
||||
print '<td colspan=2>';
|
||||
else
|
||||
|
||||
@ -349,7 +349,7 @@ class Product extends CommonObject
|
||||
$sql.= ", '".$this->accountancy_code_buy."'";
|
||||
$sql.= ", '".$this->accountancy_code_sell."'";
|
||||
$sql.= ", '".$this->canvas."'";
|
||||
$sql.= ", ".((! isset($this->finished) || $this->finished < 0)?'null':$this->finished);
|
||||
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : $this->finished);
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql);
|
||||
|
||||
@ -170,6 +170,19 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
* View
|
||||
*/
|
||||
|
||||
$virtualdiffersfromphysical=0;
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||
) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
|
||||
$usevirtualstock=-1;
|
||||
if ($virtualdiffersfromphysical)
|
||||
{
|
||||
$usevirtualstock=($conf->global->STOCK_USE_VIRTUAL_STOCK?1:0);
|
||||
if (GETPOST('mode')=='virtual') $usevirtualstock=1;
|
||||
if (GETPOST('mode')=='physical') $usevirtualstock=0;
|
||||
}
|
||||
|
||||
$title = $langs->trans('Status');
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.price,';
|
||||
@ -251,7 +264,20 @@ $head[1][2] = 'replenishorders';
|
||||
|
||||
dol_fiche_head($head, 'replenish', $langs->trans('Replenishment'), 0, 'stock');
|
||||
|
||||
print $langs->trans("ReplenishmentStatusDesc").'<br><br>';
|
||||
print $langs->trans("ReplenishmentStatusDesc").'<br>'."\n";
|
||||
if ($usevirtualstock == 1)
|
||||
{
|
||||
print $langs->trans("CurentSelectionMode").': ';
|
||||
print $langs->trans("CurentlyUsingVirtualStock").' - ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=physical">'.$langs->trans("UsePhysicalStock").'</a><br>';
|
||||
}
|
||||
if ($usevirtualstock == 0)
|
||||
{
|
||||
print $langs->trans("CurentSelectionMode").': ';
|
||||
print $langs->trans("CurentlyUsingPhysicalStock").' - ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=virtual">'.$langs->trans("UseVirtualStock").'</a><br>';
|
||||
}
|
||||
print '<br>'."\n";
|
||||
|
||||
if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) {
|
||||
$filters = '&sref=' . $sref . '&snom=' . $snom;
|
||||
@ -344,14 +370,11 @@ print_liste_field_titre(
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
if ($conf->global->USE_VIRTUAL_STOCK)
|
||||
{
|
||||
$stocklabel = $langs->trans('VirtualStock');
|
||||
}
|
||||
else
|
||||
{
|
||||
$stocklabel = $langs->trans('PhysicalStock');
|
||||
}
|
||||
|
||||
$stocklabel = $langs->trans('Stock');
|
||||
if ($usevirtualstock == 1) $stocklabel = $langs->trans('VirtualStock');
|
||||
if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock');
|
||||
|
||||
print_liste_field_titre(
|
||||
$stocklabel,
|
||||
$_SERVER["PHP_SELF"],
|
||||
@ -449,9 +472,9 @@ while ($i < min($num, $limit))
|
||||
$prod->type = $objp->fk_product_type;
|
||||
$ordered = ordered($prod->id);
|
||||
|
||||
if ($conf->global->USE_VIRTUAL_STOCK)
|
||||
if ($usevirtualstock)
|
||||
{
|
||||
//compute virtual stock
|
||||
// If option to increase/decrease is not on an object validation, virtual stock may differs from physical stock.
|
||||
$prod->fetch($prod->id);
|
||||
$result=$prod->load_stats_commande(0, '1,2');
|
||||
if ($result < 0) {
|
||||
@ -609,4 +632,4 @@ function toggle(source)
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -488,6 +488,7 @@ class User extends CommonObject
|
||||
* Clear all permissions array of user
|
||||
*
|
||||
* @return void
|
||||
* @see getrights
|
||||
*/
|
||||
function clearrights()
|
||||
{
|
||||
@ -503,6 +504,7 @@ class User extends CommonObject
|
||||
*
|
||||
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
||||
* @return void
|
||||
* @see clearrights
|
||||
*/
|
||||
function getrights($moduletag='')
|
||||
{
|
||||
@ -1013,7 +1015,7 @@ class User extends CommonObject
|
||||
{
|
||||
$newpass=$this->setPassword($user,$this->pass);
|
||||
if (is_numeric($newpass) && $newpass < 0) $result=-2;
|
||||
|
||||
|
||||
if ($result > 0 && $member->fk_soc) // If member is linked to a thirdparty
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
|
||||
@ -171,6 +171,12 @@ class AllTests
|
||||
require_once dirname(__FILE__).'/ModulesTest.php'; // At end because it's the longer
|
||||
$suite->addTestSuite('ModulesTest');
|
||||
|
||||
|
||||
// GUI
|
||||
require_once dirname(__FILE__).'/FormAdminTest.php';
|
||||
$suite->addTestSuite('FormAdminTest');
|
||||
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
139
test/phpunit/FormAdminTest.php
Normal file
139
test/phpunit/FormAdminTest.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file test/phpunit/FormAdminTest.php
|
||||
* \ingroup test
|
||||
* \brief PHPUnit test
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
*/
|
||||
|
||||
global $conf,$user,$langs,$db;
|
||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/class/html.formadmin.class.php';
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
|
||||
/**
|
||||
* Class for PHPUnit tests
|
||||
*
|
||||
* @backupGlobals disabled
|
||||
* @backupStaticAttributes enabled
|
||||
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
|
||||
*/
|
||||
class FormAdminTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return FactureTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testFactureCreate
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testSelectPaperFormat()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new FormAdmin($this->savdb);
|
||||
$result=$localobject->select_paper_format('','paperformat_id','A4');
|
||||
|
||||
$this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -403,7 +403,13 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$input="x&<b>#</b>,\"'"; // " will be converted into '
|
||||
$result=dol_escape_js($input);
|
||||
$this->assertEquals("x&<b>#<\/b>,\'\'",$result);
|
||||
$this->assertEquals("x&<b>#</b>,\'\'",$result,"Test mode=0");
|
||||
|
||||
$result=dol_escape_js($input,1);
|
||||
$this->assertEquals("x&<b>#</b>,\"\'",$result,"Test mode=1");
|
||||
|
||||
$result=dol_escape_js($input,2);
|
||||
$this->assertEquals("x&<b>#</b>,\\\"'",$result,"Test mode=2");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user