fix typo inspired by grandoc

This commit is contained in:
Frédéric FRANCE 2019-10-11 23:08:33 +02:00
parent dfaf2ae34b
commit 9f59656589
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
6 changed files with 57 additions and 57 deletions

View File

@ -58,7 +58,7 @@ foreach my $file (keys %filelist) {
$ARGV[1]="$DESTI/$file";
print "Convert file $ARGV[0] into $ARGV[1]\n";
# MySQL to PostgreSQL dump file converter
#
# For usage: perl mysql2pgsql.perl --help
@ -76,18 +76,18 @@ foreach my $file (keys %filelist) {
# 4) add debug option
# see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql
# 2003-12-16 jsp -- Joe Speigle <joe.speigle@jklh.us>:
# converts: s/\) *Type=MyISAM;/);/i, enum data type -> references,
# converts: s/\) *Type=MyISAM;/);/i, enum data type -> references,
# auto_increment->sequences
# 2004-01-13 jsp -- moved project to gborg; both the above declined ownership
# 2004-06-29 converts: year(4), year(2)
# homepage: gborg.postgresql.org
# homepage: gborg.postgresql.org
GetOptions("debug", "help");
my $DEBUG = $opt_debug || 0;
my $HELP = $opt_help || 0;
if (($HELP) || ! defined($ARGV[0]) || ! defined($ARGV[1])) {
print "Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n";
print "\t* OPTIONS\n";
@ -106,15 +106,15 @@ foreach my $file (keys %filelist) {
print "\tpg_dump_file.sql (undefined)\n";
}
exit 1;
}
}
open(IN,"<$ARGV[0]") || die "can't open mysql dump file $ARGV[0]";
open(OUT,">$ARGV[1]") || die "can't open pg dump file $ARGV[1]";
print OUT "-- Generated by $PROG\n";
print OUT "-- (c) 2004, PostgreSQL Inc.\n";
print OUT "-- (c) 2005, Laurent Destailleur.\n";
print OUT "\n";
# Output for create table and create index
sub output_create {
# If command ends with "xxx,);", we change to "xxx);"
@ -128,7 +128,7 @@ foreach my $file (keys %filelist) {
print OUT $create_index;
}
}
# Reset when moving from each "create table" to "insert" part of dump
sub reset_vars() {
$create_sql="";
@ -137,24 +137,24 @@ foreach my $file (keys %filelist) {
$enum_column='';
}
# Boucle sur contenu fichier source
#----------------------------------
while(<IN>) {
# comments or empty lines
if (/^-- \$Id/) {
if (/^-- \$Id/) {
$_ =~ s/\$//g;
print OUT $_;
print OUT $_;
next;
}
# comments or empty lines
if (/^#/ || /^$/ || /^--/) {
print OUT $_;
print OUT $_;
next;
}
if (/^USE\s*([^;]*);/) {
print OUT "\\c ". $1;
if (/^USE\s*([^;]*);/) {
print OUT "\\c ". $1;
next;
}
if ($create_sql ne "") { # we are inside create table statement so lets process datatypes
@ -167,14 +167,14 @@ foreach my $file (keys %filelist) {
# LDR Added "innodb" and "engine"
}
elsif (/(ISAM|innodb)/i) { # end of create table sequence
s/\) *type=(MyISAM|innodb);/);/i;
s/\) *engine=(MyISAM|innodb);/);/i;
s/\) *type=(MyISAM|innodb);/);/i;
s/\) *engine=(MyISAM|innodb);/);/i;
$create_sql =~ s/,$//g; # strip last , inside create table
$create_sql .= $_;
&output_create;
&reset_vars();
next;
}
}
# enum -> check
if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) {
@ -189,7 +189,7 @@ foreach my $file (keys %filelist) {
$enum_datafield{$enum_column} =~ s/\"/\'/g;
$_ = qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~;
# int, auto_increment -> serial
} elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
} elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
$seq = qq~${table}_${1}_seq~;
s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
$create_sql.=$_;
@ -211,40 +211,40 @@ foreach my $file (keys %filelist) {
elsif (/tinyint/i) {
s/tinyint/smallint/g;
}
# nuke unsigned
s/(int\w+|smallint)\s+unsigned/$1/gi;
# blob -> text
s/\w*blob/text/gi;
# tinytext/mediumtext -> text
s/tinytext/text/gi;
s/mediumtext/text/gi;
# char -> varchar
# PostgreSQL would otherwise pad with spaces as opposed
# to MySQL! Your user interface may depend on this!
s/(\s+)char/${1}varchar/gi;
# nuke date representation (not supported in PostgreSQL)
s/datetime default '[^']+'/datetime/i;
s/date default '[^']+'/datetime/i;
s/time default '[^']+'/datetime/i;
# change not null datetime field to null valid ones
# (to support remapping of "zero time" to null
s/datetime not null/datetime/i;
s/datetime/timestamp/i;
# nuke size of timestamp
s/timestamp\([^)]*\)/timestamp/i;
# double -> numeric
s/^double/numeric/i;
s/(\s*)double/${1}numeric/i;
# float -> numeric
s/^float/numeric/i;
s/(\s*)float/${1}numeric/i;
@ -261,7 +261,7 @@ foreach my $file (keys %filelist) {
$create_sql.=$_;
next;
}
# unique key [name] (field)
if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
@ -288,30 +288,30 @@ foreach my $file (keys %filelist) {
$create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n";
next;
}
# index(field)
if (/index\s*(\w*)\s*\((\w+)\)/i) {
my $idxname=($1?"$1":"idx_${table}_$2");
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
# primary key
if (/\bkey\b/i && !/^\s+primary key\s+/i) {
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key
}
# key(xxx)
if (/key\s*\((\w+)\)/i) {
my $idxname="idx_${table}_$1";
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
next;
}
# Quote column names
s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
# Remap colums with names of existing system attribute
# Remap columns with names of existing system attribute
if (/"oid"/i) {
s/"oid"/"_oid"/g;
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
@ -330,13 +330,13 @@ foreach my $file (keys %filelist) {
s!\x85!... !g; # \ldots
s!\x92!`!g;
}
# fix dates '0000-00-00 00:00:00' (should be null)
s/'0000-00-00 00:00:00'/null/gi;
s/'0000-00-00'/null/gi;
s/'00:00:00'/null/gi;
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
if (/create\s+table\s+(\w+)/i) {
$create_sql = $_;
/create\s*table\s*(\w+)/i;
@ -345,11 +345,11 @@ foreach my $file (keys %filelist) {
print OUT $_;
}
} # end of if inside create_table
} # END while(<IN>)
} # END while(<IN>)
close IN;
close OUT;
}
print "\n";
@ -358,4 +358,4 @@ print "\n";
print "Press a key to finish...\n";
$stop=<STDIN>;
0;
0;

View File

@ -1282,7 +1282,7 @@ class Adherent extends CommonObject
$this->societe = $obj->company;
$this->company = $obj->company;
$this->socid = $obj->fk_soc;
$this->fk_soc = $obj->fk_soc; // For backward comaptibility
$this->fk_soc = $obj->fk_soc; // For backward compatibility
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;

View File

@ -416,7 +416,7 @@ if ($resql)
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
$formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '</td>';
}
// Date next generation
@ -425,7 +425,7 @@ if ($resql)
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
$formother->select_year($search_year_date_when?$search_year_date_when:-1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
$formother->select_year($search_year_date_when?$search_year_date_when:-1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '</td>';
}
// Extra fields

View File

@ -63,7 +63,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple subtitution key => subtitution value
* Define array with couple substitution key => substitution value
*
* @param User $user User
* @param Translate $outputlangs Language object for output
@ -101,7 +101,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple subtitution key => subtitution value
* Define array with couple substitution key => substitution value
*
* @param Societe $mysoc Object thirdparty
* @param Translate $outputlangs Language object for output
@ -161,7 +161,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple subtitution key => subtitution value
* Define array with couple substitution key => substitution value
*
* @param Societe $object Object
* @param Translate $outputlangs Language object for output
@ -242,7 +242,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple subtitution key => subtitution value
* Define array with couple substitution key => substitution value
*
* @param Contact $object contact
* @param Translate $outputlangs object for output
@ -723,7 +723,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple subtitution key => subtitution value
* Define array with couple substitution key => substitution value
*
* @param Object $object Dolibarr Object
* @param Translate $outputlangs Language object for output

View File

@ -1625,7 +1625,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
*/
/**
* uasort callback function to Sort colums fields
* uasort callback function to Sort columns fields
*
* @param array $a PDF lines array fields configs
* @param array $b PDF lines array fields configs
@ -1663,7 +1663,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Positionning
$curX = $this->page_largeur-$this->marge_droite; // start from right
// Array witdh
// Array width
$arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche;
// Count flexible column
@ -1671,7 +1671,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$countFlexCol = 0;
foreach ($this->cols as $colKey => &$colDef)
{
if (!$this->getColumnStatus($colKey)) continue; // continue if desable
if (!$this->getColumnStatus($colKey)) continue; // continue if disabled
if (!empty($colDef['scale'])){
// In case of column widht is defined by percentage

View File

@ -2010,7 +2010,7 @@ Licensed under the MIT license.
ctx.lineTo(xrange.to + subPixel, yrange.to);
} else {
ctx.moveTo(xrange.from, yrange.to + subPixel);
ctx.lineTo(xrange.to, yrange.to + subPixel);
ctx.lineTo(xrange.to, yrange.to + subPixel);
}
ctx.stroke();
} else {
@ -2525,9 +2525,9 @@ Licensed under the MIT license.
radius = series.points.radius,
symbol = series.points.symbol;
// If the user sets the line width to 0, we change it to a very
// If the user sets the line width to 0, we change it to a very
// small value. A line width of 0 seems to force the default of 1.
// Doing the conditional here allows the shadow setting to still be
// Doing the conditional here allows the shadow setting to still be
// optional even with a lineWidth of 0.
if( lw == 0 )