trim trailing
This commit is contained in:
parent
526ea496ee
commit
b90d125fda
@ -21,7 +21,7 @@
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-product.php
|
||||
* \brief Script example to insert products from a csv file.
|
||||
* \brief Script example to insert products from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
|
||||
@ -118,22 +118,22 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
{
|
||||
$i++;
|
||||
$errorrecord=0;
|
||||
|
||||
|
||||
if ($startlinenb && $i < $startlinenb) continue;
|
||||
if ($endlinenb && $i > $endlinenb) continue;
|
||||
|
||||
|
||||
$nboflines++;
|
||||
|
||||
|
||||
$produit = new Product($db);
|
||||
$produit->type = 0;
|
||||
$produit->status = 1;
|
||||
$produit->ref = trim($fields[0]);
|
||||
|
||||
|
||||
print "Process line nb ".$i.", ref ".$produit->ref;
|
||||
$produit->label = trim($fields[2]);
|
||||
$produit->description = trim($fields[4]."\n".($fields[5] ? $fields[5].' x '.$fields[6].' x '.$fields[7] : ''));
|
||||
$produit->volume = price2num($fields[8]);
|
||||
$produit->volume_unit = 0;
|
||||
$produit->volume_unit = 0;
|
||||
$produit->weight = price2num($fields[9]);
|
||||
$produit->weight_units = 0; // -3 = g
|
||||
|
||||
@ -142,9 +142,9 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
|
||||
$produit->status = 1;
|
||||
$produit->status_buy = 1;
|
||||
|
||||
|
||||
$produit->finished = 1;
|
||||
|
||||
|
||||
$produit->price_min = null;
|
||||
$produit->price_min_ttc = null;
|
||||
$produit->price = price2num($fields[11]);
|
||||
@ -152,25 +152,25 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
$produit->price_base_type = 'TTC';
|
||||
$produit->tva_tx = price2num($fields[13]);
|
||||
$produit->tva_npr = 0;
|
||||
|
||||
|
||||
$produit->cost_price = price2num($fields[16]);
|
||||
|
||||
|
||||
// Extrafields
|
||||
$produit->array_options['options_ecotaxdeee']=price2num($fields[17]);
|
||||
|
||||
|
||||
$ret=$produit->create($user);
|
||||
if ($ret < 0)
|
||||
{
|
||||
print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print " - Creation OK with ref ".$produit->ref." - id = ".$ret;
|
||||
}
|
||||
|
||||
dol_syslog("Add prices");
|
||||
|
||||
|
||||
// If we use price level, insert price for each level
|
||||
if (! $errorrecord && 1)
|
||||
{
|
||||
@ -181,14 +181,14 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print " - updatePrice OK";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("Add multilangs");
|
||||
|
||||
|
||||
// Add alternative languages
|
||||
if (! $errorrecord && 1)
|
||||
{
|
||||
@ -201,15 +201,15 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print " - setMultiLangs OK";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "\n";
|
||||
|
||||
if ($errorrecord)
|
||||
|
||||
if ($errorrecord)
|
||||
{
|
||||
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$produit->errorsToString()."\n");
|
||||
$error++; // $errorrecord will be reset
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-thirdparties.php
|
||||
* \brief Script example to insert thirdparties from a csv file.
|
||||
* \brief Script example to insert thirdparties from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
|
||||
@ -118,15 +118,15 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
{
|
||||
$i++;
|
||||
$errorrecord=0;
|
||||
|
||||
|
||||
if ($startlinenb && $i < $startlinenb) continue;
|
||||
if ($endlinenb && $i > $endlinenb) continue;
|
||||
|
||||
|
||||
$nboflines++;
|
||||
|
||||
|
||||
$object = new User($db);
|
||||
$object->statut = 1;
|
||||
|
||||
|
||||
$tmp=explode(' ',$fields[3],2);
|
||||
$object->firstname = trim($tmp[0]);
|
||||
$object->lastname = trim($tmp[1]);
|
||||
@ -134,23 +134,23 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
else $object->login=strtolower($object->firstname);
|
||||
$object->login=preg_replace('/ /','',$object->login);
|
||||
$object->password = 'init';
|
||||
|
||||
|
||||
print "Process line nb ".$i.", login ".$object->login;
|
||||
|
||||
|
||||
$ret=$object->create($user);
|
||||
if ($ret < 0)
|
||||
{
|
||||
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print " - Creation OK with login ".$object->login." - id = ".$ret;
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
if ($errorrecord)
|
||||
|
||||
if ($errorrecord)
|
||||
{
|
||||
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
|
||||
$error++; // $errorrecord will be reset
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
*
|
||||
* Get a distant dump file and load it into a mysql database
|
||||
*/
|
||||
|
||||
@ -74,7 +74,7 @@ $tables=array(
|
||||
|
||||
$year=2010;
|
||||
$currentyear=$tmp['year'];
|
||||
while ($year <= $currentyear)
|
||||
while ($year <= $currentyear)
|
||||
{
|
||||
//$year=2021;
|
||||
$delta=($currentyear - $year);
|
||||
@ -84,7 +84,7 @@ while ($year <= $currentyear)
|
||||
{
|
||||
foreach($tables as $tablekey => $tableval)
|
||||
{
|
||||
print "\nCorrect ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
|
||||
print "\nCorrect ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
|
||||
$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
|
||||
//$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()";
|
||||
$resql = $db->query($sql);
|
||||
@ -110,14 +110,14 @@ while ($year <= $currentyear)
|
||||
//print $sql2."\n";
|
||||
$resql2 = $db->query($sql2);
|
||||
if (! $resql2) dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$year++;
|
||||
}
|
||||
|
||||
|
||||
@ -84,11 +84,11 @@ if (empty($template_id)) {
|
||||
$result = $advTarget->fetch($template_id);
|
||||
}
|
||||
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($advTarget->id)) {
|
||||
$array_query = json_decode($advTarget->filtervalue, true);
|
||||
@ -225,7 +225,7 @@ if ($action == 'add') {
|
||||
} else {
|
||||
$advTarget->contact_lines = array ();
|
||||
}
|
||||
|
||||
|
||||
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
||||
// Add targets into database
|
||||
$obj = new mailing_advthirdparties($db);
|
||||
@ -359,7 +359,7 @@ if ($action == 'savefilter' || $action == 'createfilter') {
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'savefilter') {
|
||||
|
||||
|
||||
$result = $advTarget->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
@ -465,9 +465,9 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
// Show email selectors
|
||||
if ($object->statut == 0 && $user->rights->mailing->creer) {
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
|
||||
print '<a class="objectlinked_importbtn" href="'.$url.'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
|
||||
print '<a class="objectlinked_importbtn" href="'.$url.'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
* <dol_cut_paper_partial> Cut ticket partially
|
||||
* <dol_open_drawer> Open cash drawer
|
||||
* <dol_activate_buzzer> Activate buzzer
|
||||
*
|
||||
*
|
||||
* Code which can be placed everywhere
|
||||
* <dol_print_qrcode> Print QR Code
|
||||
* <dol_print_date> Print date AAAA-MM-DD
|
||||
@ -94,7 +94,7 @@
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/Escpos.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage Receipt Printers
|
||||
*/
|
||||
@ -300,16 +300,16 @@ class dolReceiptPrinter extends Escpos
|
||||
function selectTypePrinter($selected='', $htmlname='printertypeid')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$options = array(
|
||||
1 => $langs->trans('CONNECTOR_DUMMY'),
|
||||
2 => $langs->trans('CONNECTOR_FILE_PRINT'),
|
||||
3 => $langs->trans('CONNECTOR_NETWORK_PRINT'),
|
||||
4 => $langs->trans('CONNECTOR_WINDOWS_PRINT')
|
||||
);
|
||||
|
||||
|
||||
$this->resprint = Form::selectarray($htmlname, $options, $selected);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ class dolReceiptPrinter extends Escpos
|
||||
function selectProfilePrinter($selected='', $htmlname='printerprofileid')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$options = array(
|
||||
0 => $langs->trans('PROFILE_DEFAULT'),
|
||||
1 => $langs->trans('PROFILE_SIMPLE'),
|
||||
@ -332,7 +332,7 @@ class dolReceiptPrinter extends Escpos
|
||||
3 => $langs->trans('PROFILE_P822D'),
|
||||
4 => $langs->trans('PROFILE_STAR')
|
||||
);
|
||||
|
||||
|
||||
$this->profileresprint = Form::selectarray($htmlname, $options, $selected);
|
||||
return 0;
|
||||
}
|
||||
@ -520,11 +520,11 @@ class dolReceiptPrinter extends Escpos
|
||||
$ret = $this->InitPrinter($printerid);
|
||||
if ($ret>0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$nboflines = count($vals);
|
||||
for ($line=0; $line < $nboflines; $line++)
|
||||
for ($line=0; $line < $nboflines; $line++)
|
||||
{
|
||||
switch ($vals[$line]['tag']) {
|
||||
case 'DOL_ALIGN_CENTER':
|
||||
|
||||
@ -84,7 +84,7 @@ abstract class DolibarrTriggers
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($this->name))
|
||||
if (empty($this->name))
|
||||
{
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ $total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -66,7 +66,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ if ($_POST) {
|
||||
|
||||
$res = 1;
|
||||
|
||||
foreach (cartesianArray($adapted_values) as $currcomb)
|
||||
foreach (cartesianArray($adapted_values) as $currcomb)
|
||||
{
|
||||
$res = $combination->createProductCombination($product, $currcomb, $sanitized_values, $price_var_percent);
|
||||
if ($res < 0) {
|
||||
@ -146,17 +146,17 @@ if (! empty($id) || ! empty($ref)) {
|
||||
{
|
||||
$showbarcode=empty($conf->barcode->enabled)?0:1;
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
|
||||
|
||||
|
||||
$head=product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'combinations', $titre, 0, $picto);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
|
||||
$object->next_prev_filter=" fk_product_type = ".$object->type;
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@ -375,4 +375,4 @@ if (! empty($id) || ! empty($ref)) {
|
||||
<?php
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* testChargeSocialesCreate
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testChargeSocialesCreate()
|
||||
@ -139,10 +139,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* testChargeSocialesFetch
|
||||
*
|
||||
*
|
||||
* @param int $id Id of social contribution
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @depends testChargeSocialesCreate
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
@ -164,10 +164,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* testChargeSocialesValid
|
||||
*
|
||||
*
|
||||
* @param Object $localobject Social contribution
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @depends testChargeSocialesFetch
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
@ -188,10 +188,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* testChargeSocialesOther
|
||||
*
|
||||
*
|
||||
* @param Object $localobject Social contribution
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @depends testChargeSocialesValid
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
@ -216,10 +216,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* testChargeSocialesDelete
|
||||
*
|
||||
*
|
||||
* @param int $id Social contribution
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @depends testChargeSocialesOther
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user