Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
dc547cbb
Commit
dc547cbb
authored
14 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Function to find last invoice must look only into number
parent
09fc3ba4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/langs/en_US/bills.lang
+3
-0
3 additions, 0 deletions
htdocs/langs/en_US/bills.lang
htdocs/lib/functions2.lib.php
+857
-817
857 additions, 817 deletions
htdocs/lib/functions2.lib.php
with
860 additions
and
817 deletions
htdocs/langs/en_US/bills.lang
+
3
−
0
View file @
dc547cbb
...
...
@@ -3,13 +3,16 @@ CHARSET=UTF-8
Bill=Invoice
Bills=Invoices
BillsCustomers=Customer's invoices
BillsCustomer=Customer's invoice
BillsSuppliers=Supplier's invoices
BillsCustomersUnpaid=Unpaid customer's invoices
BillsCustomersUnpaidForCompany=Unpaid customer's invoices for %s
BillsSuppliersUnpaid=Unpaid supplier's invoices
BillsUnpaid=Unpaid
BillsLate=Late payments
BillsStatistics=Customer's invoices statistics
BillsStatisticsSuppliers=Supplier's invoices statistics
DisabledBecauseNotErasable=Disabled because can not be erased
InvoiceStandard=Standard invoice
InvoiceStandardAsk=Standard invoice
InvoiceStandardDesc=This kind of invoice is the common invoice.
...
...
This diff is collapsed.
Click to expand it.
htdocs/lib/functions2.lib.php
+
857
−
817
View file @
dc547cbb
...
...
@@ -350,9 +350,10 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
* @param $where To add a filter on selection (for exemple to filter on invoice types)
* @param $objsoc The company that own the object we need a counter for
* @param $date Date to use for the {y},{m},{d} tags.
* @param $mode 'next' for next value or 'last' for last value
* @return string New value
*/
function
get_next_value
(
$db
,
$mask
,
$table
,
$field
,
$where
=
''
,
$objsoc
=
''
,
$date
=
''
)
function
get_next_value
(
$db
,
$mask
,
$table
,
$field
,
$where
=
''
,
$objsoc
=
''
,
$date
=
''
,
$mode
=
'next'
)
{
global
$conf
;
...
...
@@ -490,6 +491,44 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
}
else
dol_print_error
(
$db
);
if
(
empty
(
$counter
)
||
preg_match
(
'/[^0-9]/i'
,
$counter
))
$counter
=
$maskoffset
;
if
(
$mode
==
'last'
)
{
$counterpadded
=
str_pad
(
$counter
,
dol_strlen
(
$maskcounter
),
"0"
,
STR_PAD_LEFT
);
// Define $maskLike
$maskLike
=
dol_string_nospecial
(
$mask
);
$maskLike
=
str_replace
(
"%"
,
"_"
,
$maskLike
);
// Replace protected special codes with matching number of _ as wild card caracter
$maskLike
=
preg_replace
(
'/\{yyyy\}/i'
,
'____'
,
$maskLike
);
$maskLike
=
preg_replace
(
'/\{yy\}/i'
,
'__'
,
$maskLike
);
$maskLike
=
preg_replace
(
'/\{y\}/i'
,
'_'
,
$maskLike
);
$maskLike
=
preg_replace
(
'/\{mm\}/i'
,
'__'
,
$maskLike
);
$maskLike
=
preg_replace
(
'/\{dd\}/i'
,
'__'
,
$maskLike
);
$maskLike
=
str_replace
(
dol_string_nospecial
(
'{'
.
$masktri
.
'}'
),
$counterpadded
,
$maskLike
);
if
(
$maskrefclient
)
$maskLike
=
str_replace
(
dol_string_nospecial
(
'{'
.
$maskrefclient
.
'}'
),
str_pad
(
""
,
dol_strlen
(
$maskrefclient
),
"_"
),
$maskLike
);
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
if
(
$masktype
)
$maskLike
=
str_replace
(
dol_string_nospecial
(
'{'
.
$masktype
.
'}'
),
$masktype_value
,
$maskLike
);
$ref
=
''
;
$sql
=
"SELECT facnumber as ref"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"facture"
;
$sql
.
=
" WHERE facnumber LIKE '"
.
$maskLike
.
"'"
;
$sql
.
=
" AND entity = "
.
$conf
->
entity
;
dol_syslog
(
"mod_facture_terre::getNextValue sql="
.
$sql
);
$resql
=
$db
->
query
(
$sql
);
if
(
$resql
)
{
$obj
=
$db
->
fetch_object
(
$resql
);
if
(
$obj
)
$ref
=
$obj
->
ref
;
}
else
dol_print_error
(
$db
);
$numFinal
=
$ref
;
}
else
if
(
$mode
==
'next'
)
{
$counter
++
;
if
(
$maskrefclient_maskcounter
)
...
...
@@ -569,6 +608,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$masktype_maskafter
=
$masktype_value
;
$numFinal
=
str_replace
(
$masktype_maskbefore
,
$masktype_maskafter
,
$numFinal
);
}
}
dol_syslog
(
"functions2::get_next_value return "
.
$numFinal
,
LOG_DEBUG
);
return
$numFinal
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment