Merge branch 'Upstream/develop'

This commit is contained in:
aspangaro 2014-05-29 21:44:03 +02:00
commit aa4e9d5965
202 changed files with 1002 additions and 563 deletions

View File

@ -100,8 +100,9 @@ tools:
comparison_of_bit_result: true
basic_semantic_checks:
enabled: true
# Disabled unused code. In most cases, we want to keep it.
unused_code:
enabled: true
enabled: false
deprecation_checks:
enabled: true
useless_function_calls:

View File

@ -133,6 +133,12 @@ Fix: [ bug #1393 ] PHP Warning when creating a supplier invoice.
Fix: [ bug #1399 ] [pgsql] Silent warning when setting a propal as "facturée" in propal.php
Fix: When number reach 9999 with default numbering module, next number
will be 10000 instead of 0000 and error.
Fix: element page on project give wrong href link.
Fix: [ bug #1397 ] Filter by supplier orders with status Draft does not filter.
Fix: [ bug #1388 ] Wrong date when invoicing several orders.
Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled.
Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes.
Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
Fix: Can't add user for a task.
@ -220,6 +226,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar.
New: Added es_CL language
Fix: Margin tabs bad data show
Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice.
Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line
***** ChangeLog for 3.5 compared to 3.4.* *****
For users:

View File

@ -229,7 +229,9 @@ from origin/upstream and origin/pristine.
* If new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh
* Edit tgz file to remove ckeditor and phpexcel and renama file into dolibarr-x.y.z+dsfgw.tgz
* Edit tgz file to remove ckeditor and phpexcel and rename file into
dolibarr-x.y.z+dsfgw.tgz
(x.y.z = version, w start from 1 and is increased for each new import)
* Staying into git root directory, run
> git-import-orig -vv ../dolibarr-x.y.z+dsfgw.tgz

View File

@ -14,4 +14,3 @@ $force_install_databaserootpass='root';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
?>

View File

@ -452,6 +452,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;

View File

@ -115,4 +115,3 @@ else
$db->close();
return $error;
?>

23
dev/rmphpclosingtag.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
#
# Author: Bryan C. Geraghty <bryan@ravensight.org>
# Date: 2009-10-28
# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
##
FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .);
for MATCH in $FILES;
do
FILE=`echo $MATCH | awk -F ':' '{print $1}'`;
TARGET=`echo $MATCH | awk -F ':' '{print $2}'`;
LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`;
echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE...";
sed -i "${TARGET},${LINE_COUNT}d" $FILE;
done;

View File

@ -371,4 +371,3 @@ class Skeleton_Class extends CommonObject
}
}
?>

View File

@ -271,4 +271,3 @@ function createSkeleton($authentication,$skeleton)
// Return the results.
$server->service($HTTP_RAW_POST_DATA);
?>

View File

@ -338,4 +338,3 @@ class autoTranslator
}
}
?>

View File

@ -264,4 +264,3 @@ foreach($filesToProcess as $fileToProcess)
return 0;
?>

View File

@ -93,4 +93,3 @@ class AccountancyAccount
}
}
?>

View File

@ -62,7 +62,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
private function getTitle($action)
{
global $langs;
global $langs,$conf;
$out='';

View File

@ -138,7 +138,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
{
$result=$object->setUserId($_POST["userid"]);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error('',$object->error);
$_POST['action']='';
$action='';
}
@ -172,7 +172,7 @@ if ($action == 'setsocid')
if (! $error)
{
$result=$object->setThirdPartyId(GETPOST('socid','int'));
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error('',$object->error);
$_POST['action']='';
$action='';
}
@ -1101,4 +1101,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -280,4 +280,3 @@ print '<br>';
llxFooter();
$db->close();
?>

View File

@ -95,6 +95,8 @@ class Adherent extends CommonObject
var $first_subscription_date;
var $first_subscription_amount;
var $last_subscription_date;
var $last_subscription_date_start;
var $last_subscription_date_end;
var $last_subscription_amount;
var $subscriptions=array();

View File

@ -99,8 +99,10 @@ class AdherentType extends CommonObject
*/
function update($user)
{
global $hookmanager;
global $hookmanager,$conf;
$error=0;
$this->libelle=trim($this->libelle);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -116,6 +118,8 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id);
@ -132,8 +136,8 @@ class AdherentType extends CommonObject
}
}
else if ($reshook < 0) $error++;
return 1;
}
else

View File

@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (!$user->admin)
accessforbidden();
if (!$user->admin) accessforbidden();
$langs->load("agenda");
$langs->load("admin");
@ -63,7 +62,7 @@ if ($actionsave)
// Save agendas
while ($i <= $MAXAGENDA)
{
$name=trim(GETPOST('agenda_ext_name'.$i),'alpha');
$name=trim(GETPOST('agenda_ext_name'.$i,'alpha'));
$src=trim(GETPOST('agenda_ext_src'.$i,'alpha'));
$color=trim(GETPOST('agenda_ext_color'.$i,'alpha'));
if ($color=='-1') $color='';
@ -76,7 +75,7 @@ if ($actionsave)
break;
}
//print 'color='.$color;
//print '-name='.$name.'-color='.$color;
$res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,$name,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,$src,'chaine',0,'',$conf->entity);
@ -218,8 +217,7 @@ print '</table>';
print '<br>';
print '<center>';
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "<input type=\"submit\" id=\"save\" name=\"save\" class=\"button hideifnotset\" value=\"".$langs->trans("Save")."\">";
print "</center>";
print "</form>\n";

View File

@ -64,7 +64,7 @@ else if ($action == 'update')
{
if (GETPOST('submit_GENBARCODE_LOCATION'))
{
$location = GETPOST('genbarcodelocation','alpha');
$location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
}
if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE'))

View File

@ -468,4 +468,3 @@ print '</table>';
llxFooter();
$db->close();
?>

View File

@ -170,4 +170,3 @@ print '<br /><br /><div style="text-align:center"><input type="submit" class="bu
$db->close();
llxFooter();
?>

View File

@ -511,4 +511,3 @@ print '<br>';
$db->close();
llxFooter();
?>

View File

@ -116,4 +116,3 @@ if (empty($reshook))
llxFooter();
$db->close();
?>

View File

@ -143,4 +143,3 @@ print '</form>';
llxFooter();
$db->close();
?>

View File

@ -703,4 +703,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -540,4 +540,3 @@ if ($mode != 'marketplace') print '<div class="info">'.showModulesExludedForExte
llxFooter();
$db->close();
?>

View File

@ -157,4 +157,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@ -88,4 +88,3 @@ print "</TABLE>";
$db->close();
llxFooter();
?>

View File

@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@ -253,4 +253,3 @@ print "</form>\n";
llxFooter();
$db->close();
?>

View File

@ -113,28 +113,23 @@ print '<li><a href="http://plus.google.com/+DolibarrOrg" target="_blank">Google
print '</ul>';
print $langs->trans("OfficialWebHostingService").':';
$url='http://wiki.dolibarr.org/index.php/Cloud_Solutions'; $title=$langs->trans('List');
print $langs->trans("OtherResources").':';
print '<ul>';
$url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService");
if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud';
if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube';
print '<ul>';
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
$url='http://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners");
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
print '</ul>';
llxFooter();
$db->close();
?>

View File

@ -51,4 +51,3 @@ print '</table>';
llxFooter();
?>

View File

@ -86,18 +86,35 @@ print '</br>';
// OPCode cache
print '<br>';
print '<strong>'.$langs->trans("OPCodeCache").'</strong>: ';
$test1=function_exists('xcache_info');
if ($test1)
$foundcache=0;
$test=function_exists('xcache_info');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled");
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>';
}
else
$test=function_exists('eaccelerator_info');
if (! $foundcache && $test)
{
$test2=function_exists('eaccelerator_info');
if ($test2) print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
else print $langs->trans("NoOPCodeCacheFound");
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
}
$test=function_exists('apc_cache_info');
if (! $foundcache && $test)
{
//var_dump(apc_cache_info());
if (ini_get('apc.enabled'))
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("APCInstalled");
}
else
{
print img_picto('','warning').' '.$langs->trans("APCCacheInstalledButDisabled");
}
}
if (! $foundcache) print $langs->trans("NoOPCodeCacheFound");
print '<br>';
// HTTPCacheStaticResources

View File

@ -120,4 +120,3 @@ foreach($phparray as $key => $value)
llxFooter();
$db->close();
?>

View File

@ -64,4 +64,3 @@ print '</table>';
llxFooter();
$db->close();
?>

View File

@ -214,4 +214,3 @@ print '<br>';
llxFooter();
$db->close();
?>

View File

@ -54,16 +54,23 @@ print '</div>';
print '<div class="principal">';
if ( $_GET['menu'] )
$page=GETPOST('menu','alpha');
if (in_array(
$page,
array(
'deconnexion',
'index','index_verif','facturation','facturation_verif','facturation_dhtml',
'validation','validation_ok','validation_ticket','validation_verif',
)
))
{
include $_GET['menu'].'.php';
include $page.'.php';
}
else
{
include 'facturation.php';
dol_print_error('','menu param '.$page.' is not inside allowed list');
}
print '</div>';
$_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -141,4 +141,3 @@ class Auth
}
?>

View File

@ -653,4 +653,3 @@ class Facturation
}
?>

View File

@ -166,4 +166,3 @@ $_SESSION['serObjFacturation'] = serialize($obj_facturation);
header('Location: '.$redirection);
exit;
?>

View File

@ -142,4 +142,3 @@ else
exit;
}
?>

View File

@ -26,4 +26,3 @@ $form=new Form($db);
// Affichage des templates
require ('tpl/validation1.tpl.php');
?>

View File

@ -56,14 +56,13 @@ class ICal
{
$this->file = $file;
$file_text='';
$tmparray=file($file);
if (is_array($tmparray))
{
$file_text = join("", $tmparray); //load file
$file_text = preg_replace("/[\r\n]{1,} ([:;])/","\\1",$file_text);
$file_text = preg_replace("/[\r\n]{1,} /","",$file_text);
}
return $file_text; // return all text
}
@ -115,6 +114,7 @@ class ICal
{
// get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin
list($key, $value) = $this->retun_key_value($text);
//var_dump($text.' -> '.$key.' - '.$value);
switch ($text) // search special string
{
@ -165,6 +165,8 @@ class ICal
}
}
}
//var_dump($this->cal);
return $this->cal;
}
@ -236,6 +238,7 @@ class ICal
*/
function retun_key_value($text)
{
/*
preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches);
if (empty($matches))
@ -246,8 +249,8 @@ class ICal
{
$matches = array_splice($matches, 1, 2);
return $matches;
}
}*/
return explode(':',$text,2);
}
/**

View File

@ -146,9 +146,11 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0
$source='AGENDA_EXT_SRC'.$i;
$name='AGENDA_EXT_NAME'.$i;
$color='AGENDA_EXT_COLOR'.$i;
$buggedfile='AGENDA_EXT_BUGGEDFILE'.$i;
if (! empty($conf->global->$source) && ! empty($conf->global->$name))
{
$listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color);
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0));
}
}
}
@ -527,9 +529,11 @@ if (count($listofextcals))
$url=$extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics
$namecal = $extcal['name'];
$colorcal = $extcal['color'];
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal;
$buggedfile = $extcal['buggedfile'];
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile;
$ical=new ICal();
$ical->parse($url);
// After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ...
//var_dump($ical->cal); exit;
$icalevents=array();
@ -643,6 +647,8 @@ if (count($listofextcals))
// Loop on each entry into cal file to know if entry is qualified and add an ActionComm into $eventarray
foreach($icalevents as $icalevent)
{
//var_dump($icalevent);
//print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
if (! empty($icalevent['RRULE'])) continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule.
@ -659,12 +665,36 @@ if (count($listofextcals))
$event->fulldayevent=true;
$addevent=true;
}
elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array)
elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch)
{
$datestart=$icalevent['DTSTART'];
$dateend=$icalevent['DTEND'];
$addevent=true;
}
elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind)
{
$datestart=$icalevent['DTSTART']['unixtime'];
$dateend=$icalevent['DTEND']['unixtime'];
// $buggedfile is set to uselocalandtznodaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtznodaylight'
if ($buggedfile === 'uselocalandtznodaylight') // unixtime is a local date that does not take daylight into account, TZID is +1 for example for 'Europe/Paris' in summer instead of 2
{
// TODO
}
// $buggedfile is set to uselocalandtzdaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtzdaylight' (for example with bluemind)
if ($buggedfile === 'uselocalandtzdaylight') // unixtime is a local date that does take daylight into account, TZID is +2 for example for 'Europe/Paris' in summer
{
$localtzs = new DateTimeZone(preg_replace('/"/','',$icalevent['DTSTART']['TZID']));
$localtze = new DateTimeZone(preg_replace('/"/','',$icalevent['DTEND']['TZID']));
$localdts = new DateTime(dol_print_date($datestart,'dayrfc','gmt'), $localtzs);
$localdte = new DateTime(dol_print_date($dateend,'dayrfc','gmt'), $localtze);
$tmps=-1*$localtzs->getOffset($localdts);
$tmpe=-1*$localtze->getOffset($localdte);
$datestart+=$tmps;
$dateend+=$tmpe;
//var_dump($datestart);
}
$addevent=true;
}
if ($addevent)
{

View File

@ -179,4 +179,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -1157,7 +1157,7 @@ if ($action == 'create') {
// Date
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
$form->select_date('', '', '', '', '', "addprop");
$form->select_date('', '', '', '', '', "addprop", 1, 1);
print '</td></tr>';
// Validaty duration
@ -1191,10 +1191,9 @@ if ($action == 'create') {
$syear = date("Y", $tmpdte);
$smonth = date("m", $tmpdte);
$sday = date("d", $tmpdte);
$form->select_date($syear . "-" . $smonth . "-" . $sday, 'liv_', '', '', '', "addprop");
$form->select_date($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addprop");
} else {
$datepropal = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
$form->select_date($datepropal, 'liv_', '', '', '', "addprop");
$form->select_date(-1, 'liv_', '', '', '', "addprop", 1, 1);
}
print '</td></tr>';
@ -1247,8 +1246,9 @@ if ($action == 'create') {
print '<input type="hidden" name="createmode" value="empty">';
}
print '<table>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '<table>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
{
// For backward compatibility
print '<tr>';
print '<td><input type="radio" name="createmode" value="copy"></td>';
@ -1311,13 +1311,11 @@ if ($action == 'create') {
print '<td><input type="text" size="2" name="remise' . $i . '" value="' . $soc->remise_percent . '">%</td>';
print '</tr>';
}
print "</table>";
}
print '</td></tr>';
}
print '</table>';
print '<br>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '</table><br>';
$langs->load("bills");
print '<center>';

View File

@ -142,4 +142,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -285,7 +285,7 @@ if ($result)
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -301,6 +301,7 @@ if ($result)
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
print '</td>';
print '<td class="liste_titre"><input class="flat" type="text" size="10" name="search_town" value="'.$search_town.'"></td>';
// Date
print '<td class="liste_titre" colspan="1" align="center">';
//print $langs->trans('Month').': ';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
@ -309,11 +310,12 @@ if ($result)
$formother->select_year($syear,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" colspan="1">&nbsp;</td>';
// Amount
print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
print '</td>';
print '<td class="liste_titre" align="right">';
// Author
print '<td class="liste_titre" align="center">';
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
print '</td>';
print '<td class="liste_titre" align="right">';

View File

@ -466,4 +466,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -1387,7 +1387,7 @@ class Commande extends CommonOrder
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->db->free();
$this->db->free($result);
/*
* Lines

View File

@ -224,4 +224,3 @@ if ($id > 0 || ! empty($ref))
$db->close();
llxFooter();
?>

View File

@ -476,7 +476,7 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
// Add a new line
else if ($action == 'addline' && $user->rights->commande->creer) {
$langs->load('errors');
$error = false;
$error = 0;
// Set if we used free entry or predefined product
$predef='';
@ -1319,13 +1319,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$soc = $objectsrc->client;
$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));
$availability_id = (! empty($objectsrc->availability_id) ? $objectsrc->availability_id : (! empty($soc->availability_id) ? $soc->availability_id : 0));
$demand_reason_id = (! empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (! empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
$remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0));
$remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
$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));
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$datedelivery = (! empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
@ -1335,17 +1335,19 @@ if ($action == 'create' && $user->rights->commande->creer) {
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(- 1, 'external', 1);
}
} else {
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$availability_id = $soc->availability_id;
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
$projectid = 0;
}
$absolute_discount = $soc->getAvailableDiscounts();
else
{
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$availability_id = $soc->availability_id;
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$projectid = 0;
}
$absolute_discount=$soc->getAvailableDiscounts();
$nbrow = 10;
@ -1414,12 +1416,11 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</td></tr>';
// Date de livraison
print "<tr><td>" . $langs->trans("DeliveryDate") . '</td><td colspan="2">';
if (empty($datedelivery)) {
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY))
$datedelivery = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
else
$datedelivery = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
print "<tr><td>".$langs->trans("DeliveryDate").'</td><td colspan="2">';
if (empty($datedelivery))
{
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
}
$form->select_date($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1);
print "</td></tr>";

View File

@ -373,7 +373,7 @@ if ($action == 'create' && empty($mesgs))
$remise_percent = $soc->remise_percent;
}
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$absolute_discount=$soc->getAvailableDiscounts();
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -413,7 +413,7 @@ if ($action == 'create' && empty($mesgs))
// Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
$html->select_date(0,'','','','',"add",1,1);
$html->select_date('','','','','',"add",1,1);
print '</td></tr>';
// Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';

View File

@ -855,4 +855,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -798,7 +798,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->fetch_thirdparty();
// If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid']) {
if ($_POST['origin'] && $_POST['originid'])
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) {
@ -835,15 +836,20 @@ else if ($action == 'add' && $user->rights->facture->creer)
$id = $object->create($user);
if ($id > 0) {
if ($id > 0)
{
// If deposit invoice
if ($_POST['type'] == 3) {
if ($_POST['type'] == 3)
{
$typeamount = GETPOST('typedeposit', 'alpha');
$valuedeposit = GETPOST('valuedeposit', 'int');
if ($typeamount == 'amount') {
if ($typeamount == 'amount')
{
$amountdeposit = $valuedeposit;
} else {
}
else
{
$amountdeposit = 0;
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@ -853,7 +859,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add deposit lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if ($result > 0)
{
$totalamount = 0;
$lines = $srcobject->lines;
$numlines=count($lines);
@ -898,7 +905,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
0,
$langs->trans('Deposit')
);
} else {
}
else
{
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@ -907,10 +916,10 @@ else if ($action == 'add' && $user->rights->facture->creer)
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
$lines = $srcobject->fetch_lines();
if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0;
$num=count($lines);
@ -919,7 +928,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines [$i]->subprice < 0) {
if ($lines [$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc = $object->socid;
@ -1861,10 +1871,12 @@ if ($action == 'create')
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
$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));
$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_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$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));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
@ -1874,11 +1886,11 @@ if ($action == 'create')
}
else
{
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Do not set 0 here (0 for a date is 1970)
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; // Do not set 0 here (0 for a date is 1970)
}
$absolute_discount = $soc->getAvailableDiscounts();

View File

@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@ -2056,7 +2056,7 @@ class Facture extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@ -2133,7 +2133,7 @@ class Facture extends CommonInvoice
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();

View File

@ -166,4 +166,3 @@ else
$db->close();
llxFooter();
?>

View File

@ -310,4 +310,3 @@ print '</table>';
$db->close();
llxFooter();
?>

View File

@ -179,4 +179,3 @@ else
$db->close();
llxFooter();
?>

View File

@ -1094,4 +1094,3 @@ class Contact extends CommonObject
}
}
?>

View File

@ -249,4 +249,3 @@ if ($action != 'edit')
llxFooter();
$db->close();
?>

View File

@ -58,4 +58,3 @@ print '</div>';
$db->close();
llxFooter();
?>

View File

@ -253,4 +253,3 @@ if ($section)
// Close db if mode is not noajax
if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
?>

View File

@ -71,4 +71,3 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
exit;
}
?>

View File

@ -115,4 +115,3 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
}
?>

View File

@ -156,4 +156,3 @@ class box_actions extends ModeleBoxes
}
?>

View File

@ -165,4 +165,3 @@ class AntiVir
}
?>

View File

@ -198,4 +198,3 @@ class Canvas
}
}
?>

View File

@ -627,10 +627,10 @@ abstract class CommonObject
/**
* Load data for barcode into properties ->barcode_type*
* Properties ->barcode_type is used to find others.
* If not defined, ->element must be defined to know default barcode type.
* Properties ->barcode_type that is id of barcode type is used to find other properties, but
* if it is not defined, ->element must be defined to know default barcode type.
*
* @return int <0 if KO, >=0 if OK
* @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded)
*/
function fetch_barcode()
{
@ -639,11 +639,11 @@ abstract class CommonObject
dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type);
$idtype=$this->barcode_type;
if (! $idtype)
if (empty($idtype) && $idtype != '0') // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined
{
if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed');
else dol_syslog('Call fetch_barcode with barcode_type not defined and cant be guessed', LOG_WARNING);
}
if ($idtype > 0)
@ -1518,7 +1518,7 @@ abstract class CommonObject
* @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @return int <0 if KO, >0 if OK
*/
function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='')
@ -3237,6 +3237,7 @@ abstract class CommonObject
$marginInfo = $this->getMarginInfos($force_price);
print '<table class="nobordernopadding" width="100%">';
print '<tr class="liste_titre">';
print '<td width="30%">'.$langs->trans('Margins').'</td>';
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
@ -3250,38 +3251,49 @@ abstract class CommonObject
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.$langs->trans('MarkRate').'</td>';
print '</tr>';
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="impair">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td align="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td align="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
//}
print '<tr class="impair">';
print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td align="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
if (! empty($conf->product->enabled))
{
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="impair">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td align="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
}
if (! empty($conf->service->enabled))
{
print '<tr class="pair">';
print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td align="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
}
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
{
print '<tr class="impair">';
print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td align="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
}
print '</table>';
}

View File

@ -191,8 +191,9 @@ class Form
$ret.='</td>';
if ($typeofdata != 'day' && $typeofdata != 'datepicker' && $typeofdata != 'datehourpicker')
{
$ret.='<td align="left"><input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'">';
$ret.='<br><br>'."\n";
$ret.='<td align="left">';
$ret.='<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'">';
$ret.='<br>'."\n";
$ret.='<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
$ret.='</td>';
}
@ -4087,8 +4088,8 @@ class Form
// Complete object if not complete
if (empty($object->barcode_type_code) || empty($object->barcode_type_coder))
{
$result = $object->fetch_barcode();
//Check if fetch_barcode() failed
$result = $object->fetch_barcode();
//Check if fetch_barcode() failed
if ($result < 1) return '<!-- ErrorFetchBarcode -->';
}

View File

@ -1184,4 +1184,3 @@ class FormFile
}
?>

View File

@ -363,7 +363,8 @@ class FormOther
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0);
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_societe = ".$user->societe_id;
// Add existing sales representatives of thirdparty of external user
if (empty($user->rights->user->user->lire) && $user->societe_id)
{
@ -1164,4 +1165,3 @@ class FormOther
}
?>

View File

@ -194,6 +194,7 @@ class FormProjets
if (!empty($this->societe->id)) {
$sql.= " AND fk_soc=".$this->societe->id;
}
$sql.= ' AND entity='.$conf->entity;
$sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);

View File

@ -775,4 +775,3 @@ function xml2php($xml)
}
?>

View File

@ -825,8 +825,16 @@ class DoliDBMysql extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
else
{
// If user already exists, we continue to set permissions
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
}
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log

View File

@ -829,8 +829,16 @@ class DoliDBMysqli extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
else
{
// If user already exists, we continue to set permissions
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
}
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log

View File

@ -46,7 +46,7 @@ class DoliDBPgsql extends DoliDB
static $versionmin=array(8,4,0); // Version min database
//! Resultset of last query
private $_results;
public $unescapeslashquot;
public $standard_conforming_strings;
@ -172,6 +172,8 @@ class DoliDBPgsql extends DoliDB
else if (preg_match('/DROP TABLE/i',$line)) $type='dml';
}
$line=preg_replace('/ as signed\)/i',' as integer)',$line);
if ($type == 'dml')
{
$line=preg_replace('/\s/',' ',$line); // Replace tabulation with space
@ -196,8 +198,7 @@ class DoliDBPgsql extends DoliDB
// nuke unsigned
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
$line=preg_replace('/as signed/i','as integer',$line);
// blob -> text
$line=preg_replace('/\w*blob/i','text',$line);
@ -463,7 +464,7 @@ class DoliDBPgsql extends DoliDB
function query($query,$usesavepoint=0,$type='auto')
{
global $conf;
$query = trim($query);
// Convert MySQL syntax to PostgresSQL syntax
@ -484,7 +485,7 @@ class DoliDBPgsql extends DoliDB
else $loop=false;
}
}
if ($usesavepoint && $this->transaction_opened)
{
@pg_query($this->db, 'SAVEPOINT mysavepoint');

View File

@ -108,4 +108,3 @@ function SendErrorNode($number, $text)
else
echo '<Error number="' . $number . '" />' ;
}
?>

View File

@ -39,7 +39,7 @@
* @param string $filterd Filter of done by user
* @param int $pid Product id
* @param int $socid Third party id
* @param array $showextcals Array with list of external calendars, or -1 to show no legend
* @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
* @param string $actioncode Preselected value of actioncode for filter on type
* @return void
*/
@ -136,7 +136,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '});' . "\n";
print '</script>' . "\n";
print '<table>';
if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
if (! empty($conf->use_javascript_ajax))
{
if (count($showextcals) > 0)
{
@ -147,7 +147,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr><td>';
print '<script type="text/javascript">' . "\n";
print 'jQuery(document).ready(function () {' . "\n";
print 'jQuery("#check_' . $htmlname . '").click(function() { jQuery(".family_' . $htmlname . '").toggle(); });' . "\n";
print ' jQuery("#check_' . $htmlname . '").click(function() {';
print ' /* alert("'.$htmlname.'"); */';
print ' jQuery(".family_' . $htmlname . '").toggle();';
print ' });' . "\n";
print '});' . "\n";
print '</script>' . "\n";
print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'];
@ -434,9 +437,9 @@ function actions_prepare_head($object)
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
return $head;

View File

@ -416,4 +416,3 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0,
}
}
?>

View File

@ -119,4 +119,3 @@ function contract_admin_prepare_head()
return $head;
}
?>

View File

@ -134,4 +134,3 @@ function fichinter_admin_prepare_head()
}
?>

View File

@ -198,4 +198,3 @@ function supplierorder_admin_prepare_head($object)
}
?>

View File

@ -3694,6 +3694,7 @@ function dol_textishtml($msg,$option=0)
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
return false;
@ -4588,5 +4589,3 @@ function natural_search($fields, $value)
}
return " AND " . ($end > 1? '(' : '') . $res;
}
?>

View File

@ -286,4 +286,3 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
else return $result;
}
?>

View File

@ -44,4 +44,3 @@ function mailmanspip_admin_prepare_head()
);
}
?>

View File

@ -205,4 +205,3 @@ function member_stats_prepare_head($object)
return $head;
}
?>

View File

@ -1036,10 +1036,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if (empty($hideref))
{
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
else $ref_prodserv = $prodser->ref; // Show local ref only
$ref_prodserv .= " - ";
if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
}
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;

View File

@ -311,7 +311,9 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
}
}
//print "Delete access is ko";
// If a or and at least one ok
if (preg_match('/\|/', $features) && $nbko < count($featuresarray)) $deleteok=1;
if (! $deleteok) accessforbidden();
//print "Delete access is ok";
}

View File

@ -286,7 +286,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
// Set jquery theme
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
$favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico';
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
$jquerytheme = 'smoothness';
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;

View File

@ -588,4 +588,3 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
return $list;
}
?>

View File

@ -165,4 +165,3 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
if (empty($pere['rowid'])) print '</ul>';
}
?>

View File

@ -773,16 +773,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Suppliers
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
{
if (! empty($conf->facture->enabled))
{
$langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
$langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
}
$newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
}
// Orders

View File

@ -161,20 +161,23 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
/**
* Check validity of code according to its rules
*
* @param DoliDB $db Database handler
* @param string &$code Code to check/correct
* @param Product $product Object product
* @param int $type 0 = customer/prospect , 1 = supplier
* @return int 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* @param DoliDB $db Database handler
* @param string &$code Code to check/correct
* @param Product $product Object product
* @param int $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param string $type type of barcode (EAN, ISBN, ...)
* @return int 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
*/
function verif($db, &$code, $product, $type)
function verif($db, &$code, $product, $thirdparty_type, $type)
{
global $conf;
//var_dump($code.' '.$product->ref.' '.$thirdparty_type);exit;
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
$result=0;
@ -190,7 +193,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
else
{
if ($this->verif_syntax($code) >= 0)
if ($this->verif_syntax($code, $type) >= 0)
{
$is_dispo = $this->verif_dispo($db, $code, $product);
if ($is_dispo <> 0)
@ -215,7 +218,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
}
dol_syslog(get_class($this)."::verif type=".$type." result=".$result);
dol_syslog(get_class($this)."::verif type=".$thirdparty_type." result=".$result);
return $result;
}
@ -254,12 +257,13 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
/**
* Renvoi si un code respecte la syntaxe
* Return if a barcode value match syntax
*
* @param string $code Code a verifier
* @param string $codefortest Code to check syntax
* @param string $typefortest Type of barcode (ISBN, EAN, ...)
* @return int 0 if OK, <0 if KO
*/
function verif_syntax($code)
function verif_syntax($codefortest, $typefortest)
{
global $conf;
@ -273,7 +277,13 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
return '';
}
$result=check_value($mask,$code);
$newcodefortest=$codefortest;
if (in_array($typefortest,array('EAN13','ISBN'))) // We remove the CRC char not included into mask
{
$newcodefortest=substr($newcodefortest,0,12);
}
$result=check_value($mask,$newcodefortest);
return $result;
}

View File

@ -403,4 +403,3 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
?>

View File

@ -256,4 +256,3 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
return -1;
}
}
?>

View File

@ -144,4 +144,3 @@ class mod_contract_serpis extends ModelNumRefContracts
}
}
?>

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -179,9 +180,10 @@ class pdf_rouget extends ModelePdfExpedition
$tab_height = 130;
$tab_height_newpage = 150;
if (! empty($object->note_public) || ! empty($object->tracking_number))
if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id)))
{
$tab_top = 88;
$tab_top_alt = $tab_top;
// Tracking number
if (! empty($object->tracking_number))
@ -196,7 +198,9 @@ class pdf_rouget extends ModelePdfExpedition
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
$pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
$tab_top_alt += 7;
}
}
}
@ -205,7 +209,7 @@ class pdf_rouget extends ModelePdfExpedition
if (! empty($object->note_public))
{
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
}
$nexY = $pdf->GetY();

View File

@ -143,4 +143,3 @@ class mod_expedition_safor extends ModelNumRefExpedition
}
}
?>

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