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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
32731ebd
Commit
32731ebd
authored
20 years ago
by
Rodolphe Quiedeville
Browse files
Options
Downloads
Patches
Plain Diff
Nouveau fichier
parent
b4d79ab2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/prelevement-verif.php
+144
-0
144 additions, 0 deletions
scripts/prelevement-verif.php
with
144 additions
and
0 deletions
scripts/prelevement-verif.php
0 → 100644
+
144
−
0
View file @
32731ebd
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*
* Script de verification des demandes de prlvement
*
* Vrifie que les socits qui doivent tre prleves ont bien un RIB correct
*
*/
require
(
"../htdocs/master.inc.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/facture.class.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/societe.class.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/lib/dolibarrmail.class.php"
);
$error
=
0
;
/*
*
* Lectures des factures a prlever
*
*/
$factures
=
array
();
$factures_prev
=
array
();
if
(
!
$error
)
{
$sql
=
"SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"facture as f"
;
$sql
.
=
" , "
.
MAIN_DB_PREFIX
.
"prelevement_facture_demande as pfd"
;
$sql
.
=
" WHERE f.fk_statut = 1"
;
$sql
.
=
" AND f.rowid = pfd.fk_facture"
;
$sql
.
=
" AND f.paye = 0"
;
$sql
.
=
" AND pfd.traite = 0"
;
$sql
.
=
" AND f.total_ttc > 0"
;
$sql
.
=
" AND f.fk_mode_reglement = 3"
;
if
(
$db
->
query
(
$sql
)
)
{
$num
=
$db
->
num_rows
();
$i
=
0
;
while
(
$i
<
$num
)
{
$row
=
$db
->
fetch_row
();
$factures
[
$i
]
=
$row
;
$i
++
;
}
$db
->
free
();
dolibarr_syslog
(
"
$i
factures prlever"
);
}
else
{
$error
=
1
;
dolibarr_syslog
(
"Erreur -1"
);
dolibarr_syslog
(
$db
->
error
());
}
}
/*
*
* Vrification des clients
*
*/
if
(
!
$error
)
{
/*
* Vrification des RIB
*
*/
$i
=
0
;
dolibarr_syslog
(
"Dbut vrification des RIB"
);
if
(
sizeof
(
$factures
)
>
0
)
{
foreach
(
$factures
as
$fac
)
{
$fact
=
new
Facture
(
$db
);
if
(
$fact
->
fetch
(
$fac
[
0
])
==
1
)
{
$soc
=
new
Societe
(
$db
);
if
(
$soc
->
fetch
(
$fact
->
socidp
)
==
1
)
{
if
(
$soc
->
verif_rib
()
==
1
)
{
$factures_prev
[
$i
]
=
$fac
;
$i
++
;
}
else
{
dolibarr_syslog
(
"Erreur de RIB societe
$fact->socidp
$soc->nom
"
);
}
}
else
{
dolibarr_syslog
(
"Impossible de lire la socit"
);
}
}
else
{
dolibarr_syslog
(
"Impossible de lire la facture"
);
}
}
}
else
{
dolibarr_syslog
(
"Aucune factures a traiter"
);
}
}
dolibarr_syslog
(
sizeof
(
$factures_prev
)
.
" factures sur "
.
sizeof
(
$factures
)
.
" seront prleves"
);
$db
->
close
();
?>
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