Merge remote-tracking branch 'upstream/develop' into develop

Conflicts:
	htdocs/commande/fiche.php
This commit is contained in:
frederic34 2013-04-08 11:33:45 +02:00
commit 40f11206de
371 changed files with 10380 additions and 8909 deletions

View File

@ -2,7 +2,7 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 3.4 compared to 3.3 ***** ***** ChangeLog for 3.4 compared to 3.3.2 *****
For users: For users:
- New: Support revenue stamp onto invoices. - New: Support revenue stamp onto invoices.
- New: Add a tab "consumption" on thirdparties to list products bought/sells. - New: Add a tab "consumption" on thirdparties to list products bought/sells.
@ -27,6 +27,9 @@ For users:
- New: [ task #748 ] Add a link "Dolibarr" into left menu - New: [ task #748 ] Add a link "Dolibarr" into left menu
- New: Script email_unpaid_invoices_to_representative accepts now a parameter test - New: Script email_unpaid_invoices_to_representative accepts now a parameter test
and a delay. and a delay.
- New: Can define a different clicktodial setup per user.
- New: Add option INVOICE_CAN_NEVER_BE_REMOVED.
- New: Enhance agenda module to reach RFC2445 (add busy information).
- First change to prepare feature click to print for PDF. - First change to prepare feature click to print for PDF.
For translators: For translators:
@ -44,7 +47,8 @@ For developers:
- Add hook getFormMail. - Add hook getFormMail.
- Function plimit of databases drivers accept -1 as value (it means default value set - Function plimit of databases drivers accept -1 as value (it means default value set
into conf->liste_limit). into conf->liste_limit).
- New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page. - New: Add option dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen,
dol_no_mouse_hover and dol_use_jmobile onto login page (to support different terminal).
- New: dol_syslog method accept a suffix to use different log files for log. - New: dol_syslog method accept a suffix to use different log files for log.
- New: Type of fields are received by export format handlers. - New: Type of fields are received by export format handlers.
- New: when adding an action, we can define a free code to tag it for a specific need. - New: when adding an action, we can define a free code to tag it for a specific need.
@ -60,6 +64,19 @@ WARNING: If you used external modules, some of them may need to be upgraded due
***** ChangeLog for 3.3.2 compared to 3.3.1 *****
- Fix: Ducth (nl_NL) translation
- Fix: [ bug #790 ] Spanish localtax RE not being correctly calculated
- Generalize fix: file with a specific mask not found, again
- Fix: translations and BILL_SUPPLIER_BUILDDOC trigger
- Fix: Can't reset payment due date
- Fix: [ bug #787 ] Invoice supplier box incorrect tooltip when delay on payment
- Fix: [ bug #794 ] Lost filter on zipcode in prospect list
- Fix: [ bug #774 ] Bug on creating event with box "all day" crossed
***** ChangeLog for 3.3.1 compared to 3.3 ***** ***** ChangeLog for 3.3.1 compared to 3.3 *****
- Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag - Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag
@ -70,6 +87,14 @@ WARNING: If you used external modules, some of them may need to be upgraded due
***** ChangeLog for 3.3.2 compared to 3.3.1 *****
-Fix: Ducth (nl_NL) translation
-Fix: [ bug #790 ] Spanish localtax RE not being correctly calculated
-Generalize fix: file with a specific mask not found, again
***** ChangeLog for 3.3.1 compared to 3.3 ***** ***** ChangeLog for 3.3.1 compared to 3.3 *****
- Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag - Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag

View File

@ -104,7 +104,6 @@ clean:
rm -fr htdocs/includes/jquery/plugins/flot rm -fr htdocs/includes/jquery/plugins/flot
rm -fr htdocs/includes/jquery/plugins/jstree rm -fr htdocs/includes/jquery/plugins/jstree
rm -fr htdocs/includes/jquery/plugins/lightbox rm -fr htdocs/includes/jquery/plugins/lightbox
rm -fr htdocs/includes/jquery/plugins/mobile
rm -fr htdocs/includes/jquery/plugins/multiselect rm -fr htdocs/includes/jquery/plugins/multiselect
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip

View File

@ -1,15 +0,0 @@
#!/bin/sh
#------------------------------------------------------
# Script to find files that are not Unix encoded
#
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: finddosfiles.sh
#------------------------------------------------------
# To detec
find . -type f -iname "*.php" -exec file "{}" + | grep CRLF
# To convert
#find . -type f -iname "*.php" -exec dos2unix "{}" +;

View File

@ -1,10 +0,0 @@
#!/bin/sh
#
# Checks if files contains UTF-8 BOM
# in dolibarr source tree excluding
# git repository, custom modules and incuded libraries
#
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
grep -rlI \
--exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' \
$'\xEF\xBB\xBF' .

30
dev/fixdosfiles.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
#------------------------------------------------------
# Script to find files that are not Unix encoded
#
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: fixdosfiles.sh [list|fix]
#------------------------------------------------------
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Usage: fixdosfiles.sh [list|fix]"
fi
# To detec
if [ "x$1" = "xlist" ]
then
find . -iname "*.php" -o -iname "*.sh" -o -iname "*.pl" -o -iname "*.lang" -o -iname "*.txt" -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `find . -iname "*.php" -o -iname "*.sh" -o -iname "*.pl" -o -iname "*.lang" -o -iname "*.txt" -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF | awk -F':' '{ print $1 }' `
do
echo "Fix file $fic"
dos2unix $fic
done;
fi

33
dev/fixutf8bomfiles.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
#
# Checks of fix files contains UTF-8 BOM in dolibarr source tree,
# excluding git repository, custom modules and included libraries.
#
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
# Laurent Destailleur eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: fixutf8bomfiles.sh [list|fix]
#------------------------------------------------------
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Usage: fixutf8bomfiles.sh [list|fix]"
fi
# To detec
if [ "x$1" = "xlist" ]
then
#find . -iname '*.php' -print0 -o -iname '*.sh' -print0 -o -iname '*.pl' -print0 -o -iname '*.lang' -print0 -o -iname '*.txt' -print0 | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'
grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'
fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'`
do
echo "Fixing $fic"
sed -i '1s/^\xEF\xBB\xBF//' $fic
done;
fi

View File

@ -1,15 +0,0 @@
#!/bin/sh
#
# Removes UTF-8 BOM from a file list on STDIN
# Use by piping the output of a findutf8bom script
#
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
#
# Example:
# cd dirwithfiles
# ls | /path/dev/removeutf8bom.sh
while read f; do
echo "Fixing $f"
sed -i '1s/^\xEF\xBB\xBF//' $f
done

26
dev/resize_window.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
#----------------------------------------------------
# Script to resize browser window to 1280x1024 to
# be able to make size fixed screenshots using
# ALT+Print screen.
#----------------------------------------------------
# Syntax
if [ "x$1" = "x" ]
then
echo "resize_windows.sh (list|0x99999999)"
fi
# To list all windows
if [ "x$1" = "xlist" ]
then
wmctrl -l
fi
# To resize a specific window
if [ "x$1" != "xlist" -a "x$1" != "x" ]
then
wmctrl -i -r $1 -e 0,0,0,1280,1024
echo Size of windows $1 modified
fi

View File

@ -46,7 +46,7 @@ class modMyModule extends DolibarrModules
// Id for module (must be unique). // Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 10000; $this->numero = 100000;
// Key text used to identify module (for permissions, menus, etc...) // Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'mymodule'; $this->rights_class = 'mymodule';

View File

@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);
@ -119,7 +117,7 @@ dol_fiche_end();
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
print "</div>"; print "</div>";
} }

View File

@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes_type', $langs->trans("Member"), 0, 'user');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);
@ -120,7 +118,7 @@ dol_fiche_end();
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
print "</div>"; print "</div>";
} }

View File

@ -48,11 +48,13 @@ if ($action == 'update')
$amount=GETPOST('MEMBER_NEWFORM_AMOUNT'); $amount=GETPOST('MEMBER_NEWFORM_AMOUNT');
$editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
$payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE');
$email=GETPOST('MEMBER_PAYONLINE_SENDEMAIL');
$res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_PAYONLINE_SENDEMAIL",$email,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -90,22 +92,39 @@ if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initemail()
{
if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\')
{
jQuery("#tremail").hide();
}
else
{
jQuery("#tremail").show();
}
}
function initfields() function initfields()
{ {
if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\') if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\')
{ {
jQuery(".drag").hide(); jQuery("#tramount").hide();
jQuery("#tredit").hide();
jQuery("#trpayment").hide();
jQuery("#tremail").hide();
} }
if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\') if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\')
{ {
jQuery(".drag").show(); jQuery("#tramount").show();
} jQuery("#tredit").show();
} jQuery("#trpayment").show();
initfields(); if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\') jQuery("#tremail").hide();
jQuery("#MEMBER_ENABLE_PUBLIC").change(function() { else jQuery("#tremail").show();
initfields(); }
}); }
})'; initfields();
jQuery("#MEMBER_ENABLE_PUBLIC").change(function() { initfields(); });
jQuery("#MEMBER_NEWFORM_PAYONLINE").change(function() { initemail(); });
})';
print '</script>'."\n"; print '</script>'."\n";
} }
@ -119,7 +138,7 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>'; print '<td align="right">'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
@ -128,14 +147,14 @@ $var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("EnablePublicSubscriptionForm"); print $langs->trans("EnablePublicSubscriptionForm");
print '</td><td width="60" align="right">'; print '</td><td align="right">';
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1); print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
print "</td></tr>\n"; print "</td></tr>\n";
// Type // Type
/*$var=! $var; /*$var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bcdd[$var].'><td>'; print '<tr '.$bc[$var].' class="drag"><td>';
print $langs->trans("EnablePublicSubscriptionForm"); print $langs->trans("EnablePublicSubscriptionForm");
print '</td><td width="60" align="center">'; print '</td><td width="60" align="center">';
print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1); print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1);
@ -144,32 +163,43 @@ print "</td></tr>\n"; */
// Amount // Amount
$var=! $var; $var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bcdd[$var].'><td>'; print '<tr '.$bc[$var].' id="tramount"><td>';
print $langs->trans("DefaultAmount"); print $langs->trans("DefaultAmount");
print '</td><td width="60" align="right">'; print '</td><td align="right">';
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';; print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';;
print "</td></tr>\n"; print "</td></tr>\n";
// Can edit // Can edit
$var=! $var; $var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bcdd[$var].'><td>'; print '<tr '.$bc[$var].' id="tredit"><td>';
print $langs->trans("CanEditAmount"); print $langs->trans("CanEditAmount");
print '</td><td width="60" align="right">'; print '</td><td align="right">';
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1); print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
print "</td></tr>\n"; print "</td></tr>\n";
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
{
// Jump to an online payment page
$var=! $var;
print '<tr '.$bc[$var].' id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
print '</td><td align="right">';
$listofval=array();
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
print "</td></tr>\n";
}
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
{ {
// Jump to an online payment page // Jump to an online payment page
$var=! $var; $var=! $var;
print '<tr '.$bcdd[$var].'><td>'; print '<tr '.$bc[$var].' id="tremail"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
print '</td><td width="60" align="right">'; print '</td><td align="right">';
$listofval=array(); print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';;
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
print "</td></tr>\n"; print "</td></tr>\n";
} }

View File

@ -139,9 +139,7 @@ if ($object->id > 0)
if (! empty($conf->agenda->enabled)) if (! empty($conf->agenda->enabled))
{ {
// FIXME socid parameters is not valid, a member is not a thirparty print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create">'.$langs->trans("AddAction").'</a></div>';
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$socid.'">'.$langs->trans("AddAction").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create">'.$langs->trans("AddAction").'</a>';
} }
print '</div>'; print '</div>';

View File

@ -642,8 +642,8 @@ if ($rowid)
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($object->statut > 0) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a>"; if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
print "<br>\n"; print "<br>\n";

View File

@ -41,6 +41,10 @@ class Adherent extends CommonObject
public $table_element='adherent'; public $table_element='adherent';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $error;
var $errors;
var $mesgs;
var $id; var $id;
var $ref; var $ref;
var $civilite_id; var $civilite_id;
@ -1370,10 +1374,10 @@ class Adherent extends CommonObject
*/ */
function add_to_abo() function add_to_abo()
{ {
global $conf; global $conf,$langs;
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
$mailmanspip=new MailmanSpip($db); $mailmanspip=new MailmanSpip($this->db);
$err=0; $err=0;
@ -1386,6 +1390,16 @@ class Adherent extends CommonObject
$this->error=$mailmanspip->error; $this->error=$mailmanspip->error;
$err+=1; $err+=1;
} }
foreach ($mailmanspip->mladded_ko as $tmplist => $tmpemail)
{
$langs->load("errors");
$this->errors[]=$langs->trans("ErrorFailedToAddToMailmanList",$tmpemail,$tmplist);
}
foreach ($mailmanspip->mladded_ok as $tmplist => $tmpemail)
{
$langs->load("mailmanspip");
$this->mesgs[]=$langs->trans("SuccessToAddToMailmanList",$tmpemail,$tmplist);
}
} }
// spip // spip
@ -1400,11 +1414,10 @@ class Adherent extends CommonObject
} }
if ($err) if ($err)
{ {
// error
return -$err; return -$err;
} }
else else
{ {
return 1; return 1;
} }
} }
@ -1418,10 +1431,10 @@ class Adherent extends CommonObject
*/ */
function del_to_abo() function del_to_abo()
{ {
global $conf; global $conf,$langs;
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
$mailmanspip=new MailmanSpip($db); $mailmanspip=new MailmanSpip($this->db);
$err=0; $err=0;
@ -1431,8 +1444,20 @@ class Adherent extends CommonObject
$result=$mailmanspip->del_to_mailman($this); $result=$mailmanspip->del_to_mailman($this);
if ($result < 0) if ($result < 0)
{ {
$this->error=$mailmanspip->error;
$err+=1; $err+=1;
} }
foreach ($mailmanspip->mlremoved_ko as $tmplist => $tmpemail)
{
$langs->load("errors");
$this->errors[]=$langs->trans("ErrorFailedToRemoveToMailmanList",$tmpemail,$tmplist);
}
foreach ($mailmanspip->mlremoved_ok as $tmplist => $tmpemail)
{
$langs->load("mailmanspip");
$this->mesgs[]=$langs->trans("SuccessToRemoveToMailmanList",$tmpemail,$tmplist);
}
} }
if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled))
@ -1505,40 +1530,6 @@ class Adherent extends CommonObject
return $result; return $result;
} }
/**
* Return full address of member
*
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @return string Full address string
*/
function getFullAddress($withcountry=0,$sep="\n")
{
$ret='';
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{
require_once DOL_DOCUMENT_ROOT .'/core/lib/company.lib.php';
$tmparray=getCountry($this->country_id,'all');
$this->country_code=$tmparray['code'];
$this->country =$tmparray['label'];
}
if (in_array($this->country_code,array('US')))
{
$ret.=($this->address?$this->address.$sep:'');
$ret.=trim($this->zip.' '.$this->town);
if ($withcountry) $ret.=($this->country?$sep.$this->country:'');
}
else
{
$ret.=($this->address?$this->address.$sep:'');
$ret.=trim($this->zip.' '.$this->town);
if ($withcountry) $ret.=($this->country?$sep.$this->country:'');
}
return trim($ret);
}
/** /**
* Retourne le libelle du statut d'un adherent (brouillon, valide, resilie) * Retourne le libelle du statut d'un adherent (brouillon, valide, resilie)
* *

View File

@ -64,6 +64,9 @@ if (! empty($conf->mailmanspip->enabled))
$object = new Adherent($db); $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member');
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($socid); $object->getCanvas($socid);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); $canvas = $object->canvas?$object->canvas:GETPOST("canvas");
@ -282,14 +285,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$object->statut = $_POST["statut"]; $object->statut = $_POST["statut"];
$object->public = $_POST["public"]; $object->public = $_POST["public"];
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
{
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=$_POST[$key];
}
}
// Check if we need to also synchronize user information // Check if we need to also synchronize user information
$nosyncuser=0; $nosyncuser=0;
@ -356,14 +353,23 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{ {
if ($object->oldcopy->del_to_abo() < 0) if ($object->oldcopy->del_to_abo() < 0)
{ {
// error if (! empty($object->oldcopy->error)) setEventMessage($langs->trans("ErrorFailedToRemoveToMailmanList").': '.$object->oldcopy->error, 'errors');
$errmsgs[]= $langs->trans("FailedToCleanMailmanList").': '.$object->error."<br>\n"; setEventMessage($object->oldcopy->errors, 'errors');
}
else
{
setEventMessage($object->oldcopy->mesgs,'mesgs');
} }
} }
if ($object->add_to_abo() < 0) // We add subscription if new email or new type (new type may means more mailing-list to subscribe) // We add subscription if new email or new type (new type may means more mailing-list to subscribe)
if ($object->add_to_abo() < 0)
{
if (! empty($object->error)) setEventMessage($langs->trans("ErrorFailedToAddToMailmanList").': '.$object->error, 'errors');
setEventMessage($object->errors, 'errors');
}
else
{ {
// error setEventMessage($object->mesgs, 'mesgs');
$errmsgs[]= $langs->trans("FailedToAddToMailmanList").': '.$object->error."<br>\n";
} }
} }
@ -451,14 +457,8 @@ if ($action == 'add' && $user->rights->adherent->creer)
$object->fk_soc = $socid; $object->fk_soc = $socid;
$object->public = $public; $object->public = $public;
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
{
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=$_POST[$key];
}
}
// Check parameters // Check parameters
if (empty($morphy) || $morphy == "-1") { if (empty($morphy) || $morphy == "-1") {
@ -684,9 +684,6 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
$form = new Form($db); $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member');
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('',$langs->trans("Member"),$help_url); llxHeader('',$langs->trans("Member"),$help_url);
@ -885,15 +882,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?GETPOST('options_'.$key,'alpha'):(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:''));
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
} }
/* /*
@ -1128,15 +1117,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
} }
// Third party Dolibarr // Third party Dolibarr
@ -1458,13 +1439,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields);
{
$value=$object->array_options["options_$key"];
print "<tr><td>".$label."</td><td>";
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}
} }
// Third party Dolibarr // Third party Dolibarr
@ -1553,11 +1528,11 @@ else
// Modify // Modify
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Modify")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$rowid.'&action=edit">'.$langs->trans("Modify")."</a></div>";
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Modify")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>';
} }
// Valider // Valider
@ -1565,11 +1540,11 @@ else
{ {
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$rowid.'&action=valid">'.$langs->trans("Validate")."</a></div>\n";
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Validate")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</font></div>';
} }
} }
@ -1578,11 +1553,11 @@ else
{ {
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Reenable")."</a>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$rowid.'&action=valid">'.$langs->trans("Reenable")."</a></div>\n";
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Reenable")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable")."</font></div>";
} }
} }
@ -1591,17 +1566,17 @@ else
{ {
if ($object->statut >= 1) if ($object->statut >= 1)
{ {
if ($object->email) print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n"; if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
else print "<a class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NoEMail"))."\">".$langs->trans("SendCardByMail")."</a>\n"; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("ValidateBefore"))."\">".$langs->trans("SendCardByMail")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
} }
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("SendCardByMail")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
} }
// Resilier // Resilier
@ -1609,11 +1584,11 @@ else
{ {
if ($user->rights->adherent->supprimer) if ($user->rights->adherent->supprimer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$rowid.'&action=resign">'.$langs->trans("Resiliate")."</a></div>\n";
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Resiliate")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate")."</font></div>";
} }
} }
@ -1622,12 +1597,12 @@ else
{ {
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
if ($object->statut != -1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>'; if ($object->statut != -1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrThirdParty")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty")."</font></div>";
} }
} }
@ -1636,23 +1611,23 @@ else
{ {
if ($user->rights->user->user->creer) if ($user->rights->user->user->creer)
{ {
if ($object->statut != -1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'; if ($object->statut != -1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrLogin")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin")."</font></div>";
} }
} }
// Delete // Delete
if ($user->rights->adherent->supprimer) if ($user->rights->adherent->supprimer)
{ {
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$object->id&action=delete\">".$langs->trans("Delete")."</a>\n"; print '<div class="inline-block divButAction"><a class="butActionDelete" href="fiche.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>\n";
} }
else else
{ {
print "<font class=\"butActionRefused\" href=\"#\" title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Delete")."</font>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
} }
// Action SPIP // Action SPIP
@ -1662,21 +1637,22 @@ else
if ($isinspip == 1) if ($isinspip == 1)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."</a>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$object->id.'&action=del_spip">'.$langs->trans("DeleteIntoSpip")."</a></div>\n";
} }
if ($isinspip == 0) if ($isinspip == 0)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=add_spip\">".$langs->trans("AddIntoSpip")."</a>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n";
}
if ($isinspip == -1)
{
print '<br><br><font class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</font>';
} }
} }
} }
print '</div>'; print '</div>';
if ($isinspip == -1)
{
print '<br><br><font class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</font>';
}
print "<br>\n"; print "<br>\n";
} }

View File

@ -371,18 +371,18 @@ if ($rowid && $action != 'edit')
{ {
if (! $bankline->rappro) if (! $bankline->rappro)
{ {
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Modify")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Modify")."</a></div>";
} }
else else
{ {
print "<a class=\"butActionRefused\" title=\"".$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a>"; print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a></div>";
} }
} }
// Supprimer // Supprimer
if ($user->rights->adherent->cotisation->creer) if ($user->rights->adherent->cotisation->creer)
{ {
print "<a class=\"butActionDelete\" href=\"".$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=delete\">".$langs->trans("Delete")."</a>\n"; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=delete\">".$langs->trans("Delete")."</a></div>\n";
} }
print '</div>'; print '</div>';

View File

@ -419,7 +419,7 @@ print "</tr>\n";
print "</table><br>\n"; print "</table><br>\n";
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -169,7 +169,7 @@ print '<div class="tabsAction">';
if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr')
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$adh->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$adh->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
} }
print "</div>\n"; print "</div>\n";

View File

@ -167,7 +167,7 @@ if ($id)
if ($user->rights->adherent->creer && $action != 'edit') if ($user->rights->adherent->creer && $action != 'edit')
{ {
print "<a class=\"butAction\" href=\"note.php?id=".$object->id."&amp;action=edit\">".$langs->trans('Modify')."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="note.php?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify')."</a></div>";
} }
print "</div>"; print "</div>";

View File

@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
$WIDTH=500; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=200; $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0; $userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0; $socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
@ -143,8 +143,7 @@ $head = member_stats_prepare_head($adh);
dol_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), 0, 'user'); dol_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), 0, 'user');
print '<table class="notopnoleftnopadd" width="100%"><tr>'; print '<div class="fichecenter"><div class="fichethirdleft">';
print '<td align="center" valign="top">';
// Show filter box // Show filter box
/*print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; /*print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -210,8 +209,8 @@ foreach ($data as $val)
print '</table>'; print '</table>';
print '</td>'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<td align="center" valign="top">';
// Show graphs // Show graphs
print '<table class="border" width="100%"><tr valign="top"><td align="center">'; print '<table class="border" width="100%"><tr valign="top"><td align="center">';
@ -223,7 +222,10 @@ else {
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr></table>';
print '</div></div></div>';
print '<div style="clear:both"></div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -56,6 +56,9 @@ $result=restrictedArea($user,'adherent',$rowid,'adherent_type');
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
if (GETPOST('button_removefilter')) if (GETPOST('button_removefilter'))
{ {
$search_lastname=""; $search_lastname="";
@ -84,14 +87,8 @@ if ($action == 'add' && $user->rights->adherent->configurer)
$adht->mail_valid = trim($_POST["mail_valid"]); $adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $adht->vote = trim($_POST["vote"]);
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
{
if (preg_match("/^options_/",$key))
{
$adht->array_options[$key]=GETPOST($key);
}
}
if ($adht->libelle) if ($adht->libelle)
{ {
@ -127,14 +124,8 @@ if ($action == 'update' && $user->rights->adherent->configurer)
$adht->mail_valid = trim($_POST["mail_valid"]); $adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $adht->vote = trim($_POST["vote"]);
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
{
if (preg_match("/^options_/",$key))
{
$adht->array_options[$key]=GETPOST($key);
}
}
$adht->update($user->id); $adht->update($user->id);
@ -167,8 +158,6 @@ llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_
$form=new Form($db); $form=new Form($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
// Liste of members type // Liste of members type
@ -229,7 +218,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
// New type // New type
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=create">'.$langs->trans("NewType").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=create">'.$langs->trans("NewType").'</a></div>';
} }
print "</div>"; print "</div>";
@ -245,6 +234,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
$form = new Form($db); $form = new Form($db);
$adht = new AdherentType($db);
print_fiche_titre($langs->trans("NewMemberType")); print_fiche_titre($langs->trans("NewMemberType"));
@ -278,23 +268,11 @@ if ($action == 'create')
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print '<br><br><table class="border" width="100%">'; print $adht->showOptionals($extrafields,'edit');
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$act->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print ' width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
print '</table><br><br>';
} }
print "</table>\n";
print '<br>'; print '<br>';
print '<center><input type="submit" name="button" class="button" value="'.$langs->trans("Add").'"> &nbsp; &nbsp; '; print '<center><input type="submit" name="button" class="button" value="'.$langs->trans("Add").'"> &nbsp; &nbsp; ';
@ -356,23 +334,13 @@ if ($rowid > 0)
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print '</table>';
//Extra field
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print '<br><br><table class="border" width="100%">'; // View extrafields
foreach($extrafields->attribute_label as $key=>$label) print $adht->showOptionals($extrafields);
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($adht->array_options['options_'.$key])?$adht->array_options['options_'.$key]:''));
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}
print '</table><br><br>';
} }
print '</table>';
print '</div>'; print '</div>';
/* /*
@ -384,16 +352,16 @@ if ($rowid > 0)
// Edit // Edit
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$adht->id.'">'.$langs->trans("Modify").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$adht->id.'">'.$langs->trans("Modify").'</a></div>';
} }
// Add // Add
print '<a class="butAction" href="fiche.php?action=create&typeid='.$adht->id.'">'.$langs->trans("AddMember").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?action=create&typeid='.$adht->id.'">'.$langs->trans("AddMember").'</a></div>';
// Delete // Delete
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$adht->id.'">'.$langs->trans("DeleteType").'</a>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$adht->id.'">'.$langs->trans("DeleteType").'</a></div>';
} }
print "</div>"; print "</div>";

View File

@ -78,8 +78,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Agenda"));
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);

View File

@ -44,24 +44,24 @@ $object = new Expedition($db);
* Actions * Actions
*/ */
//if ($action==setvalue AND $carrier) //if ($action==setvalue AND $carrier)
if ($action==setvalue) if ($action=='setvalue')
{ {
// need to add check on values // need to add check on values
$object->update[code]=GETPOST('code','alpha'); $object->update['code']=GETPOST('code','alpha');
$object->update[libelle]=GETPOST('libelle','alpha'); $object->update['libelle']=GETPOST('libelle','alpha');
$object->update[description]=GETPOST('description','alpha'); $object->update['description']=GETPOST('description','alpha');
$object->update[tracking]=GETPOST('tracking','alpha'); $object->update['tracking']=GETPOST('tracking','alpha');
$object->update_delivery_method($carrier); $object->update_delivery_method($carrier);
header("Location: carrier.php"); header("Location: carrier.php");
exit; exit;
} }
if ($action==activate_carrier AND $carrier!='') if ($action=='activate_carrier' && $carrier!='')
{ {
$object->activ_delivery_method($carrier); $object->activ_delivery_method($carrier);
} }
if ($action==disable_carrier AND $carrier!='') if ($action=='disable_carrier' && $carrier!='')
{ {
$object->disable_delivery_method($carrier); $object->disable_delivery_method($carrier);
} }
@ -134,26 +134,26 @@ if ($action=='edit_carrier' || $action=='setvalue')
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">'; print '<tr '.$bc[$var].'><td class="fieldrequired">';
print $langs->trans("Code").'</td><td>'; print $langs->trans("Code").'</td><td>';
print '<input size="32" type="text" name="code" value="'.$object->listmeths[0][code].'">'; print '<input size="32" type="text" name="code" value="'.$object->listmeths[0]['code'].'">';
print ' &nbsp; '.$langs->trans("Example").': CODE'; print ' &nbsp; '.$langs->trans("Example").': CODE';
print '</td></tr>'; print '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">'; print '<tr '.$bc[$var].'><td class="fieldrequired">';
print $langs->trans("Name").'</td><td>'; print $langs->trans("Name").'</td><td>';
print '<input size="32" type="text" name="libelle" value="'.$object->listmeths[0][libelle].'">'; print '<input size="32" type="text" name="libelle" value="'.$object->listmeths[0]['libelle'].'">';
print '</td></tr>'; print '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">'; print '<tr '.$bc[$var].'><td class="fieldrequired">';
print $langs->trans("Description").'</td><td>'; print $langs->trans("Description").'</td><td>';
print '<input size="64" type="text" name="description" value="'.$object->listmeths[0][description].'">'; print '<input size="64" type="text" name="description" value="'.$object->listmeths[0]['description'].'">';
print '</td></tr>'; print '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">'; print '<tr '.$bc[$var].'><td class="fieldrequired">';
print $langs->trans("Tracking").'</td><td>'; print $langs->trans("Tracking").'</td><td>';
print '<input size="128" type="text" name="tracking" value="'.$object->listmeths[0][tracking].'">'; print '<input size="128" type="text" name="tracking" value="'.$object->listmeths[0]['tracking'].'">';
print ' &nbsp; '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}'; print ' &nbsp; '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
print '</td></tr>'; print '</td></tr>';
@ -186,25 +186,26 @@ else
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'; print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>'; print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
print "</tr>\n"; print "</tr>\n";
for ($i=0; $i<sizeof($object->listmeths); $i++) $numlistmeths=count($object->listmeths);
for ($i=0; $i<$numlistmeths; $i++)
{ {
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td>'.$object->listmeths[$i][code].'</td>'; print '<td>'.$object->listmeths[$i]['code'].'</td>';
print '<td>'.$object->listmeths[$i][libelle].'</td>'; print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
print '<td>'.$object->listmeths[$i][description].'</td>'; print '<td>'.$object->listmeths[$i]['description'].'</td>';
print '<td>'.$object->listmeths[$i][tracking].'</td>'; print '<td>'.$object->listmeths[$i]['tracking'].'</td>';
print '<td align="center">'; print '<td align="center">';
if($object->listmeths[$i][active] == 0) if($object->listmeths[$i]['active'] == 0)
{ {
print '<a href="carrier.php?action=activate_carrier&amp;carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="carrier.php?action=activate_carrier&amp;carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
else else
{ {
print '<a href="carrier.php?action=disable_carrier&amp;carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="carrier.php?action=disable_carrier&amp;carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
} }
print '</td><td align="center">'; print '</td><td align="center">';
print '<a href="carrier.php?action=edit_carrier&amp;carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Edit"),'edit').'</a>'; print '<a href="carrier.php?action=edit_carrier&amp;carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -38,7 +38,7 @@ $action = GETPOST("action");
*/ */
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("url"), 'chaine', 0, '', $conf->entity);
if ($result >= 0) if ($result >= 0)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
@ -54,6 +54,8 @@ if ($action == 'setvalue' && $user->admin)
* View * View
*/ */
$user->fetch_clicktodial();
$wikihelp='EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es'; $wikihelp='EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es';
llxHeader('',$langs->trans("ClickToDialSetup"),$wikihelp); llxHeader('',$langs->trans("ClickToDialSetup"),$wikihelp);
@ -69,33 +71,67 @@ print '<input type="hidden" name="action" value="setvalue">';
$var=true; $var=true;
print '<table class="nobordernopadding" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="120">'.$langs->trans("Name").'</td>'; print '<td width="120">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td valign="top">'; print '<tr '.$bc[$var].'><td valign="top">';
print $langs->trans("URL").'</td><td>'; print $langs->trans("DefaultLink").'</td><td>';
print '<input size="92" type="text" name="url" value="'.$conf->global->CLICKTODIAL_URL.'"><br>'; print '<input size="92" type="text" name="url" value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
print '<br>'; print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>'; print $langs->trans("ClickToDialUrlDesc").'<br>';
print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';
//if (! empty($user->clicktodial_url))
//{
print '<br>';
print info_admin($langs->trans("ValueOverwrittenByUserSetup"));
//}
print '</td></tr>'; print '</td></tr>';
print '<tr><td colspan="3" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>'; print '</table>';
print '</table></form>';
/*if (! empty($conf->global->CLICKTODIAL_URL)) print '<center><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';
{
print $langs->trans("Test"); print '</form><br><br>';
// Add a phone number to test
}
*/ if (! empty($conf->global->CLICKTODIAL_URL))
{
$user->fetch_clicktodial();
$phonefortest=$mysoc->phone;
if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest');
print '<form action="'.$_SERVER["PHP_SELF"].'">';
print $langs->trans("LinkToTestClickToDial",$user->login).' : ';
print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">';
print '</form>';
$setupcomplete=1;
if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0;
if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0;
if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0;
if ($setupcomplete)
{
print $langs->trans("LinkToTest",$user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL');
}
else
{
$langs->load("errors");
print '<div class="warning">'.$langs->trans("WarningClickToDialUserSetupNotComplete").'</div>';
}
}
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -8,6 +8,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -32,6 +33,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("errors"); $langs->load("errors");
@ -202,15 +204,9 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup');
print '<br>'; print '<br>';
$h = 0; $head = order_admin_prepare_head(null);
$head[$h][0] = DOL_URL_ROOT."/admin/commande.php"; dol_fiche_head($head, 'general', $langs->trans("ModuleSetup"), 0, 'order');
$head[$h][1] = $langs->trans("Orders");
$head[$h][2] = 'Order';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/* /*
* Orders Numbering model * Orders Numbering model

View File

@ -997,7 +997,7 @@ else
// Actions buttons // Actions buttons
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@ -0,0 +1,157 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 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
* 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/>.
*/
/**
* \file htdocs/admin/agenda_extrafields.php
* \ingroup agenda
* \brief Page to setup extra fields of agenda
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=getStaticMember(get_class($extrafields),'type2label');
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='commande';
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
/*
* View
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
print "<br>\n";
$head = order_admin_prepare_head(null);
dol_fiche_head($head, 'attributes', $langs->trans("ModuleSetup"), 0, 'order');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();
$db->close();
?>

View File

@ -162,10 +162,34 @@ if ($action == 'setdefaultduration')
} }
} }
/*if ($action == 'setusecustomercontactasrecipient') // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions')
{ {
dolibarr_set_const($db, "PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["value"],'chaine',0,'',$conf->entity); $post_size=count($_POST);
}*/
$db->begin();
for($i=0;$i < $post_size;$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=GETPOST("param".$i,'alpha');
$value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}

View File

@ -161,7 +161,7 @@ if ($action == 'edit')
{ {
$form=new Form($db); $form=new Form($db);
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=sms_manager">DoliStore</a>').'</div>'; if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -217,7 +217,7 @@ else
{ {
$var=true; $var=true;
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=sms_manager">DoliStore</a>').'</div>'; if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';

View File

@ -330,7 +330,7 @@ $def = array();
$sql = "SELECT nom"; $sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = 'order_supplier'"; $sql.= " WHERE type = 'invoice_supplier'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -409,7 +409,7 @@ foreach ($dirmodels as $reldir)
else else
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }

View File

@ -88,8 +88,7 @@ $var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n"; print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) print $conf->smart_menu; print $conf->standard_menu;
else print $conf->standard_menu;
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -121,12 +121,13 @@ if ($catname || $id > 0)
} }
print "</table>"; print "</table>";
} }
else print '&nbsp;';
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
print '<br>'; print '<div class="fichecenter"><br>';
// Charge tableau des categories // Charge tableau des categories
@ -187,6 +188,7 @@ else
print "</table>"; print "</table>";
print '</div>';
llxFooter(); llxFooter();

View File

@ -59,7 +59,7 @@ class ActionComm extends CommonObject
var $punctual = 1; // Milestone var $punctual = 1; // Milestone
var $percentage; // Percentage var $percentage; // Percentage
var $location; // Location var $location; // Location
var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
var $priority; // Free text ('' By default) var $priority; // Free text ('' By default)
var $note; // Description var $note; // Description
@ -121,6 +121,7 @@ class ActionComm extends CommonObject
if (empty($this->priority)) $this->priority = 0; if (empty($this->priority)) $this->priority = 0;
if (empty($this->fulldayevent)) $this->fulldayevent = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0;
if (empty($this->punctual)) $this->punctual = 0; if (empty($this->punctual)) $this->punctual = 0;
if (empty($this->transparency)) $this->transparency = 0;
if ($this->percentage > 100) $this->percentage = 100; if ($this->percentage > 100) $this->percentage = 100;
if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep);
@ -178,6 +179,7 @@ class ActionComm extends CommonObject
$sql.= "fk_user_action,"; $sql.= "fk_user_action,";
$sql.= "fk_user_done,"; $sql.= "fk_user_done,";
$sql.= "label,percent,priority,fulldayevent,location,punctual,"; $sql.= "label,percent,priority,fulldayevent,location,punctual,";
$sql.= "transparency,";
$sql.= "fk_element,"; $sql.= "fk_element,";
$sql.= "elementtype,"; $sql.= "elementtype,";
$sql.= "entity"; $sql.= "entity";
@ -196,6 +198,7 @@ class ActionComm extends CommonObject
$sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; $sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").",";
$sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; $sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").",";
$sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',"; $sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',";
$sql.= "'".$this->transparency."',";
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").","; $sql.= (! empty($this->fk_element)?$this->fk_element:"null").",";
$sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").","; $sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").",";
$sql.= $conf->entity; $sql.= $conf->entity;
@ -282,7 +285,7 @@ class ActionComm extends CommonObject
$sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_user_action, a.fk_user_done,";
$sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype,";
$sql.= " a.priority, a.fulldayevent, a.location,"; $sql.= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle,";
$sql.= " s.nom as socname,"; $sql.= " s.nom as socname,";
$sql.= " u.firstname, u.lastname as lastname"; $sql.= " u.firstname, u.lastname as lastname";
@ -331,6 +334,7 @@ class ActionComm extends CommonObject
$this->priority = $obj->priority; $this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
$this->transparency = $obj->transparency;
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->societe->id = $obj->fk_soc; $this->societe->id = $obj->fk_soc;
@ -437,6 +441,7 @@ class ActionComm extends CommonObject
$this->note=trim($this->note); $this->note=trim($this->note);
if (empty($this->percentage)) $this->percentage = 0; if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority)) $this->priority = 0; if (empty($this->priority)) $this->priority = 0;
if (empty($this->transparency)) $this->transparency = 0;
if (empty($this->fulldayevent)) $this->fulldayevent = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0;
if ($this->percentage > 100) $this->percentage = 100; if ($this->percentage > 100) $this->percentage = 100;
if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
@ -471,6 +476,7 @@ class ActionComm extends CommonObject
$sql.= ", priority = '".$this->priority."'"; $sql.= ", priority = '".$this->priority."'";
$sql.= ", fulldayevent = '".$this->fulldayevent."'"; $sql.= ", fulldayevent = '".$this->fulldayevent."'";
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
$sql.= ", transparency = '".$this->transparency."'";
$sql.= ", fk_user_mod = '".$user->id."'"; $sql.= ", fk_user_mod = '".$user->id."'";
$sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null"); $sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null");
$sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null");
@ -952,7 +958,7 @@ class ActionComm extends CommonObject
$event['priority']=$obj->priority; $event['priority']=$obj->priority;
$event['fulldayevent']=$obj->fulldayevent; $event['fulldayevent']=$obj->fulldayevent;
$event['location']=$obj->location; $event['location']=$obj->location;
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy) $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['category']=$obj->libelle; // libelle type action $event['category']=$obj->libelle; // libelle type action
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@ -1058,6 +1064,7 @@ class ActionComm extends CommonObject
$this->punctual=0; $this->punctual=0;
$this->percentage=0; $this->percentage=0;
$this->location='Location'; $this->location='Location';
$this->transparency=0;
$this->priority='Priority X'; $this->priority='Priority X';
$this->note = 'Note'; $this->note = 'Note';
} }

View File

@ -63,6 +63,9 @@ $actioncomm = new ActionComm($db);
$contact = new Contact($db); $contact = new Contact($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm');
//var_dump($_POST); //var_dump($_POST);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
@ -133,6 +136,7 @@ if ($action == 'add_action')
$actioncomm->priority = GETPOST("priority")?GETPOST("priority"):0; $actioncomm->priority = GETPOST("priority")?GETPOST("priority"):0;
$actioncomm->fulldayevent = (! empty($fulldayevent)?1:0); $actioncomm->fulldayevent = (! empty($fulldayevent)?1:0);
$actioncomm->location = GETPOST("location"); $actioncomm->location = GETPOST("location");
$actioncomm->transparency = (GETPOST("transparency")=='on'?1:0);
$actioncomm->label = trim(GETPOST('label')); $actioncomm->label = trim(GETPOST('label'));
if (! GETPOST('label')) if (! GETPOST('label'))
{ {
@ -203,14 +207,8 @@ if ($action == 'add_action')
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
} }
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$actioncomm);
{
if (preg_match("/^options_/",$key))
{
$actioncomm->array_options[$key]=GETPOST($key);
}
}
if (! $error) if (! $error)
{ {
@ -316,7 +314,7 @@ if ($action == 'update')
$actioncomm->percentage = $percentage; $actioncomm->percentage = $percentage;
$actioncomm->priority = $_POST["priority"]; $actioncomm->priority = $_POST["priority"];
$actioncomm->fulldayevent= $_POST["fullday"]?1:0; $actioncomm->fulldayevent= $_POST["fullday"]?1:0;
$actioncomm->location = isset($_POST["location"])?$_POST["location"]:''; $actioncomm->location = GETPOST('location');
$actioncomm->societe->id = $_POST["socid"]; $actioncomm->societe->id = $_POST["socid"];
$actioncomm->contact->id = $_POST["contactid"]; $actioncomm->contact->id = $_POST["contactid"];
$actioncomm->fk_project = $_POST["projectid"]; $actioncomm->fk_project = $_POST["projectid"];
@ -336,6 +334,8 @@ if ($action == 'update')
$usertodo->fetch($_POST["affectedto"]); $usertodo->fetch($_POST["affectedto"]);
} }
$actioncomm->usertodo = $usertodo; $actioncomm->usertodo = $usertodo;
$actioncomm->transparency=(GETPOST("transparency")=='on'?1:0);
$userdone=new User($db); $userdone=new User($db);
if ($_POST["doneby"]) if ($_POST["doneby"])
{ {
@ -343,14 +343,8 @@ if ($action == 'update')
} }
$actioncomm->userdone = $userdone; $actioncomm->userdone = $userdone;
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$actioncomm);
{
if (preg_match("/^options_/",$key))
{
$actioncomm->array_options[$key]=GETPOST($key);
}
}
if (! $error) if (! $error)
{ {
@ -395,9 +389,6 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
$form = new Form($db); $form = new Form($db);
$htmlactions = new FormActions($db); $htmlactions = new FormActions($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm');
if ($action == 'create') if ($action == 'create')
{ {
$contact = new Contact($db); $contact = new Contact($db);
@ -427,7 +418,7 @@ if ($action == 'create')
$(".fulldaystartmin").attr("disabled","disabled").val("00"); $(".fulldaystartmin").attr("disabled","disabled").val("00");
$(".fulldayendhour").attr("disabled","disabled").val("23"); $(".fulldayendhour").attr("disabled","disabled").val("23");
$(".fulldayendmin").attr("disabled","disabled").val("59"); $(".fulldayendmin").attr("disabled","disabled").val("59");
$("#p2").attr("disabled","disabled").val(""); $("#p2").removeAttr("disabled");
} }
} }
setdatefields(); setdatefields();
@ -521,17 +512,25 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Affected by // Assigned to
$var=false; $var=false;
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>'; print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
$form->select_users(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($actioncomm->usertodo->id) && $actioncomm->usertodo->id > 0 ? $actioncomm->usertodo->id : $user->id),'affectedto',1); $form->select_users(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($actioncomm->usertodo->id) && $actioncomm->usertodo->id > 0 ? $actioncomm->usertodo->id : $user->id),'affectedto',1);
print '</td></tr>'; print '</td></tr>';
// Realised by // Busy
print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td>'; print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Busy").'</td><td>';
$form->select_users(GETPOST("doneby")?GETPOST("doneby"):(! empty($actioncomm->userdone->id) && $percent==100?$actioncomm->userdone->id:0),'doneby',1); print '<input id="transparency" type="checkbox" name="transparency" value="'.$actioncomm->transparency.'">';
print '</td></tr>'; print '</td></tr>';
// Realised by
if ($conf->global->AGENDA_ENABLE_DONEBY)
{
print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td>';
$form->select_users(GETPOST("doneby")?GETPOST("doneby"):(! empty($actioncomm->userdone->id) && $percent==100?$actioncomm->userdone->id:0),'doneby',1);
print '</td></tr>';
}
print '</table>'; print '</table>';
print '<br><br>'; print '<br><br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -603,23 +602,14 @@ if ($action == 'create')
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook
print '</table>';
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print '<br><br><table class="border" width="100%">'; print $actioncomm->showOptionals($extrafields,'edit');
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($actioncomm->array_options["options_".$key])?$actioncomm->array_options["options_".$key]:''));
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print ' width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
print '</table><br>';
} }
print '</table>';
print '<center><br>'; print '<center><br>';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
@ -766,22 +756,24 @@ if ($id > 0)
print '</table><br><br><table class="border" width="100%">'; print '</table><br><br><table class="border" width="100%">';
// Input by // Assigned to
$var=false; print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionAskedBy").'</td><td colspan="3">';
print $act->author->getNomUrl(1);
print '</td></tr>';
// Affected to
print '<tr><td nowrap="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
print $form->select_dolusers($act->usertodo->id>0?$act->usertodo->id:-1,'affectedto',1); print $form->select_dolusers($act->usertodo->id>0?$act->usertodo->id:-1,'affectedto',1);
print '</td></tr>'; print '</td></tr>';
// Realised by // Busy
print '<tr><td nowrap="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">'; print '<tr><td nowrap="nowrap">'.$langs->trans("Busy").'</td><td>';
print $form->select_dolusers($act->userdone->id> 0?$act->userdone->id:-1,'doneby',1); print '<input id="transparency" type="checkbox" name="transparency"'.($act->transparency?' checked="checked"':'').'">';
print '</td></tr>'; print '</td></tr>';
// Realised by
if ($conf->global->AGENDA_ENABLE_DONEBY)
{
print '<tr><td nowrap="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
print $form->select_dolusers($act->userdone->id> 0?$act->userdone->id:-1,'doneby',1);
print '</td></tr>';
}
print '</table><br><br>'; print '</table><br><br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -838,24 +830,13 @@ if ($id > 0)
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print '</table>';
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print '<br><br><table class="border" width="100%">'; print $actioncomm->showOptionals($extrafields,'edit');
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$act->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print ' width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
print '</table><br><br>';
} }
print '</table>';
print '<center><br><input type="submit" class="button" name="edit" value="'.$langs->trans("Save").'">'; print '<center><br><input type="submit" class="button" name="edit" value="'.$langs->trans("Save").'">';
print ' &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print ' &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -901,7 +882,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -910,7 +891,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -919,7 +900,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -941,23 +922,24 @@ if ($id > 0)
print '</table><br><br><table class="border" width="100%">'; print '</table><br><br><table class="border" width="100%">';
// Input by // Assigned to
$var=false; print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionAskedBy").'</td><td colspan="3">';
if ($act->author->id > 0) print $act->author->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';
// Affecte a
print '<tr><td nowrap="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
if ($act->usertodo->id > 0) print $act->usertodo->getNomUrl(1); if ($act->usertodo->id > 0) print $act->usertodo->getNomUrl(1);
print '</td></tr>'; print '</td></tr>';
// Done by // Busy
print '<tr><td nowrap="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">'; print '<tr><td nowrap="nowrap">'.$langs->trans("Busy").'</td><td colspan="3">';
if ($act->userdone->id > 0) print $act->userdone->getNomUrl(1); print yn(($act->transparency > 0)?1:0);
print '</td></tr>'; print '</td></tr>';
// Done by
if ($conf->global->AGENDA_ENABLE_DONEBY)
{
print '<tr><td nowrap="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
if ($act->userdone->id > 0) print $act->userdone->getNomUrl(1);
print '</td></tr>';
}
print '</table><br><br><table class="border" width="100%">'; print '</table><br><br><table class="border" width="100%">';
// Third party - Contact // Third party - Contact
@ -1058,31 +1040,31 @@ if ($id > 0)
if ($user->rights->agenda->allactions->create || if ($user->rights->agenda->allactions->create ||
(($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->create)) (($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->create))
{ {
print '<a class="butAction" href="fiche.php?action=edit&id='.$act->id.'">'.$langs->trans("Modify").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?action=edit&id='.$act->id.'">'.$langs->trans("Modify").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
} }
if ($user->rights->agenda->allactions->delete || if ($user->rights->agenda->allactions->delete ||
(($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete)) (($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete))
{ {
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$act->id.'">'.$langs->trans("Delete").'</a>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="fiche.php?action=delete&id='.$act->id.'">'.$langs->trans("Delete").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';
} }
} }
print '</div>'; print '</div>';
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
/** /**
* Ajoute une ligne de tableau a 2 colonnes pour avoir l'option synchro calendrier * Ajoute une ligne de tableau a 2 colonnes pour avoir l'option synchro calendrier

View File

@ -457,12 +457,12 @@ else
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;id='.$object->lines[$i]->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;id='.$object->lines[$i]->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>';
} }
if ($user->rights->societe->supprimer) if ($user->rights->societe->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;id='.$object->lines[$i]->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;id='.$object->lines[$i]->id.'&amp;action=delete">'.$langs->trans("Delete").'</a></div>';
} }
@ -487,7 +487,7 @@ else
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;action=create">'.$langs->trans("Add").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;action=create">'.$langs->trans("Add").'</a></div>';
} }
print '</div>'; print '</div>';
} }

View File

@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Propal"), 0, 'propal');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);
@ -121,7 +119,7 @@ dol_fiche_end();
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
print "</div>"; print "</div>";
} }

View File

@ -500,8 +500,8 @@ if ($id > 0)
while ($i < $num && $i < $MAXLIST) while ($i < $num && $i < $MAXLIST)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
print "<tr $bc[$var]>"; print "<tr ".$bc[$var].">";
print '<td nowrap><a href="propal.php?id='.$objp->propalid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.'</a>'."\n"; print '<td nowrap="nowrap"><a href="propal.php?id='.$objp->propalid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.'</a>'."\n";
if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 )
{ {
print " ".img_warning(); print " ".img_warning();
@ -751,7 +751,7 @@ if ($id > 0)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'; print '<td nowrap="nowrap">';
$facturestatic->id=$objp->facid; $facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->facnumber; $facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type; $facturestatic->type=$objp->type;
@ -795,25 +795,25 @@ if ($id > 0)
if (! empty($conf->propal->enabled) && $user->rights->propal->creer) if (! empty($conf->propal->enabled) && $user->rights->propal->creer)
{ {
$langs->load("propal"); $langs->load("propal");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>';
} }
if (! empty($conf->commande->enabled) && $user->rights->commande->creer) if (! empty($conf->commande->enabled) && $user->rights->commande->creer)
{ {
$langs->load("orders"); $langs->load("orders");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a></div>';
} }
if ($user->rights->contrat->creer) if ($user->rights->contrat->creer)
{ {
$langs->load("contracts"); $langs->load("contracts");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContract").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContract").'</a></div>';
} }
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer)
{ {
$langs->load("fichinter"); $langs->load("fichinter");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddIntervention").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddIntervention").'</a></div>';
} }
// Add invoice // Add invoice
@ -822,7 +822,7 @@ if ($id > 0)
if (! empty($conf->deplacement->enabled)) if (! empty($conf->deplacement->enabled))
{ {
$langs->load("trips"); $langs->load("trips");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a></div>';
} }
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
@ -834,17 +834,17 @@ if ($id > 0)
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
if($orders2invoice > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a>'; if($orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
else print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
} }
if ($object->client != 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>'; if ($object->client != 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
else print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
} }
} }
} }
@ -854,11 +854,11 @@ if ($id > 0)
{ {
if ($user->rights->agenda->myactions->create) if ($user->rights->agenda->myactions->create)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
} }
else else
{ {
print '<a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
} }
} }

View File

@ -88,16 +88,6 @@ llxHeader();
print_fiche_titre($langs->trans("CustomerArea")); print_fiche_titre($langs->trans("CustomerArea"));
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
/*
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr>';
if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
(! empty($conf->contrat->enabled) && $user->rights->contrat->lire) ||
(! empty($conf->commande->enabled) && $user->rights->commande->lire))
{
print '<td valign="top" width="30%" class="notopnoleft">';
}
*/
// Recherche Propal // Recherche Propal
if (! empty($conf->propal->enabled) && $user->rights->propal->lire) if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
@ -259,17 +249,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
} }
/*if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
(! empty($conf->contrat->enabled) && $user->rights->contrat->lire) ||
(! empty($conf->commande->enabled) && $user->rights->commande->lire))
{
print '</td>';
print '<td valign="top" width="70%" class="notopnoleftnoright">';
}
else
{
print '<td valign="top" width="100%" class="notopnoleftnoright">';
}*/
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
@ -545,8 +524,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
} }
//print '</td></tr></table>'; print '</div></div></div>';
print '<div></div></div>';
llxFooter(); llxFooter();

View File

@ -48,6 +48,9 @@ $result=$object->fetch($id);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('mailing');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('mailingcard')); $hookmanager->initHooks(array('mailingcard'));
@ -631,8 +634,6 @@ if (! empty($_POST["cancel"]))
* View * View
*/ */
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('mailing');
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing'; $help_url='EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing';
llxHeader('',$langs->trans("Mailing"),$help_url); llxHeader('',$langs->trans("Mailing"),$help_url);
@ -661,15 +662,7 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
} }
print '</table>'; print '</table>';
@ -823,15 +816,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields);
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
}
} }
print '</table>'; print '</table>';
@ -1072,15 +1057,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
}
} }
print '</table>'; print '</table>';

View File

@ -178,7 +178,7 @@ if ($result)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td nowrap="nowrap"><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEMail"),"email").' '.$obj->rowid.'</a></td>'; print '<td nowrap="nowrap"><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEMail"),"email").' '.$obj->rowid.'</a></td>';
print '<td>'.dol_trunc($obj->titre,38).'</td>'; print '<td>'.dol_trunc($obj->titre,38).'</td>';
print '<td align="center">'.dol_print_date($obj->date_creat,'day').'</td>'; print '<td align="center">'.dol_print_date($db->jdate($obj->date_creat),'day').'</td>';
print '<td align="center">'.($obj->nbemail?$obj->nbemail:"0").'</td>'; print '<td align="center">'.($obj->nbemail?$obj->nbemail:"0").'</td>';
$mailstatic=new Mailing($db); $mailstatic=new Mailing($db);
print '<td align="right">'.$mailstatic->LibStatut($obj->statut,5).'</td>'; print '<td align="right">'.$mailstatic->LibStatut($obj->statut,5).'</td>';
@ -201,7 +201,7 @@ else
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
if ($langs->file_exists("html/spam.html",0)) { if ($langs->file_exists("html/spam.html",0)) {

View File

@ -81,6 +81,9 @@ $result = restrictedArea($user, 'propal', $id);
$object = new Propal($db); $object = new Propal($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('propal');
// Load object // Load object
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
@ -338,14 +341,8 @@ else if ($action == 'add' && $user->rights->propal->creer)
} }
} }
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
{
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=GETPOST($key);
}
}
$id = $object->create($user); $id = $object->create($user);
} }
@ -1107,14 +1104,10 @@ else if ($action == 'down' && $user->rights->propal->creer)
} }
else if ($action == 'update_extras') else if ($action == 'update_extras')
{ {
// Get extra fields // Fill array 'array_options' with data from update form
foreach($_POST as $key => $value) $extralabels=$extrafields->fetch_name_optionals_label('propal');
{ $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=$_POST[$key];
}
}
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao')); $hookmanager->initHooks(array('propaldao'));
@ -1208,9 +1201,6 @@ $formfile = new FormFile($db);
$formpropal = new FormPropal($db); $formpropal = new FormPropal($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('propal');
$now=dol_now(); $now=dol_now();
// Add new proposal // Add new proposal
@ -1331,7 +1321,7 @@ if ($action == 'create')
print '<td>'.$langs->trans("DefaultModel").'</td>'; print '<td>'.$langs->trans("DefaultModel").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
$liste=ModelePDFPropales::liste_modeles($db); $liste=ModelePDFPropales::liste_modeles($db);
print $form->selectarray('model',$liste,$conf->global->PROPALE_ADDON_PDF); print $form->selectarray('model',$liste,($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT?$conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT:$conf->global->PROPALE_ADDON_PDF));
print "</td></tr>"; print "</td></tr>";
// Project // Project
@ -1357,24 +1347,7 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
// Show separator only
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
} }
print "</table>"; print "</table>";
@ -1859,7 +1832,7 @@ else
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
} }
// TODO : use showOptionals($extrafields) function
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
@ -1872,6 +1845,13 @@ else
print '<tr><td'; print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"'; if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">'; print '>'.$label.'</td><td colspan="3">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
}
if ($action == 'edit_extras' && $user->rights->propal->creer) if ($action == 'edit_extras' && $user->rights->propal->creer)
{ {
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
@ -2053,21 +2033,21 @@ else
// Validate // Validate
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider) if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider)
{ {
if (count($object->lines) > 0) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a>'; if (count($object->lines) > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a></div>';
//else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>'; //else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
} }
// Edit // Edit
if ($object->statut == 1 && $user->rights->propal->creer) if ($object->statut == 1 && $user->rights->propal->creer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a></div>';
} }
// ReOpen // ReOpen
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"';
print '>'.$langs->trans('ReOpen').'</a>'; print '>'.$langs->trans('ReOpen').'</a></div>';
} }
// Send // Send
@ -2075,9 +2055,9 @@ else
{ {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a></div>';
} }
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
} }
// Create an order // Create an order
@ -2085,7 +2065,7 @@ else
{ {
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a></div>';
} }
} }
@ -2096,7 +2076,7 @@ else
if ($user->rights->contrat->creer) if ($user->rights->contrat->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddContract').'</a></div>';
} }
} }
@ -2105,34 +2085,34 @@ else
{ {
if (! empty($conf->facture->enabled) && $user->rights->facture->creer) if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
} }
$arraypropal=$object->getInvoiceArrayList(); $arraypropal=$object->getInvoiceArrayList();
if (is_array($arraypropal) && count($arraypropal) > 0) if (is_array($arraypropal) && count($arraypropal) > 0)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled&amp;socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled&amp;socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a></div>';
} }
} }
// Close // Close
if ($object->statut == 1 && $user->rights->propal->cloturer) if ($object->statut == 1 && $user->rights->propal->cloturer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"';
print '>'.$langs->trans('Close').'</a>'; print '>'.$langs->trans('Close').'</a></div>';
} }
// Clone // Clone
if ($user->rights->propal->creer) if ($user->rights->propal->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object='.$object->element.'">'.$langs->trans("ToClone").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
} }
// Delete // Delete
if ($user->rights->propal->supprimer) if ($user->rights->propal->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete"'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete"';
print '>'.$langs->trans('Delete').'</a>'; print '>'.$langs->trans('Delete').'</a></div>';
} }
} }
@ -2185,7 +2165,7 @@ else
{ {
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
// Build document if it not exists // Build document if it not exists
@ -2208,7 +2188,7 @@ else
dol_print_error($db,$result); dol_print_error($db,$result);
exit; exit;
} }
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
} }

View File

@ -1199,7 +1199,6 @@ class Propal extends CommonObject
* Update value of extrafields on the proposal * Update value of extrafields on the proposal
* *
* @param User $user Object user that modify * @param User $user Object user that modify
* @param double $remise Amount discount
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
function update_extrafields($user) function update_extrafields($user)
@ -1635,6 +1634,20 @@ class Propal extends CommonObject
return -2; return -2;
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS))
{
$outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
@ -1646,6 +1659,21 @@ class Propal extends CommonObject
} }
else else
{ {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS))
{
$outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);

View File

@ -513,7 +513,7 @@ if (! empty($conf->propal->enabled))
*/ */
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -28,8 +28,8 @@ require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH=500; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=200; $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0; $userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0; $socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
@ -216,8 +216,9 @@ complete_head_from_modules($conf,$langs,null,$head,$h,'propal_stats');
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
print '<table class="notopnoleftnopadd" width="100%"><tr>';
print '<td align="center" valign="top">'; print '<div class="fichecenter"><div class="fichethirdleft">';
//if (empty($socid)) //if (empty($socid))
//{ //{
@ -282,8 +283,8 @@ foreach ($data as $val)
print '</table>'; print '</table>';
print '</td>'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<td align="center" valign="top">';
// Show graphs // Show graphs
print '<table class="border" width="100%"><tr valign="top"><td align="center">'; print '<table class="border" width="100%"><tr valign="top"><td align="center">';
@ -297,7 +298,10 @@ else {
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr></table>';
print '</div></div></div>';
print '<div style="clear:both"></div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -279,7 +279,7 @@ if ($resql)
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -242,8 +243,7 @@ if ($resql)
llxHeader('',$langs->trans("ThirdParty"),$help_url); llxHeader('',$langs->trans("ThirdParty"),$help_url);
} }
$param='&amp;stcomm='.$stcomm.'&amp;search_nom='.urlencode($search_nom).'&amp;search_zipcode='.urlencode($search_code).'&amp;search_town='.urlencode($search_town); $param='&amp;stcomm='.$stcomm.'&amp;search_nom='.urlencode($search_nom).'&amp;search_zipcode='.urlencode($search_zipcode).'&amp;search_ville='.urlencode($search_ville);
// Added by Matelli
// Store the status filter in the URL // Store the status filter in the URL
if (isSet($search_cstc)) if (isSet($search_cstc))
{ {

View File

@ -598,7 +598,7 @@ class Commande extends CommonOrder
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc,$hookmanager;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -761,6 +761,27 @@ class Commande extends CommonOrder
} }
} }
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
else if ($reshook < 0) $error++;
}
if (! $notrigger) if (! $notrigger)
{ {
// Appel des triggers // Appel des triggers
@ -2757,6 +2778,44 @@ class Commande extends CommonOrder
} }
} }
/**
* Update value of extrafields on the proposal
*
* @param User $user Object user that modify
* @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/
function update_extrafields($user)
{
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
else if ($reshook < 0) $error++;
if (!$error)
{
return 1;
}
else
{
return -1;
}
}
/** /**
* Return an array of order lines * Return an array of order lines
* *

File diff suppressed because it is too large Load Diff

View File

@ -425,7 +425,7 @@ if (! empty($conf->commande->enabled))
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH=500; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=200; $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$mode=GETPOST("mode")?GETPOST("mode"):'customer'; $mode=GETPOST("mode")?GETPOST("mode"):'customer';
if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden(); if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden();
@ -237,8 +237,9 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
print '<table class="notopnoleftnopadd" width="100%"><tr>';
print '<td align="center" valign="top">'; print '<div class="fichecenter"><div class="fichethirdleft">';
//if (empty($socid)) //if (empty($socid))
//{ //{
@ -305,8 +306,8 @@ foreach ($data as $val)
print '</table>'; print '</table>';
print '</td>'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<td align="center" valign="top">';
// Show graphs // Show graphs
print '<table class="border" width="100%"><tr valign="top"><td align="center">'; print '<table class="border" width="100%"><tr valign="top"><td align="center">';
@ -320,7 +321,9 @@ else {
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr></table>';
print '</div></div></div>';
print '<div style="clear:both"></div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -161,7 +161,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " ORDER BY dlr ASC"; $sql.= " ORDER BY dlr ASC";
// Supplier invoices // Supplier invoices
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.facnumber as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2.= " s.rowid as socid, s.nom, s.fournisseur"; $sql2.= " s.rowid as socid, s.nom, s.fournisseur";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";

View File

@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacementstats.class
$langs->load("trips"); $langs->load("trips");
$WIDTH=500; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=200; $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0; $userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0; $socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
@ -204,8 +204,9 @@ complete_head_from_modules($conf,$langs,null,$head,$h,'trip_stats');
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
print '<table class="notopnoleftnopadd" width="100%"><tr>';
print '<td align="center" valign="top">'; print '<div class="fichecenter"><div class="fichethirdleft">';
// Show filter box // Show filter box
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -266,8 +267,8 @@ foreach ($data as $val)
print '</table>'; print '</table>';
print '</td>'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<td align="center" valign="top">';
// Show graphs // Show graphs
print '<table class="border" width="100%"><tr valign="top"><td align="center">'; print '<table class="border" width="100%"><tr valign="top"><td align="center">';
@ -281,7 +282,10 @@ else {
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr></table>';
print '</div></div></div>';
print '<div style="clear:both"></div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -524,36 +524,36 @@ if (! empty($id) && $action != 'edit')
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="fiche.php?action=edit&rowid='.$don->id.'">'.$langs->trans('Modify').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?action=edit&rowid='.$don->id.'">'.$langs->trans('Modify').'</a></div>';
if ($don->statut == 0) if ($don->statut == 0)
{ {
print '<a class="butAction" href="fiche.php?rowid='.$don->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$don->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
} }
if (($don->statut == 0 || $don->statut == 1) && $resteapayer == 0 && $don->paye == 0) if (($don->statut == 0 || $don->statut == 1) && $resteapayer == 0 && $don->paye == 0)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$don->id&action=set_cancel\">".$langs->trans("ClassifyCanceled")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$don->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
} }
// TODO Gerer action emettre paiement // TODO Gerer action emettre paiement
if ($don->statut == 1 && $resteapayer > 0) if ($don->statut == 1 && $resteapayer > 0)
{ {
print "<a class=\"butAction\" href=\"paiement.php?facid=$facid&action=create\">".$langs->trans("DoPayment")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?rowid='.$don->id.'&action=create">'.$langs->trans("DoPayment")."</a></div>";
} }
if ($don->statut == 1 && $resteapayer == 0 && $don->paye == 0) if ($don->statut == 1 && $resteapayer == 0 && $don->paye == 0)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$don->id&action=set_paid\">".$langs->trans("ClassifyPaid")."</a>"; print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?rowid='.$don->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
} }
if ($user->rights->don->supprimer) if ($user->rights->don->supprimer)
{ {
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$don->id&action=delete\">".$langs->trans("Delete")."</a>"; print '<div class="inline-block divButAction"><a class="butActionDelete" href="fiche.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
} }
else else
{ {
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</a>"; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("Delete")."</a></div>";
} }
print "</div>"; print "</div>";

View File

@ -1746,14 +1746,10 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
if ($action == 'update_extras') if ($action == 'update_extras')
{ {
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $extralabels=$extrafields->fetch_name_optionals_label('facture');
{ $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=$_POST[$key];
}
}
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('invoicedao')); $hookmanager->initHooks(array('invoicedao'));
@ -1838,7 +1834,7 @@ if ($action == 'create')
$ref_client = (! empty($objectsrc->ref_client)?$objectsrc->ref_client:''); $ref_client = (! empty($objectsrc->ref_client)?$objectsrc->ref_client:'');
$ref_int = (! empty($objectsrc->ref_int)?$objectsrc->ref_int:''); $ref_int = (! empty($objectsrc->ref_int)?$objectsrc->ref_int:'');
$soc = $objectsrc->client; $soc = $objectsrc->thirdparty;
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
@ -1866,7 +1862,8 @@ if ($action == 'create')
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n"; if ($soc->id > 0)
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
print '<input name="facnumber" type="hidden" value="provisoire">'; print '<input name="facnumber" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">'; print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">'; print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
@ -1917,7 +1914,7 @@ if ($action == 'create')
// Tiers // Tiers
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>'; print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($socid>0) if($soc->id > 0)
{ {
print '<td colspan="2">'; print '<td colspan="2">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
@ -2109,23 +2106,7 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
// Show separator only
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
} }
// Modele PDF // Modele PDF
@ -3133,7 +3114,6 @@ else if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
} }
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
@ -3146,6 +3126,12 @@ else if ($id > 0 || ! empty($ref))
print '<tr><td'; print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"'; if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="5">'; print '>'.$label.'</td><td colspan="5">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
}
if ($action == 'edit_extras' && $user->rights->facture->creer) if ($action == 'edit_extras' && $user->rights->facture->creer)
{ {
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
@ -3265,16 +3251,16 @@ else if ($id > 0 || ! empty($ref))
{ {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a></div>';
} }
else else
{ {
print '<span class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Modify').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Modify').'</span></div>';
} }
} }
else else
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Modify').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Modify').'</span></div>';
} }
} }
} }
@ -3284,11 +3270,11 @@ else if ($id > 0 || ! empty($ref))
{ {
if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>';
} }
else else
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span></div>';
} }
} }
@ -3301,7 +3287,7 @@ else if ($id > 0 || ! empty($ref))
{ {
if ($user->rights->facture->valider) if ($user->rights->facture->valider)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=valid">'.$langs->trans('Validate').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=valid">'.$langs->trans('Validate').'</a></div>';
} }
} }
@ -3310,15 +3296,15 @@ else if ($id > 0 || ! empty($ref))
{ {
if ($objectidnext) if ($objectidnext)
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendByMail').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendByMail').'</span></div>';
} }
else else
{ {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a></div>';
} }
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
} }
} }
@ -3328,15 +3314,15 @@ else if ($id > 0 || ! empty($ref))
{ {
if ($objectidnext) if ($objectidnext)
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendRemindByMail').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendRemindByMail').'</span></div>';
} }
else else
{ {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=prerelance&amp;mode=init">'.$langs->trans('SendRemindByMail').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=prerelance&amp;mode=init">'.$langs->trans('SendRemindByMail').'</a></div>';
} }
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendRemindByMail').'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendRemindByMail').'</a></div>';
} }
} }
} }
@ -3346,17 +3332,17 @@ else if ($id > 0 || ! empty($ref))
{ {
if ($objectidnext) if ($objectidnext)
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</span></div>';
} }
else else
{ {
if ($resteapayer == 0) if ($resteapayer == 0)
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span></div>';
} }
else else
{ {
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create">'.$langs->trans('DoPayment').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create">'.$langs->trans('DoPayment').'</a></div>';
} }
} }
} }
@ -3367,17 +3353,17 @@ else if ($id > 0 || ! empty($ref))
// For credit note only // For credit note only
if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement)
{ {
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create">'.$langs->trans('DoPaymentBack').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create">'.$langs->trans('DoPaymentBack').'</a></div>';
} }
// For credit note // For credit note
if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->creer && $object->getSommePaiement() == 0) if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->creer && $object->getSommePaiement() == 0)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
} }
// For deposit invoice // For deposit invoice
if ($object->type == 3 && $object->statut == 1 && $resteapayer == 0 && $user->rights->facture->creer) if ($object->type == 3 && $object->statut == 1 && $resteapayer == 0 && $user->rights->facture->creer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
} }
} }
@ -3385,7 +3371,7 @@ else if ($id > 0 || ! empty($ref))
if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement &&
(($object->type != 2 && $object->type != 3 && $resteapayer <= 0) || ($object->type == 2 && $resteapayer >= 0)) ) (($object->type != 2 && $object->type != 3 && $resteapayer <= 0) || ($object->type == 2 && $resteapayer >= 0)) )
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaid').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaid').'</a></div>';
} }
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee) // Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
@ -3395,17 +3381,17 @@ else if ($id > 0 || ! empty($ref))
if ($totalpaye > 0 || $totalcreditnotes > 0) if ($totalpaye > 0 || $totalcreditnotes > 0)
{ {
// If one payment or one credit note was linked to this invoice // If one payment or one credit note was linked to this invoice
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a></div>';
} }
else else
{ {
if ($objectidnext) if ($objectidnext)
{ {
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ClassifyCanceled').'</span>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ClassifyCanceled').'</span></div>';
} }
else else
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=canceled">'.$langs->trans('ClassifyCanceled').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=canceled">'.$langs->trans('ClassifyCanceled').'</a></div>';
} }
} }
} }
@ -3413,7 +3399,7 @@ else if ($id > 0 || ! empty($ref))
// Clone // Clone
if (($object->type == 0 || $object->type == 3 || $object->type == 4) && $user->rights->facture->creer) if (($object->type == 0 || $object->type == 3 || $object->type == 4) && $user->rights->facture->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a></div>';
} }
// Clone as predefined // Clone as predefined
@ -3421,7 +3407,7 @@ else if ($id > 0 || ! empty($ref))
{ {
if (! $objectidnext) if (! $objectidnext)
{ {
print '<a class="butAction" href="facture/fiche-rec.php?facid='.$object->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid='.$object->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a></div>';
} }
} }
@ -3430,24 +3416,24 @@ else if ($id > 0 || ! empty($ref))
{ {
if (! $object->is_erasable()) if (! $object->is_erasable())
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a></div>';
} }
else if ($objectidnext) else if ($objectidnext)
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a></div>';
} }
elseif ($object->getSommePaiement()) elseif ($object->getSommePaiement())
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a></div>';
} }
else else
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a></div>';
} }
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a></div>';
} }
print '</div>'; print '</div>';
@ -3520,7 +3506,7 @@ else if ($id > 0 || ! empty($ref))
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
// Build document if it not exists // Build document if it not exists
@ -3543,7 +3529,7 @@ else if ($id > 0 || ! empty($ref))
dol_print_error($db,$result); dol_print_error($db,$result);
exit; exit;
} }
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
} }

View File

@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);

View File

@ -559,7 +559,6 @@ class Facture extends CommonInvoice
* Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
* *
* @param int $socid Id of thirdparty * @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($socid=0) function createFromClone($socid=0)
@ -2590,7 +2589,7 @@ class Facture extends CommonInvoice
/** /**
* Return if an invoice can be deleted * Return if an invoice can be deleted
* Rule is: * Rule is:
* If hidden option FACTURE_CAN_BE_REMOVED is on, we can * If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule * If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
* If invoice is draft and ha a temporary ref -> yes * If invoice is draft and ha a temporary ref -> yes
* *
@ -2600,7 +2599,8 @@ class Facture extends CommonInvoice
{ {
global $conf; global $conf;
if (! empty($conf->global->FACTURE_CAN_BE_REMOVED)) return 1; if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 1;
if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0;
// on verifie si la facture est en numerotation provisoire // on verifie si la facture est en numerotation provisoire
$facref = substr($this->ref, 1, 4); $facref = substr($this->ref, 1, 4);

View File

@ -27,8 +27,8 @@ require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$WIDTH=500; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=200; $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$mode=GETPOST("mode")?GETPOST("mode"):'customer'; $mode=GETPOST("mode")?GETPOST("mode"):'customer';
if ($mode == 'customer' && ! $user->rights->facture->lire) accessforbidden(); if ($mode == 'customer' && ! $user->rights->facture->lire) accessforbidden();
@ -214,8 +214,9 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
print '<table class="notopnoleftnopadd" width="100%"><tr>';
print '<td align="center" valign="top">'; print '<div class="fichecenter"><div class="fichethirdleft">';
//if (empty($socid)) //if (empty($socid))
//{ //{
@ -280,8 +281,8 @@ foreach ($data as $val)
print '</table>'; print '</table>';
print '</td>'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<td align="center" valign="top">';
// Show graphs // Show graphs
print '<table class="border" width="100%"><tr valign="top"><td align="center">'; print '<table class="border" width="100%"><tr valign="top"><td align="center">';
@ -295,7 +296,10 @@ else {
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr></table>';
print '</div></div></div>';
print '<div style="clear:both"></div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -121,9 +121,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '<table class="noborder nohover" width="100%">'; print '<table class="noborder nohover" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td colspan="3">'.$langs->trans("SearchACustomerInvoice").'</td></tr>'; print '<td colspan="3">'.$langs->trans("SearchACustomerInvoice").'</td></tr>';
print "<tr $bc[0]><td>".$langs->trans("Ref").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'; print "<tr ".$bc[0]."><td>".$langs->trans("Ref").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "<tr $bc[0]><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>'; print "<tr ".$bc[0]."><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
print '</tr>'; print '</tr>';
print "</table></form><br>"; print "</table></form><br>";
} }
@ -140,7 +140,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
print "<tr ".$bc[0].">"; print "<tr ".$bc[0].">";
print "<td>".$langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="18"></td>'; print "<td>".$langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "<tr $bc[0]><td>".$langs->trans("RefSupplier").':</td><td><input type="text" name="search_ref_supplier" class="flat" size="18"></td>'; print "<tr ".$bc[0]."><td>".$langs->trans("RefSupplier").':</td><td><input type="text" name="search_ref_supplier" class="flat" size="18"></td>';
print '</tr>'; print '</tr>';
print "</table></form><br>"; print "</table></form><br>";
} }
@ -258,7 +258,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
*/ */
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.type,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -287,7 +287,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td nowrap>'; print '<tr '.$bc[$var].'><td nowrap>';
$facturesupplierstatic->ref=$obj->facnumber; $facturesupplierstatic->ref=$obj->ref;
$facturesupplierstatic->id=$obj->rowid; $facturesupplierstatic->id=$obj->rowid;
$facturesupplierstatic->type=$obj->type; $facturesupplierstatic->type=$obj->type;
print $facturesupplierstatic->getNomUrl(1,'',16); print $facturesupplierstatic->getNomUrl(1,'',16);
@ -432,7 +432,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$langs->load("boxes"); $langs->load("boxes");
$facstatic=new FactureFournisseur($db); $facstatic=new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye"; $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye";
$sql.= ", s.nom, s.rowid as socid"; $sql.= ", s.nom, s.rowid as socid";
$sql.= ", SUM(pf.amount) as am"; $sql.= ", SUM(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
@ -442,7 +442,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql.= " AND ff.entity = ".$conf->entity; $sql.= " AND ff.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql.= " AND ff.fk_soc = ".$socid; if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid";
$sql.= " ORDER BY ff.tms DESC "; $sql.= " ORDER BY ff.tms DESC ";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -467,7 +467,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
$facstatic->ref=$obj->facnumber; $facstatic->ref=$obj->ref;
$facstatic->id=$obj->rowid; $facstatic->id=$obj->rowid;
print $facstatic->getNomUrl(1,''); print $facstatic->getNomUrl(1,'');
print '</td>'; print '</td>';
@ -930,7 +930,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{ {
$facstatic=new FactureFournisseur($db); $facstatic=new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom, s.rowid as socid,";
$sql.= " sum(pf.amount) as am"; $sql.= " sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
@ -942,7 +942,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql.= " AND ff.fk_statut = 1"; $sql.= " AND ff.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql.= " AND ff.fk_soc = ".$socid; if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid"; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -967,7 +967,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
$facstatic->ref=$obj->facnumber; $facstatic->ref=$obj->ref;
$facstatic->id=$obj->rowid; $facstatic->id=$obj->rowid;
print $facstatic->getNomUrl(1,''); print $facstatic->getNomUrl(1,'');
print '</td>'; print '</td>';
@ -1033,7 +1033,7 @@ if ($resql)
} }
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -97,9 +97,9 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,";
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,"; $sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
$sql.= " ct.accountancy_code_buy as account_tva"; $sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
@ -142,7 +142,8 @@ if ($result)
$tabfac[$obj->rowid]["lib"] = $obj->libelle; $tabfac[$obj->rowid]["lib"] = $obj->libelle;
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; if($obj->recuperableonly != 1)
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
$tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name); $tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name);
$i++; $i++;

View File

@ -99,12 +99,12 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
$sql.= " ct.accountancy_code_sell as account_tva"; $sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
@ -149,7 +149,8 @@ if ($result)
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0; if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0;
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; if($obj->recuperableonly != 1)
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
$tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client); $tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client);
$i++; $i++;
} }

View File

@ -102,9 +102,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
// Si module bank actif, un compte est obligatoire lors de la saisie // If bank module is on, account is required to enter a payment
// d'un paiement if (GETPOST('accountid') <= 0)
if (! $_POST['accountid'])
{ {
$fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>'; $fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
$error++; $error++;
@ -157,6 +156,16 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
} }
} }
if (! empty($conf->banque->enabled))
{
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
if (GETPOST('accountid') <= 0)
{
$fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
$error++;
}
}
// Creation of payment line // Creation of payment line
$paiement = new Paiement($db); $paiement = new Paiement($db);
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
@ -179,7 +188,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
{ {
$label='(CustomerInvoicePayment)'; $label='(CustomerInvoicePayment)';
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)'; if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
$result=$paiement->addPaymentToBank($user,'payment',$label,$_POST['accountid'],$_POST['chqemetteur'],$_POST['chqbank']); $result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank'));
if ($result < 0) if ($result < 0)
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;

View File

@ -146,7 +146,7 @@ else
//print "</td></tr></table>\n"; //print "</td></tr></table>\n";
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -366,7 +366,7 @@ class Paiement extends CommonObject
/** /**
* A record into bank for payment with links between this bank record and invoices of payment. * Add a record into bank for payment with links between this bank record and invoices of payment.
* All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create(). * All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
* *
* @param User $user Object of user making payment * @param User $user Object of user making payment
@ -384,16 +384,26 @@ class Paiement extends CommonObject
$error=0; $error=0;
$bank_line_id=0; $bank_line_id=0;
$this->fk_account=$accountid;
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; if ($accountid <= 0)
{
$this->error='Bad value for parameter accountid';
dol_syslog(get_class($this).'::addPaymentToBank '.$this->error, LOG_ERR);
return -1;
}
$this->db->begin();
$this->fk_account=$accountid;
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
dol_syslog("$user->id,$mode,$label,$this->fk_account,$emetteur_nom,$emetteur_banque"); dol_syslog("$user->id,$mode,$label,$this->fk_account,$emetteur_nom,$emetteur_banque");
$acc = new Account($this->db); $acc = new Account($this->db);
$acc->fetch($this->fk_account); $result=$acc->fetch($this->fk_account);
$totalamount=$this->amount; $totalamount=$this->amount;
if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility
@ -442,7 +452,7 @@ class Paiement extends CommonObject
} }
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if (! $error) if (! $error && $label != '(WithdrawalPayment)')
{ {
$linkaddedforthirdparty=array(); $linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of. foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
@ -497,10 +507,19 @@ class Paiement extends CommonObject
} }
} }
else else
{ {
$this->error=$acc->error; $this->error=$acc->error;
$error++; $error++;
} }
if (! $error)
{
$this->db->commit();
}
else
{
$this->db->rollback();
}
} }
if (! $error) if (! $error)

View File

@ -110,7 +110,7 @@ else
// Search criteria // Search criteria
if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int'); if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int');
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int'); if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
if (GETPOST("search_paymenttype") > 0) $sql .=" AND c.code='".GETPOST("search_paymenttype",'int')."'"; if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'";
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount")); if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
if (GETPOST("search_company")) $sql .=" AND s.nom LIKE '%".$db->escape(GETPOST("search_company"))."%'"; if (GETPOST("search_company")) $sql .=" AND s.nom LIKE '%".$db->escape(GETPOST("search_company"))."%'";
} }

View File

@ -61,8 +61,7 @@ if (prelevement_check_config() < 0)
print_fiche_titre($langs->trans("CustomersStandingOrdersArea")); print_fiche_titre($langs->trans("CustomersStandingOrdersArea"));
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
@ -87,7 +86,6 @@ print price($bprev->SommeAPrelever());
print '</td></tr></table><br>'; print '</td></tr></table><br>';
//print '</td><td valign="top" width="70%">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
@ -220,8 +218,7 @@ else
} }
//print '</td></tr></table>'; print '</div></div></div>';
print '<div></div></div>';
llxFooter(); llxFooter();

View File

@ -94,7 +94,7 @@ if ($resql)
print "</table>\n"; print "</table>\n";
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -62,7 +62,8 @@ class Contact extends CommonObject
var $email; var $email;
var $birthday; var $birthday;
var $default_lang; var $default_lang;
var $note; // Private note var $note_public; // Public note
var $note; // Private note
var $no_email; // 1=Don't send e-mail to this contact, 0=do var $no_email; // 1=Don't send e-mail to this contact, 0=do
var $ref_facturation; // Nb de reference facture pour lequel il est contact var $ref_facturation; // Nb de reference facture pour lequel il est contact
@ -74,7 +75,7 @@ class Contact extends CommonObject
var $user_login; var $user_login;
var $import_key; var $import_key;
var $oldcopy; // To contains a clone of this when we need to save old properties of object var $oldcopy; // To contains a clone of this when we need to save old properties of object
/** /**
@ -865,41 +866,6 @@ class Contact extends CommonObject
return $result; return $result;
} }
/**
* Return full address of contact
*
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @return string Full address string
*/
function getFullAddress($withcountry=0,$sep="\n")
{
$ret='';
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{
require_once DOL_DOCUMENT_ROOT .'/core/lib/company.lib.php';
$tmparray=getCountry($this->country_id,'all');
$this->country_code=$tmparray['code'];
$this->country =$tmparray['label'];
}
if (in_array($this->country_code,array('US')))
{
$ret.=($this->address?$this->address.$sep:'');
$ret.=trim($this->zip.' '.$this->town);
if ($withcountry) $ret.=($this->country?$sep.$this->country:'');
}
else
{
$ret.=($this->address?$this->address.$sep:'');
$ret.=trim($this->zip.' '.$this->town);
if ($withcountry) $ret.=($this->country?$sep.$this->country:'');
}
return trim($ret);
}
/** /**
* Return label of a civility contact * Return label of a civility contact
* *
@ -1028,13 +994,22 @@ class Contact extends CommonObject
$this->specimen=1; $this->specimen=1;
$this->lastname = 'DOLIBARR'; $this->lastname = 'DOLIBARR';
$this->firstname = 'SPECIMEN'; $this->firstname = 'SPECIMEN';
$this->address = '61 jump street'; $this->address = '21 jump street';
$this->zip = '75000'; $this->zip = '99999';
$this->town = 'Paris'; $this->town = 'MyTown';
$this->country_id = 1; $this->country_id = 1;
$this->country_code = 'FR'; $this->country_code = 'FR';
$this->country = 'France'; $this->country = 'France';
$this->email = 'specimen@specimen.com'; $this->email = 'specimen@specimen.com';
$this->phone_pro = '0909090901';
$this->phone_perso = '0909090902';
$this->phone_mobile = '0909090903';
$this->fax = '0909090909';
$this->note_public='This is a comment (public)';
$this->note='This is a comment (private)';
$socid = rand(1, $num_socs); $socid = rand(1, $num_socs);
$this->socid = $socids[$socid]; $this->socid = $socids[$socid];
} }

View File

@ -50,6 +50,9 @@ if ($user->societe_id) $socid=$user->societe_id;
$object = new Contact($db); $object = new Contact($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('contact');
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id); $object->getCanvas($id);
$objcanvas=null; $objcanvas=null;
@ -155,14 +158,8 @@ if (empty($reshook))
$object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]); $object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
$object->birthday_alert = $_POST["birthday_alert"]; $object->birthday_alert = $_POST["birthday_alert"];
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
{
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=GETPOST($key);
}
}
if (! $_POST["lastname"]) if (! $_POST["lastname"])
{ {
@ -252,14 +249,8 @@ if (empty($reshook))
$object->priv = $_POST["priv"]; $object->priv = $_POST["priv"];
$object->note = $_POST["note"]; $object->note = $_POST["note"];
// Get extra fields // Fill array 'array_options' with data from add form
foreach($_POST as $key => $value) $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
{
if (preg_match("/^options_/",$key))
{
$object->array_options[$key]=GETPOST($key);
}
}
$result = $object->update($_POST["contactid"], $user); $result = $object->update($_POST["contactid"], $user);
@ -283,8 +274,6 @@ if (empty($reshook))
* View * View
*/ */
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('contact');
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ContactsAddresses"),$help_url); llxHeader('',$langs->trans("ContactsAddresses"),$help_url);
@ -518,22 +507,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:''));
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
} }
print "</table><br>"; print "</table><br>";
@ -740,22 +714,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields,'edit');
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
}
}
} }
$object->load_ref_elements(); $object->load_ref_elements();
@ -959,20 +918,7 @@ else
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key=>$label) print $object->showOptionals($extrafields);
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}
}
} }
$object->load_ref_elements(); $object->load_ref_elements();

View File

@ -894,6 +894,8 @@ class Contrat extends CommonObject
* @param float $price_base_type HT or TTC * @param float $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC * @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT
* @return int <0 si erreur, >0 si ok * @return int <0 si erreur, >0 si ok
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
@ -1034,6 +1036,8 @@ class Contrat extends CommonObject
* @param timestamp $date_fin_reel Date de fin reelle * @param timestamp $date_fin_reel Date de fin reelle
* @param float $price_base_type HT or TTC * @param float $price_base_type HT or TTC
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)

View File

@ -1595,26 +1595,26 @@ else
if ($object->statut == 0 && $nbofservices) if ($object->statut == 0 && $nbofservices)
{ {
if ($user->rights->contrat->creer) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>'; if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a></div>';
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a></div>';
} }
if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
{ {
$langs->load("bills"); $langs->load("bills");
if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a>'; if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a></div>';
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a></div>';
} }
if ($object->nbofservicesclosed < $nbofservices) if ($object->nbofservicesclosed < $nbofservices)
{ {
//if (! $numactive) //if (! $numactive)
//{ //{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
//} //}
//else //else
//{ //{
// print '<a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a>'; // print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
//} //}
} }
@ -1623,11 +1623,11 @@ else
// - Droit de supprimer // - Droit de supprimer
if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer) if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>';
} }
print "</div>"; print "</div>";

View File

@ -604,7 +604,7 @@ else
//print '</td></tr></table>'; //print '</td></tr></table>';
print '<div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@ -41,7 +41,7 @@ if ($action == 'add')
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $mesg[]=$langs->trans("ErrorFieldRequired",$langs->trans("Type"));
$action = 'create'; $action = 'create';
} }
@ -49,23 +49,64 @@ if ($action == 'add')
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring);
$action = 'create'; $action = 'create';
} }
if (GETPOST('type')=='int' && $extrasize > $maxsizeint) if (GETPOST('type')=='int' && $extrasize > $maxsizeint)
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint);
$action = 'create'; $action = 'create';
} }
if (GETPOST('type')=='select' && !GETPOST('param')) if (GETPOST('type')=='select' && !GETPOST('param'))
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorNoValueForSelectType"); $mesg[]=$langs->trans("ErrorNoValueForSelectType");
$action = 'create'; $action = 'create';
} }
if (GETPOST('type')=='checkbox' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForCheckBoxType");
$action = 'create';
}
if (GETPOST('type')=='radio' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'create';
}
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
{
// Construct array for parameter (value of select list)
$parameters = GETPOST('param');
$parameters_array = explode("\r\n",$parameters);
foreach($parameters_array as $param_ligne)
{
if (!empty($param_ligne)) {
if (preg_match_all('/,/',$param_ligne,$matches))
{
if (count($matches[0])>1) {
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'create';
}
}
else
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'create';
}
}
}
}
if (! $error) if (! $error)
{ {
@ -84,6 +125,7 @@ if ($action == 'add')
$result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params);
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('SetupSaved'));
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -91,6 +133,7 @@ if ($action == 'add')
{ {
$error++; $error++;
$mesg=$extrafields->error; $mesg=$extrafields->error;
setEventMessage($mesg,'errors');
} }
} }
else else
@ -98,9 +141,14 @@ if ($action == 'add')
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
setEventMessage($mesg,'errors');
$action = 'create'; $action = 'create';
} }
} }
else
{
setEventMessage($mesg,'errors');
}
} }
} }
@ -114,23 +162,71 @@ if ($action == 'update')
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $mesg[]=$langs->trans("ErrorFieldRequired",$langs->trans("Type"));
$action = 'create'; $action = 'create';
} }
if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring) if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring)
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring);
$action = 'edit'; $action = 'edit';
} }
if (GETPOST('type')=='int' && $extrasize > $maxsizeint) if (GETPOST('type')=='int' && $extrasize > $maxsizeint)
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint);
$action = 'edit'; $action = 'edit';
} }
if (GETPOST('type')=='select' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForSelectType");
$action = 'edit';
}
if (GETPOST('type')=='checkbox' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForCheckBoxType");
$action = 'edit';
}
if (GETPOST('type')=='radio' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'edit';
}
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
{
// Construct array for parameter (value of select list)
$parameters = GETPOST('param');
$parameters_array = explode("\r\n",$parameters);
foreach($parameters_array as $param_ligne)
{
if (!empty($param_ligne)) {
if (preg_match_all('/,/',$param_ligne,$matches))
{
if (count($matches[0])>1) {
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'edit';
}
}
else
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'edit';
}
}
}
}
if (! $error) if (! $error)
{ {
@ -148,6 +244,7 @@ if ($action == 'update')
$result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params); $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params);
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('SetupSaved'));
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -155,6 +252,7 @@ if ($action == 'update')
{ {
$error++; $error++;
$mesg=$extrafields->error; $mesg=$extrafields->error;
setEventMessage($mesg,'errors');
} }
} }
else else
@ -162,8 +260,13 @@ if ($action == 'update')
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
setEventMessage($mesg,'errors');
} }
} }
else
{
setEventMessage($mesg,'errors');
}
} }
} }

View File

@ -101,7 +101,7 @@ class box_actions extends ModeleBoxes
'logo' => ("action"), 'logo' => ("action"),
'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id); 'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id);
$this->info_box_contents[$i][1] = array('td' => 'align="left" nowrap="1"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => dol_trunc($label,32), 'text' => dol_trunc($label,32),
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id); 'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id);

View File

@ -41,18 +41,9 @@ class box_activity extends ModeleBoxes
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/** // FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software.
* Constructor // FIXME: Removed number_format (not compatible with all languages)
*/ // FIXME: Pb into some status
function __construct($db)
{
$this->db = $db;
$this->enabled = 1;
// FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software.
// FIXME: Removed number_format (not compatible with all languages)
// FIXME: Pb into some status
}
/** /**
* Charge les donnees en memoire pour affichage ulterieur * Charge les donnees en memoire pour affichage ulterieur
@ -66,6 +57,7 @@ class box_activity extends ModeleBoxes
$totalMnt = 0; $totalMnt = 0;
$totalnb = 0; $totalnb = 0;
$i = 0;
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -99,7 +91,6 @@ class box_activity extends ModeleBoxes
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0;
while ($i < $num) while ($i < $num)
{ {
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill'); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill');
@ -140,7 +131,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result)+$i; $num = $db->num_rows($result) + $i;
$now=dol_now(); $now=dol_now();
while ($i < $num) while ($i < $num)
@ -195,7 +186,7 @@ class box_activity extends ModeleBoxes
if ($result) if ($result)
{ {
$num = $db->num_rows($result)+$i; $num = $db->num_rows($result) + $i;
while ($i < $num) while ($i < $num)
{ {
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_order'); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_order');
@ -246,7 +237,7 @@ class box_activity extends ModeleBoxes
if ($result) if ($result)
{ {
$num = $db->num_rows($result)+$i; $num = $db->num_rows($result) + $i;
while ($i < $num) while ($i < $num)
{ {
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_propal'); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_propal');

View File

@ -45,7 +45,9 @@ class box_comptes extends ModeleBoxes
/** /**
* Constructor * Constructor
*
* @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -64,7 +64,7 @@ class box_factures_fourn extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.rowid as facid, f.facnumber, f.amount,"; $sql.= " f.rowid as facid, f.ref_supplier, f.amount,";
$sql.= " f.paye, f.fk_statut,"; $sql.= " f.paye, f.fk_statut,";
$sql.= ' f.datef as df,'; $sql.= ' f.datef as df,';
$sql.= ' f.datec as datec,'; $sql.= ' f.datec as datec,';
@ -86,7 +86,7 @@ class box_factures_fourn extends ModeleBoxes
$now=dol_now(); $now=dol_now();
$i = 0; $i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; $l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
while ($i < $num) while ($i < $num)
{ {
@ -95,14 +95,14 @@ class box_factures_fourn extends ModeleBoxes
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
$late = ''; $late = '';
if ($objp->paye == 0 && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day'))); if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->ref_supplier,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);

View File

@ -61,7 +61,7 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.rowid as facid, f.facnumber, f.date_lim_reglement as datelimite,"; $sql.= " f.rowid as facid, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,"; $sql.= " f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.type"; $sql.= " f.paye, f.fk_statut, f.type";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -73,7 +73,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql.= " AND fk_statut = 1"; $sql.= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " ORDER BY datelimite DESC, f.facnumber DESC "; $sql.= " ORDER BY datelimite DESC, f.ref_supplier DESC ";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
@ -98,7 +98,7 @@ class box_factures_fourn_imp extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->ref_supplier,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);

View File

@ -45,7 +45,9 @@ class box_members extends ModeleBoxes
/** /**
* Constructor * Constructor
*
* @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {

View File

@ -164,7 +164,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
{ {
print '</td><td class="nocellnopadd boxclose" nowrap="nowrap">'; print '</td><td class="nocellnopadd boxclose" nowrap="nowrap">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle" style="cursor:move;"'); print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle hideonsmartphone" style="cursor:move;"');
print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
print '</td></tr></table>'; print '</td></tr></table>';
} }

View File

@ -51,7 +51,14 @@ abstract class CommonDocGenerator
'myuser_firstname'=>$user->firstname, 'myuser_firstname'=>$user->firstname,
'myuser_login'=>$user->login, 'myuser_login'=>$user->login,
'myuser_phone'=>$user->office_phone, 'myuser_phone'=>$user->office_phone,
'myuser_fax'=>$user->office_fax, 'myuser_address'=>$user->address,
'myuser_zip'=>$user->zip,
'myuser_town'=>$user->town,
'myuser_country'=>$user->country,
'myuser_country_code'=>$user->country_code,
'myuser_state'=>$user->state,
'myuser_state_code'=>$user->state_code,
'myuser_fax'=>$user->office_fax,
'myuser_mobile'=>$user->user_mobile, 'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->email, 'myuser_email'=>$user->email,
'myuser_web'=>'' // url not exist in $user object 'myuser_web'=>'' // url not exist in $user object
@ -190,6 +197,28 @@ abstract class CommonDocGenerator
} }
/**
* Define array with couple subtitution key => subtitution value
*
* @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code
*/
function get_substitutionarray_other($outputlangs)
{
global $conf;
$now=dol_now('gmt'); // gmt
$array_other = array(
'current_date'=>dol_print_date($now,'day','tzuser'),
'current_datehour'=>dol_print_date($now,'dayhour','tzuser'),
'current_server_date'=>dol_print_date($now,'day','tzserver'),
'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'),
);
return $array_other;
}
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *

View File

@ -78,6 +78,26 @@ abstract class CommonObject
return dol_trunc($ret,$maxlen); return dol_trunc($ret,$maxlen);
} }
/**
* Return full address of contact
*
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @return string Full address string
*/
function getFullAddress($withcountry=0,$sep="\n")
{
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{
require_once DOL_DOCUMENT_ROOT .'/core/lib/company.lib.php';
$tmparray=getCountry($this->country_id,'all');
$this->country_code=$tmparray['code'];
$this->country =$tmparray['label'];
}
return dol_format_address($this, $withcountry, $sep);
}
/** /**
* Check if ref is used. * Check if ref is used.
* *
@ -2132,15 +2152,19 @@ abstract class CommonObject
case 'price': case 'price':
$this->array_options[$key] = price2num($this->array_options[$key]); $this->array_options[$key] = price2num($this->array_options[$key]);
break; break;
case 'date':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break;
case 'datetime':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break;
} }
} }
$this->db->begin(); $this->db->begin();
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del); dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del);
$this->db->query($sql_del); $this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
foreach($this->array_options as $key => $value) foreach($this->array_options as $key => $value)
{ {
@ -2186,6 +2210,76 @@ abstract class CommonObject
else return 0; else return 0;
} }
/**
* Function to show lines of extrafields with output datas
*
* @param object $extrafields extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
*
* @return string
*/
function showOptionals($extrafields,$mode='view')
{
global $_POST;
$out = '';
if(count($extrafields->attribute_label) > 0)
{
$out .= "\n";
$out .= '<!-- showOptionalsInput --> ';
$out .= "\n";
$e = 0;
foreach($extrafields->attribute_label as $key=>$label)
{
$colspan='3';
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]);
if ($extrafields->attribute_type[$key] == 'separate')
{
$out .= $extrafields->showSeparator($key);
}
else
{
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
$out .= '<tr>';
$colspan='0';
}
else
{
$out .= '<tr>';
}
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->array_options['options_'.$key];
}
$out .= '<td>'.$label.'</td>';
$out .='<td colspan="'.$colspan.'">';
switch($mode) {
case "view":
$out .= $extrafields->showOutputField($key,$value);
break;
case "edit":
$out .= $extrafields->showInputField($key,$value);
break;
}
$out .= '</td>'."\n";
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
else $out .= '</tr>';
$e++;
}
}
$out .= "\n";
$out .= '<!-- /showOptionalsInput --> ';
}
return $out;
}
/** /**
* Function to check if an object is used by others * Function to check if an object is used by others

View File

@ -47,9 +47,8 @@ class Conf
//! Used to store current css (from theme) //! Used to store current css (from theme)
public $theme; // Contains current theme ("eldy", "auguria", ...) public $theme; // Contains current theme ("eldy", "auguria", ...)
public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
//! Used to store current menu handlers //! Used to store current menu handler
public $standard_menu; public $standard_menu;
public $smart_menu;
public $modules = array(); // List of activated modules public $modules = array(); // List of activated modules
public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array()); public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array());
@ -64,6 +63,11 @@ class Conf
//! Used to store list of entities to use for each element //! Used to store list of entities to use for each element
public $entities = array(); public $entities = array();
public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url
public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url
public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone
public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url
/** /**

View File

@ -65,7 +65,7 @@ class DolEditor
{ {
global $conf,$langs; global $conf,$langs;
dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." toolbarname=".$toolbarname); dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname);
if (! $rows) $rows=round($height/20); if (! $rows) $rows=round($height/20);
if (! $cols) $cols=($width?round($width/6):80); if (! $cols) $cols=($width?round($width/6):80);
@ -77,10 +77,8 @@ class DolEditor
$this->uselocalbrowser=$uselocalbrowser; $this->uselocalbrowser=$uselocalbrowser;
// Check if extended editor is ok. If not we force textarea // Check if extended editor is ok. If not we force textarea
if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea';
{ if ($conf->browser->phone) $this->tool = 'textarea';
$this->tool = 'textarea';
}
// Define content and some properties // Define content and some properties
if ($this->tool == 'ckeditor') if ($this->tool == 'ckeditor')

View File

@ -785,7 +785,7 @@ class DolGraph
$this->_stringtoshow ='<!-- Build using '.$this->_library.' -->'."\n"; $this->_stringtoshow ='<!-- Build using '.$this->_library.' -->'."\n";
$this->_stringtoshow.='<br><div align="center">'.$this->title.'</div><br>'; $this->_stringtoshow.='<br><div align="center">'.$this->title.'</div><br>';
$this->_stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;"></div>'."\n"; $this->_stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph"></div>'."\n";
$this->_stringtoshow.='<script id="'.$tag.'">'."\n"; $this->_stringtoshow.='<script id="'.$tag.'">'."\n";
$this->_stringtoshow.='$(function () {'."\n"; $this->_stringtoshow.='$(function () {'."\n";
$i=$firstlot; $i=$firstlot;
@ -893,6 +893,21 @@ class DolGraph
{ {
return $this->_stringtoshow; return $this->_stringtoshow;
} }
/**
* getDefaultGraphSizeForStats
*
* @param string $direction 'width' or 'height'
* @return int Value of width or height to use by default
*/
static function getDefaultGraphSizeForStats($direction)
{
global $conf;
if ($direction == 'width') return ($conf->dol_optimize_smallscreen?'400':'500');
if ($direction == 'height') return ($conf->dol_optimize_smallscreen?'160':'200');
return 0;
}
} }
?> ?>

View File

@ -42,6 +42,9 @@ class dolprintIPP
* @param DoliDB $db database * @param DoliDB $db database
* @param string $host host of Cups * @param string $host host of Cups
* @param string $port port * @param string $port port
* @param string $userid userid
* @param string $user user
* @param string $password password
* @return printIPP * @return printIPP
*/ */
function __construct($db,$host,$port,$userid,$user,$password) function __construct($db,$host,$port,$userid,$user,$password)
@ -77,6 +80,10 @@ class dolprintIPP
/** /**
* Print selected file * Print selected file
* *
* @param string $file file
* @param string $module module
*
* @return void
*/ */
function print_file($file,$module) function print_file($file,$module)
{ {
@ -113,6 +120,9 @@ class dolprintIPP
/** /**
* List jobs print * List jobs print
* *
* @param string $module module
*
* @return void
*/ */
function list_jobs($module) function list_jobs($module)
{ {

View File

@ -64,7 +64,9 @@ class ExtraFields
'phone'=>'ExtrafieldPhone', 'phone'=>'ExtrafieldPhone',
'mail'=>'ExtrafieldMail', 'mail'=>'ExtrafieldMail',
'select' => 'ExtrafieldSelect', 'select' => 'ExtrafieldSelect',
'separate' => 'ExtrafieldSeparator' 'separate' => 'ExtrafieldSeparator',
'checkbox' => 'ExtrafieldCheckBox',
'radio' => 'ExtrafieldRadio',
); );
/** /**
@ -95,6 +97,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'company', ...) * @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not * @param int $unique Is field unique or not
* @param int $required Is field required or not * @param int $required Is field required or not
* @param string $default_value Defaulted value
* @param array $param Params for field * @param array $param Params for field
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
@ -166,7 +169,7 @@ class ExtraFields
}elseif($type=='mail') { }elseif($type=='mail') {
$typedb='varchar'; $typedb='varchar';
$lengthdb='128'; $lengthdb='128';
} elseif ($type=='select') { } elseif (($type=='select') || ($type=='radio') ||($type=='checkbox')){
$typedb='text'; $typedb='text';
$lengthdb=''; $lengthdb='';
} else { } else {
@ -217,7 +220,7 @@ class ExtraFields
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0,$param) private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='')
{ {
global $conf; global $conf;
@ -354,7 +357,7 @@ class ExtraFields
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @return int >0 if OK, <=0 if KO * @return int >0 if OK, <=0 if KO
*/ */
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos,$param='') function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='')
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
// Special case for not normalized table names // Special case for not normalized table names
@ -376,7 +379,7 @@ class ExtraFields
}elseif($type=='mail') { }elseif($type=='mail') {
$typedb='varchar'; $typedb='varchar';
$lengthdb='128'; $lengthdb='128';
} elseif ($type=='select') { } elseif (($type=='select') || ($type=='radio') ||($type=='checkbox')) {
$typedb='text'; $typedb='text';
$lengthdb=''; $lengthdb='';
} else { } else {
@ -582,7 +585,7 @@ 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 $key Key of attribute
* @param string $value Value to show * @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 $moreparam To add more parametes on html input tag
* @return void * @return void
*/ */
@ -619,7 +622,13 @@ class ExtraFields
{ {
$tmp=explode(',',$size); $tmp=explode(',',$size);
$newsize=$tmp[0]; $newsize=$tmp[0];
$out='<input type="text" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>'; if(!class_exists('Form'))
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$formstat = new Form($db);
$showtime = in_array($type,array('datetime')) ? 1 : 0;
$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:'').'>';
} }
elseif (in_array($type,array('int','double'))) elseif (in_array($type,array('int','double')))
{ {
@ -670,9 +679,41 @@ class ExtraFields
} }
$out.='</select>'; $out.='</select>';
} }
// Add comments elseif ($type == 'checkbox')
{
$out='';
$value_arr=explode(',',$value);
foreach ($param['options'] as $keyopt=>$val )
{
$out.='<input type="checkbox" name="options_'.$key.'[]"';
$out.=' value="'.$keyopt.'"';
if ((is_array($value_arr)) && in_array($keyopt,$value_arr)) {
$out.= 'checked="checked"';
}else {
$out.='';
}
$out.='/>'.$val.'<br>';
}
}
elseif ($type == 'radio')
{
$out='';
foreach ($param['options'] as $keyopt=>$val )
{
$out.='<input type="radio" name="options_'.$key.'"';
$out.=' value="'.$keyopt.'"';
$out.= ($value==$keyopt?'checked="checked"':'');
$out.='/>'.$val.'<br>';
}
}
/* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)'; if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
*/
return $out; return $out;
} }
@ -698,10 +739,12 @@ class ExtraFields
if ($type == 'date') if ($type == 'date')
{ {
$showsize=10; $showsize=10;
$value=dol_print_date($value,'day');
} }
elseif ($type == 'datetime') elseif ($type == 'datetime')
{ {
$showsize=19; $showsize=19;
$value=dol_print_date($value,'dayhour');
} }
elseif ($type == 'int') elseif ($type == 'int')
{ {
@ -731,6 +774,21 @@ class ExtraFields
{ {
$value=$params['options'][$value]; $value=$params['options'][$value];
} }
elseif ($type == 'radio')
{
$value=$params['options'][$value];
}
elseif ($type == 'checkbox')
{
$value_arr=explode(',',$value);
$value='';
if (is_array($value_arr))
{
foreach ($value_arr as $keyval=>$valueval) {
$value.=$params['options'][$valueval].'<br>';
}
}
}
else else
{ {
$showsize=round($size); $showsize=round($size);
@ -752,5 +810,47 @@ class ExtraFields
$out = '<tr class="liste_titre"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>'; $out = '<tr class="liste_titre"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
return $out; return $out;
} }
/**
* Fill array_options array for object by extrafields value (using for data send by forms)
*
* @param array $extralabels $array of extrafields
* @param object &$object object
* @return int 1 if array_options set / 0 if no value
*/
function setOptionalsFromPost($extralabels,&$object)
{
global $_POST;
if (is_array($extralabels))
{
// Get extra fields
foreach ($extralabels as $key => $value)
{
$key_type = $this->attribute_type[$key];
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"]);
}
else if (in_array($key_type,array('checkbox')))
{
$value_arr=GETPOST("options_".$key);
$value_key=implode($value_arr,',');
}
else
{
$value_key=GETPOST("options_".$key);
}
$object->array_options["options_".$key]=$value_key;
}
return 1;
}
else {
return 0;
}
}
} }
?> ?>

View File

@ -436,7 +436,7 @@ class FileUpload
{ {
file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND); file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
} else { } else {
dol_move_uploaded_file($uploaded_file, $file_path, 1); dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile');
} }
} }
else else

View File

@ -131,7 +131,7 @@ class HookManager
// Define type of hook ('output', 'returnvalue' or 'addreplace') // Define type of hook ('output', 'returnvalue' or 'addreplace')
$hooktype='output'; $hooktype='output';
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
if ($method == 'doActions' || $method == 'formObjectOptions' || $method == 'pdf_writelinedesc') $hooktype='addreplace'; if (in_array($method,array('doActions','formObjectOptions','pdf_writelinedesc','paymentsupplierinvoices'))) $hooktype='addreplace';
// Loop on each hook to qualify modules that declared context // Loop on each hook to qualify modules that declared context
$modulealreadyexecuted=array(); $modulealreadyexecuted=array();
@ -150,7 +150,7 @@ class HookManager
// test to avoid to run twice a hook, when a module implements several active contexts // test to avoid to run twice a hook, when a module implements several active contexts
if (in_array($module,$modulealreadyexecuted)) continue; if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$module]=$module; $modulealreadyexecuted[$module]=$module;
// Hooks that return int // Hooks that return int (doActions, formObjectOptions, pdf_writelinedesc, paymentsupplierinvoices)
if ($hooktype == 'addreplace') if ($hooktype == 'addreplace')
{ {
$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) $resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
@ -159,7 +159,7 @@ class HookManager
$error++; $error++;
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors); $this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
// TODO remove this. Change must be inside the method if required // TODO remove this. Change must be inside the method of hook if required
if ($method == 'doActions') if ($method == 'doActions')
{ {
if ($action=='add') $action='create'; if ($action=='add') $action='create';
@ -170,7 +170,7 @@ class HookManager
// Generic hooks that return a string (printSearchForm, printLeftBlock, printTopRightMenu, formAddObjectLine, formBuilddocOptions, ...) // Generic hooks that return a string (printSearchForm, printLeftBlock, printTopRightMenu, formAddObjectLine, formBuilddocOptions, ...)
else else
{ {
// TODO. this should be done into the method by returning nothing // TODO. this should be done into the method of hook by returning nothing
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
$result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) $result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)

View File

@ -422,8 +422,9 @@ class Form
$htmltext = ''; $htmltext = '';
} }
} }
// If info or help with smartphone, show only text
if (! empty($conf->browser->phone)) // If info or help with smartphone, show only text (tooltip can't works)
if (! empty($conf->dol_no_mouse_hover))
{ {
if ($type == 'info' || $type == 'help') return $text; if ($type == 'info' || $type == 'help') return $text;
} }
@ -3320,8 +3321,12 @@ class Form
if ($d) if ($d)
{ {
$usecalendar='combo';
if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) $usecalendar=empty($conf->global->MAIN_POPUP_CALENDAR)?'eldy':$conf->global->MAIN_POPUP_CALENDAR;
if ($conf->browser->phone) $usecalendar='combo';
// Show date with popup // Show date with popup
if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) if ($usecalendar != 'combo')
{ {
$formated_date=''; $formated_date='';
//print "e".$set_time." t ".$conf->format_date_short; //print "e".$set_time." t ".$conf->format_date_short;
@ -3332,7 +3337,7 @@ class Form
} }
// Calendrier popup version eldy // Calendrier popup version eldy
if (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR == "eldy") if ($usecalendar == "eldy")
{ {
// Zone de saisie manuelle de la date // Zone de saisie manuelle de la date
$retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"'; $retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"';
@ -3354,14 +3359,13 @@ class Form
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; $retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";
} }
else else
{ {
print "Bad value of calendar"; print "Bad value of MAIN_POPUP_CALENDAR";
} }
} }
// Show date with combo selects // Show date with combo selects
if (empty($conf->use_javascript_ajax) || $conf->global->MAIN_POPUP_CALENDAR == "none") else
{ {
// Day // Day
$retstring.='<select'.($disabled?' disabled="disabled"':'').' class="flat" name="'.$prefix.'day">'; $retstring.='<select'.($disabled?' disabled="disabled"':'').' class="flat" name="'.$prefix.'day">';
@ -3372,15 +3376,7 @@ class Form
for ($day = 1 ; $day <= 31; $day++) for ($day = 1 ; $day <= 31; $day++)
{ {
if ($day == $sday) $retstring.='<option value="'.$day.'"'.($day == $sday ? ' selected="selected"':'').'>'.$day.'</option>';
{
$retstring.="<option value=\"$day\" selected=\"selected\">$day";
}
else
{
$retstring.="<option value=\"$day\">$day";
}
$retstring.="</option>";
} }
$retstring.="</select>"; $retstring.="</select>";
@ -3411,15 +3407,7 @@ class Form
for ($year = $syear - 5; $year < $syear + 10 ; $year++) for ($year = $syear - 5; $year < $syear + 10 ; $year++)
{ {
if ($year == $syear) $retstring.='<option value="'.$year.'"'.($year == $syear ? ' selected="true"':'').'>'.$year.'</option>';
{
$retstring.="<option value=\"$year\" selected=\"true\">".$year;
}
else
{
$retstring.="<option value=\"$year\">".$year;
}
$retstring.="</option>";
} }
$retstring.="</select>\n"; $retstring.="</select>\n";
} }
@ -3435,21 +3423,11 @@ class Form
if ($empty) $retstring.='<option value="-1">&nbsp;</option>'; if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
for ($hour = 0; $hour < 24; $hour++) for ($hour = 0; $hour < 24; $hour++)
{ {
if (dol_strlen($hour) < 2) if (strlen($hour) < 2) $hour = "0" . $hour;
{ $retstring.='<option value="'.$hour.'"'.(($hour == $shour)?' selected="true"':'').'>'.$hour.(empty($conf->dol_optimize_smallscreen)?'':'H').'</option>';
$hour = "0" . $hour;
}
if ($hour == $shour)
{
$retstring.="<option value=\"$hour\" selected=\"true\">$hour</option>";
}
else
{
$retstring.="<option value=\"$hour\">$hour</option>";
}
} }
$retstring.="</select>"; $retstring.='</select>';
$retstring.="H\n"; if (empty($conf->dol_optimize_smallscreen)) $retstring.=":";
} }
if ($m) if ($m)
@ -3459,21 +3437,10 @@ class Form
if ($empty) $retstring.='<option value="-1">&nbsp;</option>'; if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
for ($min = 0; $min < 60 ; $min++) for ($min = 0; $min < 60 ; $min++)
{ {
if (dol_strlen($min) < 2) if (strlen($min) < 2) $min = "0" . $min;
{ $retstring.='<option value="'.$min.'"'.(($min == $smin)?' selected="true"':'').'>'.$min.(empty($conf->dol_optimize_smallscreen)?'':'').'</option>';
$min = "0" . $min;
}
if ($min == $smin)
{
$retstring.="<option value=\"$min\" selected=\"true\">$min</option>";
}
else
{
$retstring.="<option value=\"$min\">$min</option>";
}
} }
$retstring.="</select>"; $retstring.='</select>';
$retstring.="M\n";
} }
// Add a "Now" button // Add a "Now" button
@ -3511,7 +3478,7 @@ class Form
// If reset_scripts is not empty, print the button with the reset_scripts in OnClick // If reset_scripts is not empty, print the button with the reset_scripts in OnClick
if ($reset_scripts) if ($reset_scripts)
{ {
$retstring.='<button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="Now" onClick="'.$reset_scripts.'">'; $retstring.=' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="Now" onClick="'.$reset_scripts.'">';
$retstring.=$langs->trans("Now"); $retstring.=$langs->trans("Now");
$retstring.='</button> '; $retstring.='</button> ';
} }

View File

@ -66,7 +66,9 @@ class FormFile
{ {
global $conf,$langs; global $conf,$langs;
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) if (! empty($conf->browser->phone)) return 0;
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax)
{ {
return $this->_formAjaxFileUpload($object); return $this->_formAjaxFileUpload($object);
} }

View File

@ -211,9 +211,10 @@ class FormOther
/** /**
* Return list of revenue stamp for country * Return list of revenue stamp for country
* *
* @param string $selected Value of preselected revenue stamp * @param string $selected Value of preselected revenue stamp
* @param string $htmlname Name of combo list * @param string $htmlname Name of combo list
* @return string HTML select list * @param string $country_code Country Code
* @return string HTML select list
*/ */
function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='') function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='')
{ {

View File

@ -512,6 +512,7 @@ class Menubase
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)"; if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)"; if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
$sql.= " ORDER BY m.position, m.rowid"; $sql.= " ORDER BY m.position, m.rowid";
//print $sql;
//$tmp1=dol_microtime_float(); //$tmp1=dol_microtime_float();
//print '>>> 1 0<br>'; //print '>>> 1 0<br>';
@ -533,17 +534,21 @@ class Menubase
$perms = true; $perms = true;
if ($menu['perms']) if ($menu['perms'])
{ {
$perms = verifCond($menu['perms']); $tmpcond=$menu['perms'];
//print "verifCond rowid=".$menu['rowid']." ".$menu['perms'].":".$perms."<br>\n"; if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
$perms = verifCond($tmpcond);
//print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
} }
// Define $enabled // Define $enabled
$enabled = true; $enabled = true;
if ($menu['enabled']) if ($menu['enabled'])
{ {
$enabled = verifCond($menu['enabled']); $tmpcond=$menu['enabled'];
if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
$enabled = verifCond($tmpcond);
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1; if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1;
//print "verifCond rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n"; //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$enabled."<br>\n";
} }
// Define $title // Define $title

View File

@ -694,6 +694,7 @@ class Translate
/** /**
* Return a currency code into its symbol * Return a currency code into its symbol
* *
* @param string $currency_code Currency Code
* @param string $amount If not '', show currency + amount according to langs ($10, 10€). * @param string $amount If not '', show currency + amount according to langs ($10, 10€).
* @return string Amount + Currency symbol encoded into UTF8 * @return string Amount + Currency symbol encoded into UTF8
*/ */

View File

@ -886,21 +886,23 @@ class DoliDBMysql
$sqlfields[$i] = $field_name." "; $sqlfields[$i] = $field_name." ";
$sqlfields[$i] .= $field_desc['type']; $sqlfields[$i] .= $field_desc['type'];
if( preg_match("/^[^\s]/i",$field_desc['value'])) if( preg_match("/^[^\s]/i",$field_desc['value']))
$sqlfields[$i] .= "(".$field_desc['value'].")"; $sqlfields[$i] .= "(".$field_desc['value'].")";
else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) if( preg_match("/^[^\s]/i",$field_desc['attribute']))
$sqlfields[$i] .= " ".$field_desc['attribute']; $sqlfields[$i] .= " ".$field_desc['attribute'];
else if( preg_match("/^[^\s]/i",$field_desc['default'])) if( preg_match("/^[^\s]/i",$field_desc['default']))
{ {
if(preg_match("/null/i",$field_desc['default'])) if(preg_match("/null/i",$field_desc['default']))
$sqlfields[$i] .= " default ".$field_desc['default']; $sqlfields[$i] .= " default ".$field_desc['default'];
elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP')
$sqlfields[$i] .= " default ".$field_desc['default'];
else else
$sqlfields[$i] .= " default '".$field_desc['default']."'"; $sqlfields[$i] .= " default '".$field_desc['default']."'";
} }
else if( preg_match("/^[^\s]/i",$field_desc['null'])) if( preg_match("/^[^\s]/i",$field_desc['null']))
$sqlfields[$i] .= " ".$field_desc['null']; $sqlfields[$i] .= " ".$field_desc['null'];
else if( preg_match("/^[^\s]/i",$field_desc['extra'])) if( preg_match("/^[^\s]/i",$field_desc['extra']))
$sqlfields[$i] .= " ".$field_desc['extra']; $sqlfields[$i] .= " ".$field_desc['extra'];
$i++; $i++;
} }
if($primary_key != "") if($primary_key != "")
@ -931,7 +933,7 @@ class DoliDBMysql
$sql .= ",".implode(',',$sqluq); $sql .= ",".implode(',',$sqluq);
if($keys != "") if($keys != "")
$sql .= ",".implode(',',$sqlk); $sql .= ",".implode(',',$sqlk);
$sql .=") type=".$type; $sql .=") engine=".$type;
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);
if(! $this -> query($sql)) if(! $this -> query($sql))

View File

@ -879,22 +879,27 @@ class DoliDBMysqli
{ {
$sqlfields[$i] = $field_name." "; $sqlfields[$i] = $field_name." ";
$sqlfields[$i] .= $field_desc['type']; $sqlfields[$i] .= $field_desc['type'];
if( preg_match("/^[^\s]/i",$field_desc['value'])) if( preg_match("/^[^\s]/i",$field_desc['value']))
$sqlfields[$i] .= "(".$field_desc['value'].")"; $sqlfields[$i] .= "(".$field_desc['value'].")";
else if( preg_match("/^[^\s]/i",$field_desc['attribute']))
$sqlfields[$i] .= " ".$field_desc['attribute']; if( preg_match("/^[^\s]/i",$field_desc['attribute']))
else if( preg_match("/^[^\s]/i",$field_desc['default'])) $sqlfields[$i] .= " ".$field_desc['attribute'];
if( preg_match("/^[^\s]/i",$field_desc['default']))
{ {
if(preg_match("/null/i",$field_desc['default'])) if(preg_match("/null/i",$field_desc['default']))
$sqlfields[$i] .= " default ".$field_desc['default']; $sqlfields[$i] .= " default ".$field_desc['default'];
elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP')
$sqlfields[$i] .= " default ".$field_desc['default'];
else else
$sqlfields[$i] .= " default '".$field_desc['default']."'"; $sqlfields[$i] .= " default '".$field_desc['default']."'";
} }
else if( preg_match("/^[^\s]/i",$field_desc['null'])) if( preg_match("/^[^\s]/i",$field_desc['null']))
$sqlfields[$i] .= " ".$field_desc['null']; $sqlfields[$i] .= " ".$field_desc['null'];
else if( preg_match("/^[^\s]/i",$field_desc['extra'])) if( preg_match("/^[^\s]/i",$field_desc['extra']))
$sqlfields[$i] .= " ".$field_desc['extra']; $sqlfields[$i] .= " ".$field_desc['extra'];
$i++; $i++;
} }
if($primary_key != "") if($primary_key != "")
@ -925,7 +930,7 @@ class DoliDBMysqli
$sql .= ",".implode(',',$sqluq); $sql .= ",".implode(',',$sqluq);
if($keys != "") if($keys != "")
$sql .= ",".implode(',',$sqlk); $sql .= ",".implode(',',$sqlk);
$sql .=") type=".$type; $sql .=") engine=".$type;
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);
if(! $this -> query($sql)) if(! $this -> query($sql))

View File

@ -19,8 +19,8 @@
*/ */
/** /**
* \file htdocs/core/getmenu_jmobile.php * \file htdocs/core/get_menudiv.php
* \brief File to return menu * \brief File to return menu into a div tree
*/ */
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
@ -50,26 +50,24 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
* View * View
*/ */
// URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests
$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js'); $arrayofjs=array();
$arrayofcss=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css'); $arrayofcss=array();
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<body>'."\n"; print '<body>'."\n";
if (empty($user->societe_id)) // If internal user or not defined if (empty($user->societe_id)) // If internal user or not defined
{ {
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
} }
else // If external user else // If external user
{ {
$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
} }
// Load the menu manager (only if not already done) // Load the menu manager (only if not already done)
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; $file_menu=$conf->standard_menu;
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
if (! class_exists('MenuManager')) if (! class_exists('MenuManager'))
{ {
@ -88,7 +86,7 @@ if (! class_exists('MenuManager'))
} }
} }
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1); $menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
$menumanager->loadMenu(); $menumanager->loadMenu('all','all');
$menumanager->showmenu('jmobile'); $menumanager->showmenu('jmobile');

View File

@ -115,13 +115,13 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
// Buttons // Buttons
print '<td align="center" valign="middle" nowrap="nowrap">'; print '<td align="center" valign="middle" nowrap="nowrap">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" class="button" style="width:120px" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" class="button" style="width:120px" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '<br>'; print '<br>';
print img_picto($langs->trans("ViewWeek"),'object_calendarweek').' <input type="submit" class="button" style="width:120px" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" class="button" style="width:120px" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '<br>'; print '<br>';
print img_picto($langs->trans("ViewDay"),'object_calendarday').' <input type="submit" class="button" style="width:120px" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" class="button" style="width:120px" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '<br>'; print '<br>';
print img_picto($langs->trans("ViewList"),'object_list').' <input type="submit" class="button" style="width:120px" name="viewlist" value="'.$langs->trans("ViewList").'">'; print img_picto($langs->trans("ViewList"),'object_list','class="hideonsmartphone"').' <input type="submit" class="button" style="width:120px" name="viewlist" value="'.$langs->trans("ViewList").'">';
print '</td>'; print '</td>';
// Legend // Legend

View File

@ -299,12 +299,17 @@ function ajax_dialog($title,$message,$w=350,$h=150)
/** /**
* Convert a html select field into an ajax combobox * Convert a html select field into an ajax combobox
* *
* @param string $htmlname Name of html select field * @param string $htmlname Name of html select field
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string Return html string to convert a select field into a combo * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
* @return string Return html string to convert a select field into a combo
*/ */
function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0) function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0)
{ {
global $conf;
if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works)
$msg = '<script type="text/javascript"> $msg = '<script type="text/javascript">
$(function() { $(function() {
$("#'.$htmlname.'").combobox({ $("#'.$htmlname.'").combobox({

View File

@ -42,7 +42,7 @@ function dol_basename($pathfile)
* @param string $path Starting path from which to search * @param string $path Starting path from which to search
* @param string $types Can be "directories", "files", or "all" * @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched * @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex for include filter * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
@ -649,7 +649,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
$hookmanager->initHooks(array('fileslib')); $hookmanager->initHooks(array('fileslib'));
$parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $parameters=array('dest_file' => $dest_file, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite);
$reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object);
} }
@ -1212,11 +1212,11 @@ function dol_uncompress($inputfile,$outputdir)
/** /**
* Return most recent file * Return file(s) into a directory (by default most recent)
* *
* @param string $dir Directory to scan * @param string $dir Directory to scan
* @param string $regexfilter Regexfilter * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @return string Full path to most recent file * @return string Full path to most recent file
*/ */
@ -1225,4 +1225,5 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$
$tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,'',$nohook); $tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,'',$nohook);
return $tmparray[0]; return $tmparray[0];
} }
?> ?>

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