Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApiAlma
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
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
Rachid Aliouat
ApiAlma
Commits
19d96e34
Commit
19d96e34
authored
1 year ago
by
Rachid Aliouat
Browse files
Options
Downloads
Patches
Plain Diff
creer_portfolio - ajout note public depuis 856z
parent
8cc8f53b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gestion_des_portfolios/creer_portfolios.pl
+23
-4
23 additions, 4 deletions
gestion_des_portfolios/creer_portfolios.pl
with
23 additions
and
4 deletions
gestion_des_portfolios/creer_portfolios.pl
+
23
−
4
View file @
19d96e34
...
@@ -8,13 +8,15 @@
...
@@ -8,13 +8,15 @@
# Le portfolio est créer selon le modéle du fichier modele-portfolio.xml : ce fichier contient 2 motifs à remplacer
# Le portfolio est créer selon le modéle du fichier modele-portfolio.xml : ce fichier contient 2 motifs à remplacer
# avant le post : [MMS_ID] et [URL]
# avant le post : [MMS_ID] et [URL]
# 09-02-2023 : ajout cas csv multicolonne : le fichier csv peut avoir plusieurs colonne , c'est la 1er qui contient le mms_id
# 09-02-2023 : ajout cas csv multicolonne : le fichier csv peut avoir plusieurs colonne , c'est la 1er qui contient le mms_id
# 25/09/2023 : ajout 856$z dans "note public"
##############################
##############################
use
strict
;
use
strict
;
use
warnings
;
use
warnings
;
use
LWP::
UserAgent
;
# bibliothèque pour les webservice
use
LWP::
UserAgent
;
# bibliothèque pour les webservice
use
XML::
Twig
;
# bibliothèque pour le XML
use
XML::
Twig
;
# bibliothèque pour le XML
use
URI::
Encode
qw(uri_encode uri_decode)
;;
#encoder decoder les URL - requiert la bibliotheque liburi-encode-perl
use
URI::
Encode
qw(uri_encode uri_decode)
;;
#encoder decoder les URL - requiert la bibliotheque liburi-encode-perl
use
utf8
;
use
Encode
;
my
$nom_fic_csv
=
"";
my
$nom_fic_csv
=
"";
my
%hash_conf
=
();
my
%hash_conf
=
();
...
@@ -102,10 +104,13 @@ for ($i;$i<=$#tab_inter;$i++) {
...
@@ -102,10 +104,13 @@ for ($i;$i<=$#tab_inter;$i++) {
{
{
my
$tag
=
$un_datafield
->
{'
att
'}
->
{'
tag
'};
my
$tag
=
$un_datafield
->
{'
att
'}
->
{'
tag
'};
if
(
$tag
==
"
856
")
{
# on est dans le bon datafield
if
(
$tag
==
"
856
")
{
# on est dans le bon datafield
print
"
\n
##### 856 #######
\n
";
print
"
\n
##### 856 #######
\n
";
#print $un_datafield->sprint;
#print $un_datafield->sprint;
#print "\n############\n";
#print "\n############\n";
my
$url
=
"";
my
$note_public
=
"";
my
@les_subfield
=
$un_datafield
->
children
('
subfield
');
### on récuperer une table de hash de tous les "enfants"
my
@les_subfield
=
$un_datafield
->
children
('
subfield
');
### on récuperer une table de hash de tous les "enfants"
foreach
my
$un_subfield
(
@les_subfield
)
# liste chaque datafield de la liste
foreach
my
$un_subfield
(
@les_subfield
)
# liste chaque datafield de la liste
{
{
...
@@ -113,12 +118,23 @@ for ($i;$i<=$#tab_inter;$i++) {
...
@@ -113,12 +118,23 @@ for ($i;$i<=$#tab_inter;$i++) {
#print $code,"\n";
#print $code,"\n";
if
(
$code
=~
/^u$/
)
{
# on est dans le bon subfield
if
(
$code
=~
/^u$/
)
{
# on est dans le bon subfield
print
"
\n\t
##### sous champ u #######
\n
";
print
"
\n\t
##### sous champ u #######
\n
";
print
"
\t
"
.
$un_subfield
->
text
()
.
"
\n
";
$url
=
$un_subfield
->
text
();
#print "\t".$un_subfield->text()."\n";
$tab_mms_id_url
{"
[
"
.
$mms_id
.
"
][
"
.
$un_subfield
->
text
()
.
"
]
"}
++
;
print
"
\t
"
.
$url
.
"
\n
";
ecrire_log
(
$mms_id
,
$un_subfield
->
text
());
#$tab_mms_id_url{"[".$mms_id."][".$un_subfield->text()."]"}="";
$tab_mms_id_url
{"
[
"
.
$mms_id
.
"
][
"
.
$url
.
"
]
"}
=
"";
#ecrire_log($mms_id,$un_subfield->text());
ecrire_log
(
$mms_id
,
$url
);
$nbr_portfolios
++
;
$nbr_portfolios
++
;
}
}
if
(
$code
=~
/^z$/
)
{
# on est dans le bon subfield
print
"
\n\t
##### sous champ z #######
\n
";
$note_public
=
$un_subfield
->
text
();
print
"
\t
"
.
$note_public
.
"
\n
";
$tab_mms_id_url
{"
[
"
.
$mms_id
.
"
][
"
.
$url
.
"
]
"}
=
$note_public
;
}
}
}
}
}
}
}
...
@@ -194,16 +210,19 @@ print "######\n";
...
@@ -194,16 +210,19 @@ print "######\n";
my
$c
=
"";
my
$c
=
"";
my
$url
=
"";
my
$url
=
"";
my
$note_public
=
"";
my
$portfolio_a_creer
=
"";
my
$portfolio_a_creer
=
"";
foreach
$c
(
sort
keys
%tab_mms_id_url
)
{
foreach
$c
(
sort
keys
%tab_mms_id_url
)
{
print
$c
,"
\n
";
print
$c
,"
\n
";
$c
=~
/\[(.*)\]\[(.*)\]/
;
$c
=~
/\[(.*)\]\[(.*)\]/
;
$mms_id
=
$
1
;
$mms_id
=
$
1
;
$url
=
$
2
;
$url
=
$
2
;
$note_public
=
Encode::
encode_utf8
$tab_mms_id_url
{
$c
};
print
"
--->Creation du portfolio
$url
pour le mms_id
$mms_id
:
\n
";
print
"
--->Creation du portfolio
$url
pour le mms_id
$mms_id
:
\n
";
$portfolio_a_creer
=
$bloc_modele_portfolio
;
$portfolio_a_creer
=
$bloc_modele_portfolio
;
$portfolio_a_creer
=~
s/\[MMS_ID\]/$mms_id/g
;
$portfolio_a_creer
=~
s/\[MMS_ID\]/$mms_id/g
;
$portfolio_a_creer
=~
s/\[URL\]/$url/g
;
$portfolio_a_creer
=~
s/\[URL\]/$url/g
;
$portfolio_a_creer
=~
s/\[NOTE_PUBLIC\]/$note_public/g
;
#ajout note public
#print "\n$portfolio_a_creer\n";
#print "\n$portfolio_a_creer\n";
$block_xml
=
post_create_portfolio_mms_id
(
$mms_id
,
$portfolio_a_creer
);
$block_xml
=
post_create_portfolio_mms_id
(
$mms_id
,
$portfolio_a_creer
);
print
$block_xml
,"
\n
";
print
$block_xml
,"
\n
";
...
...
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