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

Conflicts:
	test/phpunit/Functions2LibTest.php
This commit is contained in:
Marcos García de La Fuente 2014-07-22 04:42:50 +02:00
commit 1a254b310e
56 changed files with 282 additions and 176 deletions

View File

@ -134,6 +134,10 @@ For users:
- Fix: [ bug #1477 ] Several customer invoice triggers do not show trigger error messages
- Fix: [ bug #1471 ] Several PHP warnings when intercepting USER_CREATE trigger.
- Fix: [ bug #1517 ] Packages sizes.
- Fix: [ bug #1521 ] The second order's page from a provider shows all orders
TODO
- New: Predefined product and free product use same form.
For translators:
- Update language files.

View File

@ -115,8 +115,8 @@ Divers:
- Application simple à utiliser.
- Plusieurs thèmes visuels.
- Code simple et facilement personnalisable.
- Fonctionne avec PHP 5.3+, MySQL 4.1+ ou PostgreSql 8.1.4+.
- Compatible avec toutes les offres Cloud du marché respectant les prérequis MySQL et PHP.
- Requiert PHP et Mysql ou Postgresql (Voir versions exactes sur http://wiki.dolibarr.org/index.php/Prérequis).
- Compatible avec toutes les offres Cloud du marché respectant les prérequis MySQL et PHP ou Postgresql.
## CE QUE DOLIBARR NE PEUT PAS FAIRE (TACHES A FAIRE)

View File

@ -114,6 +114,7 @@ See ChangeLog file found into package.
- Very user friendly and easy to use.
- Highly customizable: Enable only modules you need, user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one).
- Works with PHP 5.3+, MySql 4.1 or PostgreSQL 8.1.
- Require PHP and Mysql or Postgresql (See exatc versions on http://wiki.dolibarr.org/index.php/Prerequisite).
- Compatible with all Cloud solutions that match MySql, PHP or PostgreSQL prerequisites.
- An easy to understand, maintain and code interfaces with your own system information (PHP with no heavy frameworks, trigger and hook architecture).
- Support countries specific features:

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT ruleset (description,rule+)>
<!ELEMENT ruleset (description,exclude-pattern*,rule+)>
<!ATTLIST ruleset name CDATA "">
<!ELEMENT description (#PCDATA)>
<!ELEMENT exclude-pattern (#PCDATA)>
<!ELEMENT rule (properties*,severity*)>
<!ATTLIST rule ref CDATA "">
<!ELEMENT properties (property+)>

View File

@ -3,6 +3,12 @@
<ruleset name="Dolibarr">
<description>Dolibarr coding standard.</description>
<exclude-pattern>*/conf.php</exclude-pattern>
<exclude-pattern>*/includes/*</exclude-pattern>
<exclude-pattern>*/documents/*</exclude-pattern>
<exclude-pattern>*/custom/*</exclude-pattern>
<exclude-pattern>*/nltechno*</exclude-pattern>
<!-- List of all tests -->
<rule ref="Internal.NoCodeFound">
@ -19,7 +25,7 @@
</rule>
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
<!-- <rule ref="Zend.Files.ClosingTag"/> -->
<rule ref="Zend.Files.ClosingTag"/>
<!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->

View File

@ -90,6 +90,7 @@ class Adherent extends CommonObject
var $user_login;
var $fk_soc;
var $thirdparty; // Loaded by ->fetch_thirdparty()
// Fields loaded by fetch_subscriptions()
var $first_subscription_date;

View File

@ -15,7 +15,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
@ -120,10 +119,7 @@ $var=true;
if (empty($conf->use_javascript_ajax))
{
setEventMessage(array(
$langs->trans("NotAvailable"),
$langs->trans("JavascriptDisabled")
), 'errors');
setEventMessage(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), 'errors');
}
else
{

View File

@ -41,19 +41,23 @@ print '<tr><td valign="top" width="40%" class="notopnoleft">';
/*
* Turnover
*/
print_titre($langs->trans('SalesTurnover'));
print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td>';
print '<tr class="liste_titre"><td>'.$langs->trans("Month").'</td>';
print '<td align="right">'.$langs->trans("Total").'</td></tr>';
$now=dol_now();
$sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")";
$sql .= " GROUP BY mois ORDER BY mois";
$sql = "SELECT SUM(t.value) as value, MONTH(o.date_purchased) as month";
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql.= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
//$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")";
$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR('".$db->idate($now)."')";
$sql.= " GROUP BY month";
$sql.= " ORDER BY month";
//print $sql;exit;
$result=$dbosc->query($sql);
if ($result)
@ -116,7 +120,7 @@ if ($resql)
{
$obj = $dbosc->fetch_object($resql);
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
print "<tr><td>".$obj->orders_id."</td><td>".$obj->customers_name."</td><td>".price($obj->value)."</td><td>".$obj->payment_method."</td></tr>";
$i++;
}
print "</table><br>";
@ -235,6 +239,7 @@ else
}
print '</tr></table>';
$dbosc->close();
llxFooter();
$dbosc->close();

View File

@ -195,16 +195,6 @@ if ($resql)
if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions");
/*if ($socid)
{
$societe = new Societe($db);
$societe->fetch($socid);
$newtitle=$langs->trans($title).' '.$langs->trans("For").' '.$societe->nom;
}
else
{
$newtitle=$langs->trans($title);
}*/
$newtitle=$langs->trans($title);
$tabactive='';
@ -298,7 +288,7 @@ if ($resql)
{
$societestatic->id=$obj->socid;
$societestatic->client=$obj->client;
$societestatic->nom=$obj->societe;
$societestatic->name=$obj->societe;
print $societestatic->getNomUrl(1,'',10);
}
else print '&nbsp;';

View File

@ -304,7 +304,7 @@ elseif ($action == 'edit')
$societe->fetch($socid);
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'card', $societe->nom);
dol_fiche_head($head, 'card', $societe->name);
print_titre($langs->trans("EditAddress"));
print "<br>\n";
@ -407,7 +407,7 @@ else
$societe->fetch($object->socid);
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $societe->nom);
dol_fiche_head($head, 'customer', $societe->name);
// Confirmation delete

View File

@ -3463,7 +3463,7 @@ if ($action == 'create')
if ($resteapayer == 0) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
} else {
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid=' . $object->id . '&amp;action=create &amp;accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid=' . $object->id . '&amp;action=create&amp;accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
}
}
}

View File

@ -149,9 +149,23 @@ class Interfaces
$objMod = new $modName($this->db);
if ($objMod)
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch triggers for file '".$files[$key]."'", LOG_INFO);
$result=0;
if (method_exists($objMod, 'runTrigger')) // New method to implement
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_INFO);
$result=$objMod->runTrigger($action,$object,$user,$langs,$conf);
}
elseif (method_exists($objMod, 'run_trigger')) // Deprecated method
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch run_trigger for file '".$files[$key]."'", LOG_INFO);
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
}
else
{
dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
}
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
if ($result > 0)
{
// Action OK
@ -173,7 +187,7 @@ class Interfaces
}
}
else
{
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Failed to instantiate trigger for file '".$files[$key]."'", LOG_ERR);
}
}

View File

@ -101,6 +101,13 @@ function SendError($number, $text)
exit ;
}
/**
* SendErrorNode
*
* @param integer $number Number
* @param string $text Text of error
* @return string Error node
*/
function SendErrorNode($number, $text)
{
if ($text)

View File

@ -70,6 +70,14 @@ function GetResourceTypeDirectory($resourceType, $sCommand)
}
}
/**
* GetUrlFromPath
*
* @param string $resourceType Resource type
* @param string $folderPath Path
* @param string $sCommand Command
* @return string Full url
*/
function GetUrlFromPath($resourceType, $folderPath, $sCommand)
{
return CombinePaths(GetResourceTypePath($resourceType, $sCommand), $folderPath);

View File

@ -4053,10 +4053,11 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
/**
* Set event message in dol_events session
* Set event message in dol_events session object. Will be output by calling dol_htmloutput_events.
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
*
* @param mixed $mesgs Message string or array
* @param string $style Which style to use ('mesgs', 'warnings', 'errors')
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @return void
* @see dol_htmloutput_events
*/
@ -4078,6 +4079,8 @@ function setEventMessage($mesgs, $style='mesgs')
/**
* Print formated messages to output (Used to show messages on html output).
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is
* no need to call it explicitely.
*
* @return void
* @see dol_htmloutput_mesg

View File

@ -252,7 +252,7 @@ else {
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
<?php
// Line extrafield
// Lines for extrafield
if (!empty($extrafieldsline)) {
if ($this->table_element_line=='commandedet') {
$newline = new OrderLine($this->db);
@ -267,7 +267,7 @@ else {
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
}
}
?>
?>
</tr>
<?php
@ -275,6 +275,8 @@ if (! empty($conf->service->enabled) && $dateSelector)
{
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
else $colspan = 9;
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
if (in_array($object->element,array('propal','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button
if (! empty($usemargins))
{

View File

@ -1,7 +1,5 @@
<?php
/*
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
@ -135,15 +133,15 @@ abstract class DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
abstract function run_trigger($action, $object, User $user, Translate $langs, Conf $conf);
abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf);
}

View File

@ -36,16 +36,16 @@ class InterfaceLogevents extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)

View File

@ -35,16 +35,16 @@ class InterfacePaypalWorkflow extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Mettre ici le code a executer en reaction de l'action
// Les donnees de l'action sont stockees dans $object

View File

@ -37,16 +37,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing
@ -116,7 +116,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
return $ret;
}
}
// classify billed order
if ($action == 'BILL_VALIDATE')
{

View File

@ -38,7 +38,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* Following properties must be filled:
* $object->actiontypecode (translation action code: AC_OTH, ...)
@ -55,9 +55,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Module not active, we do nothing
if (empty($conf->agenda->enabled)) {

View File

@ -37,16 +37,16 @@ class InterfaceLdapsynchro extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing

View File

@ -37,16 +37,16 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing

View File

@ -46,16 +46,16 @@ class InterfaceNotification extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing

View File

@ -43,16 +43,16 @@ class InterfaceDemo extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action

View File

@ -1702,7 +1702,7 @@ elseif (! empty($object->id))
print "</tr>";
}
// Ligne en mode update
// Edit line
if ($action == 'edit_line' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id))
{
print "\n";
@ -1728,8 +1728,7 @@ elseif (! empty($object->id))
else
{
$forceall=1; // For suppliers, we always show all types
print $form->select_type_of_lines($line->product_type,'type',1,0,$forceall);
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) print '<br>';
print $form->select_type_of_lines($line->product_type,'type',1,0,$forceall);
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
}

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -151,11 +152,12 @@ if ($resql)
$i = 0;
$param="";
if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_nom) $param.="&search_nom=".$search_nom;
if ($search_user) $param.="&search_user=".$search_user;
if ($search_ttc) $param.="&search_ttc=".$search_ttc;
if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_nom) $param.="&search_nom=".$search_nom;
if ($search_user) $param.="&search_user=".$search_user;
if ($search_ttc) $param.="&search_ttc=".$search_ttc;
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
if ($socid) $param.="&socid=".$socid;
if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -155,9 +155,54 @@ if ($id > 0 || ! empty($ref))
// Third party
print "<tr><td>".$langs->trans("Supplier")."</td>";
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'supplier').'</td></tr>';
// Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
print $object->getLibType();
if ($object->type == FactureFournisseur::TYPE_REPLACEMENT)
{
$facreplaced=new FactureFournisseur($db);
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
}
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE)
{
$facusing=new FactureFournisseur($db);
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
}
$facidavoir=$object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0)
{
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
$i=0;
foreach($facidavoir as $fid)
{
if ($i==0) print ' ';
else print ',';
$facavoir=new FactureFournisseur($db);
$facavoir->fetch($fid);
print $facavoir->getNomUrl(1);
}
print ')';
}
if ($facidnext > 0)
{
$facthatreplace=new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
print '</td></tr>';
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td></tr>';
print "</table>";
print '</div>';
dol_fiche_end();
print '<br>';

View File

@ -168,8 +168,36 @@ if ($object->id > 0)
print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td>';
// Status
$alreadypaid=$object->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4,$alreadypaid).'</td></tr>';
// Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="3">'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3">'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
// Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj=="1") //Localtax1
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '<td colspan="2">&nbsp;</td></tr>';
}
if ($societe->localtax2_assuj=="1") //Localtax2
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td align="right" colspan="3">'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>';
}
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '</table><br>';
print '<table class="border" width="100%">';
// Nb of files
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td width="30%" class="nowrap">'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';

View File

@ -1634,7 +1634,7 @@ else
*/
$nbrows=9; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) $nbcols++;
if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; }
// Local taxes
if ($societe->localtax1_assuj=="1") $nbrows++;
@ -1948,7 +1948,7 @@ else
print '<input type="hidden" name="lineid" value="'.$object->lines[$i]->rowid.'">';
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product)
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product > 0)
{
print '<input type="hidden" name="idprod" value="'.$object->lines[$i]->fk_product.'">';
$product_static=new ProductFournisseur($db);

View File

@ -21,8 +21,8 @@
/**
* \file htdocs/fourn/facture/note.php
* \ingroup facture
* \brief Fiche de notes sur une facture fournisseur
*/
* \brief Fiche de notes sur une facture fournisseur
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
@ -137,7 +137,7 @@ if ($object->id > 0)
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td>';
print '</td></tr>';
print "</table>";

View File

@ -7,21 +7,21 @@ DIRECTION=لیتر
FONTFORPDF=DejaVuSans
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=،
FormatDateShort=٪ M /٪ د /٪ Y
FormatDateShortInput=٪ M /٪ د /٪ Y
FormatDateShortJava=MM / DD / YYYY
FormatDateShortJavaInput=MM / DD / YYYY
FormatDateShortJQuery=ماه / روز / سا
FormatDateShortJQueryInput=ماه / روز / سا
FormatHourShort=٪ I:٪ M٪ P
FormatHourShortDuration=٪ H:٪ M
FormatDateTextShort=٪ B٪ د،٪ Y
FormatDateText=٪ B٪ د،٪ Y
FormatDateHourShort=٪ M /٪ د /٪ Y٪ I:٪ M٪ P
FormatDateHourSecShort=٪ M /٪ د /٪ Y٪ I:٪ M:٪ S٪ P
FormatDateHourTextShort=٪ B٪ د،٪ Y،٪ I:٪ M٪ P
FormatDateHourText=٪ B٪ د،٪ Y،٪ I:٪ M٪ P
SeparatorThousand=None
FormatDateShort=%m/%d/%Y
FormatDateShortInput=%m/%d/%Y
FormatDateShortJava=MM/dd/yyyy
FormatDateShortJavaInput=MM/dd/yyyy
FormatDateShortJQuery=yy/dd/mm
FormatDateShortJQueryInput=yy/dd/mm
FormatHourShort=%I:%M
FormatHourShortDuration=%H:%M
FormatDateTextShort=%b %d %Y
FormatDateText=%B %d %Y
FormatDateHourShort=%m/%d/%Y %I:%M:%S %p
FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
FormatDateHourTextShort=%b %d %Y %I:%M %p
FormatDateHourText=%B %d %Y %H:%M %p
DatabaseConnection=اتصال به پایگاه داده
NoTranslation=بدون ترجمه
NoRecordFound=هیچ سابقه ای پیدا نشد

View File

@ -606,8 +606,8 @@ class Livraison extends CommonObject
if ($result < 0)
{
$this->db->rollback();
return -4;
}
return -4;
}
// End call triggers
return 1;
@ -959,5 +959,3 @@ class LivraisonLigne
}
}
?>

View File

@ -112,7 +112,7 @@ class MailmanSpip
/**
* Function used to connect to Mailman
*
* @param object $object Object with the data
* @param Adherent $object Object with the data
* @param string $url Mailman URL to be called with patterns
* @param string $list Name of mailing-list
* @return mixed Boolean or string

View File

@ -25,14 +25,14 @@
/**
* Returns an array with the tabs for the "Opensurvey poll" section
* It loads tabs from modules looking for the entity Opensurveyso
*
*
* @param Opensurveysondage $object Current viewing poll
* @return array Tabs for the opensurvey section
*/
function opensurvey_prepare_head(Opensurveysondage $object) {
global $langs, $conf;
$h = 0;
$head = array();
@ -40,7 +40,7 @@ function opensurvey_prepare_head(Opensurveysondage $object) {
$head[0][1] = $langs->trans("Card");
$head[0][2] = 'general';
$h++;
$head[1][0] = 'results.php?id='.$object->id_sondage;
$head[1][1] = $langs->trans("SurveyResults");
$head[1][2] = 'preview';
@ -111,12 +111,12 @@ function showlogo()
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=thumbs/'.urlencode($mysoc->logo_small);
}
}
if (!$urllogo && (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')))
{
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
}
print '<div style="text-align:center"><img alt="Logo" id="logosubscribe" title="" src="'.$urllogo.'"/></div>';
print '<br>';
}
@ -205,14 +205,14 @@ function dol_survey_random($car)
function ajouter_sondage()
{
global $db, $user;
require_once DOL_DOCUMENT_ROOT.'/opensurvey/class/opensurveysondage.class.php';
$sondage=dol_survey_random(16);
$allow_comments = empty($_SESSION['allow_comments']) ? 0 : 1;
$allow_spy = empty($_SESSION['allow_spy']) ? 0 : 1;
// Insert survey
$opensurveysondage = new Opensurveysondage($db);
$opensurveysondage->id_sondage = $sondage;
@ -226,9 +226,9 @@ function ajouter_sondage()
$opensurveysondage->allow_comments = $allow_comments;
$opensurveysondage->allow_spy = $allow_spy;
$opensurveysondage->sujet = $_SESSION['toutchoix'];
$res = $opensurveysondage->create($user);
if ($res < 0) {
dol_print_error($db);
}
@ -243,11 +243,9 @@ function ajouter_sondage()
unset($_SESSION['toutchoix']);
unset($_SESSION['totalchoixjour']);
unset($_SESSION['champdatefin']);
$urlback=dol_buildpath('/opensurvey/card.php',1).'?id='.$sondage;
header("Location: ".$urlback);
exit();
}
?>

View File

@ -1078,4 +1078,3 @@ print '<a name="bas"></a>'."\n";
llxFooterSurvey();
$db->close();
?>

View File

@ -149,7 +149,7 @@ if ($mode == 'config' && $user->admin)
print $langs->trans("PRINTIPP_PASSWORD").'</td><td>';
print '<input size="32" type="text" name="PRINTIPP_PASSWORD" value="'.$conf->global->PRINTIPP_PASSWORD.'">';
print '</td></tr>';
//$var=true;
//print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("OtherParameter").'</td>';
@ -181,7 +181,7 @@ if ($mode == 'test' && $user->admin)
print '<td>Media</td>';
print '<td>Supported</td>';
print "</tr>\n";
$list = $printer->getlist_available_printers();
$var = true;
foreach ($list as $value)
@ -203,7 +203,7 @@ if ($mode == 'test' && $user->admin)
print "</tr>\n";
}
print '</table>';
if (count($list) == 0) print $langs->trans("NoPrinterFound");
}
@ -212,4 +212,3 @@ dol_fiche_end();
llxFooter();
$db->close();
?>

View File

@ -110,5 +110,3 @@ else
{
echo json_encode(array('nom'=>'ErrorBadParameter','label'=>'ErrorBadParameter','key'=>'ErrorBadParameter','value'=>'ErrorBadParameter'));
}
?>

View File

@ -705,5 +705,3 @@ abstract class ActionsCardCommon
}
}
?>

View File

@ -58,6 +58,7 @@ class Societe extends CommonObject
* @deprecated Use $name instead
*/
var $nom;
var $firstname;
var $lastname;
var $particulier;
@ -65,6 +66,7 @@ class Societe extends CommonObject
var $address;
var $zip;
var $town;
/**
* 0=activity ceased, 1= in activity
* @var int
@ -443,7 +445,7 @@ class Societe extends CommonObject
{
// Call trigger
$result=$this->call_trigger('COMPANY_CREATE',$user);
if ($result < 0) $error++;
if ($result < 0) $error++;
// End call triggers
}
else $error++;
@ -879,7 +881,7 @@ class Societe extends CommonObject
{
// Call trigger
$result=$this->call_trigger('COMPANY_MODIFY',$user);
if ($result < 0) $error++;
if ($result < 0) $error++;
// End call triggers
}
@ -1245,7 +1247,7 @@ class Societe extends CommonObject
// Call trigger
$result=$this->call_trigger('COMPANY_DELETE',$user);
if ($result < 0) $error++;
if ($result < 0) $error++;
// End call triggers
if (! $error)

View File

@ -338,4 +338,3 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -265,4 +265,3 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -183,4 +183,3 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
return $result;
}
}
?>

View File

@ -233,4 +233,3 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -257,4 +257,3 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
return;
}
}
?>

View File

@ -265,4 +265,3 @@ class ExportTest extends PHPUnit_Framework_TestCase
return true;
}
}
?>

View File

@ -131,7 +131,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
$localobjectinv=new Facture($this->savdb);
$localobjectinv->initAsSpecimen();
$localobjectinv->create($user);
$localobject=new FactureRec($this->savdb);
$localobject->initAsSpecimen();
$result=$localobject->create($user, $localobjectinv->id);
@ -141,11 +141,11 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
return $result;
}
/**
* Edit an object to test updates
*
@ -196,4 +196,3 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
return $retAr;
}
}
?>

View File

@ -329,4 +329,3 @@ class FactureTest extends PHPUnit_Framework_TestCase
return $retAr;
}
}
?>

View File

@ -154,23 +154,41 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
$this->assertEquals(0,$result);
}
/**
* is_ip
*
* @return void
*/
public function testIsIp() {
/**
* isIP
*
* @return void
*/
public function testIsIP()
{
$ip='a299.299.299.299';
$result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(0,$result,$ip);
//Test not valid IP
$result = is_ip('192.168.1.267');
$this->assertEquals(0, $result);
$ip='1.2.3.4';
$result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(1,$result,$ip);
//Test private range IP
$result = is_ip('192.168.1.1');
$this->assertEquals(2, $result);
$ip='10.0.0.0';
$result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(2,$result,$ip);
//Test public range IP
$result = is_ip('91.121.33.228');
$this->assertEquals(1, $result);
}
$ip='172.16.0.0';
$result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(2,$result,$ip);
$ip='192.168.0.0';
$result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(2,$result,$ip);
$ip='169.254.0.0';
$result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(2,$result,$ip);
}
}

View File

@ -784,4 +784,3 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -146,7 +146,7 @@ class LangTest extends PHPUnit_Framework_TestCase
{
if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
print 'Check language file for code='.$code."\n";
print 'Check language file for lang code='.$code."\n";
$tmplangs=new Translate('',$conf);
$langcode=$code;
$tmplangs->setDefaultLang($langcode);
@ -154,19 +154,19 @@ class LangTest extends PHPUnit_Framework_TestCase
$result=$tmplangs->trans("SeparatorDecimal");
print __METHOD__." SeparatorDecimal=".$result."\n";
$this->assertContains($result,array('.',',','/',' ','','None'), 'Error for code '.$code);
$this->assertContains($result,array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported
$result=$tmplangs->trans("SeparatorThousand");
print __METHOD__." SeparatorThousand=".$result."\n";
$this->assertContains($result, array('.',',','/',' ','','None','Space'), 'Error for code '.$code);
$this->assertContains($result, array('.',',','/',' ','','None','Space'), 'Error for thousand separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported
// Test java string contains only d,M,y,/,-,. and not m,...
$result=$tmplangs->trans("FormatDateShortJava");
print __METHOD__." FormatDateShortJava=".$result."\n";
$this->assertRegExp('/^[dMy\/\-\.]+$/',$result);
$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava');
$result=$tmplangs->trans("FormatDateShortJavaInput");
print __METHOD__." FormatDateShortJavaInput=".$result."\n";
$this->assertRegExp('/^[dMy\/\-\.]+$/',$result);
$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput');
unset($tmplangs);
}

View File

@ -265,4 +265,3 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -456,4 +456,3 @@ class SocieteTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -318,4 +318,3 @@ class UserTest extends PHPUnit_Framework_TestCase
return $retAr;
}
}
?>

View File

@ -181,4 +181,3 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
}
}
?>

View File

@ -181,4 +181,3 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
}
}
?>