Loading bin/run-envoi-step-star.sh 0 → 100755 +43 −0 Original line number Diff line number Diff line #!/usr/bin/env bash ############################################################################################# # Script de lancement de l'envoi vers STEP/STAR pour un établissement. ############################################################################################# # # Variables d'env attendues : # ETAB : Code de l'établissement à traiter (ex: "UCN"). OBLIGATOIRE. # usage() { cat << EOF Script de lancement de l'envoi vers STEP/STAR pour un établissement. Usage: ETAB=<etab> $0 EOF exit 0; } echo "Etablissement : $ETAB" [[ -z "$ETAB" ]] && usage CURR_DIR=$(cd `dirname $0` && pwd) APP_DIR=$(cd ${CURR_DIR}/.. && pwd) echo "Répertoire courant : $CURR_DIR" echo "Répertoire de l'appli : $APP_DIR" # Avorte si le script est déjà en cours d'exécution (avec les mêmes arguments) LOCK_FILE=/run/$(basename $0)_${ETAB}.lock echo "Lock file : $LOCK_FILE" exec 200>$LOCK_FILE flock -n 200 if [ $? -eq 1 ]; then echo "Script $(realpath $0) déjà en cours d'exécution ($LOCK_FILE). Stop !" exit 1 fi echo TAG="cron-${ETAB}-$(date +%Y%m%d_%H%M%S)" /usr/bin/php ${APP_DIR}/public/index.php step-star:envoyer-theses --etat S --etablissement ${ETAB} --tag ${TAG} --date-soutenance-min P1M /usr/bin/php ${APP_DIR}/public/index.php step-star:envoyer-theses --etat E --etablissement ${ETAB} --tag ${TAG} module/Application/src/Application/Search/Filter/StrReducedTextSearchFilter.php +13 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,12 @@ class StrReducedTextSearchFilter extends TextSearchFilter protected function applyToQueryBuilderUsingWhereField(QueryBuilder $qb) { $qb ->andWhere(sprintf("strReduce(%s) %s strReduce(:%s)", $this->whereField, $this->getOperator(), $paramName = uniqid('p'))) ->andWhere(sprintf( "strReduce(%s) %s strReduce(:%s)", $this->whereField, $this->getOperator(), $paramName = uniqid('p') )) ->setParameter($paramName, $this->getComparisonValue()); } Loading @@ -17,7 +22,13 @@ class StrReducedTextSearchFilter extends TextSearchFilter { $alias = current($qb->getRootAliases()); $qb ->andWhere(sprintf("strReduce(%s.%s) %s strReduce(:%s)", $alias, $this->getName(), $this->getOperator(), $paramName = uniqid('p'))) ->andWhere(sprintf( "strReduce(%s.%s) %s strReduce(:%s)", $alias, $this->getName(), $this->getOperator(), $paramName = uniqid('p') )) ->setParameter($paramName, $this->getComparisonValue()); } } module/Application/src/Application/Search/Filter/TextSearchFilter.php +14 −3 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use Doctrine\ORM\QueryBuilder; class TextSearchFilter extends SearchFilter { protected bool $useLikeOperator = false; protected string $likeOperator = 'LIKE'; /** * @param bool $useLikeOperator Loading @@ -23,9 +24,19 @@ class TextSearchFilter extends SearchFilter return $this; } /** * @param string $likeOperator * @return self */ public function setLikeOperator(string $likeOperator): self { $this->likeOperator = $likeOperator; return $this; } protected function canApplyToQueryBuilder(): bool { $filterValue = $this->getValue(); $filterValue = trim($this->getValue()); return $filterValue !== null && strlen($filterValue) > 1; } Loading @@ -47,12 +58,12 @@ class TextSearchFilter extends SearchFilter protected function getOperator(): string { return $this->useLikeOperator ? 'LIKE' : '='; return $this->useLikeOperator ? $this->likeOperator : '='; } public function getComparisonValue(): string { $filterValue = $this->getValue(); $filterValue = trim($this->getValue()); return $this->useLikeOperator ? "%$filterValue%" : $filterValue; } Loading module/Application/src/Application/Search/SearchService.php +1 −1 Original line number Diff line number Diff line Loading @@ -335,7 +335,7 @@ abstract class SearchService implements SearchServiceInterface $qb = $this->createQueryBuilder(); foreach ($this->filters as $filter) { if ($filter->getValue()) { if ($filter->getValue() !== null) { $filter->applyToQueryBuilder($qb); } } Loading module/Doctorant/src/Doctorant/Search/DoctorantSearchFilter.php +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ namespace Doctorant\Search; use Application\Search\Filter\TextSearchFilter; use Doctrine\ORM\QueryBuilder; class DoctorantSearchFilter extends TextSearchFilter class DoctorantSearchFilter extends TextSearchFilter // todo : hériter de StrReducedTextSearchFilter { const NAME = 'doctorant'; Loading Loading
bin/run-envoi-step-star.sh 0 → 100755 +43 −0 Original line number Diff line number Diff line #!/usr/bin/env bash ############################################################################################# # Script de lancement de l'envoi vers STEP/STAR pour un établissement. ############################################################################################# # # Variables d'env attendues : # ETAB : Code de l'établissement à traiter (ex: "UCN"). OBLIGATOIRE. # usage() { cat << EOF Script de lancement de l'envoi vers STEP/STAR pour un établissement. Usage: ETAB=<etab> $0 EOF exit 0; } echo "Etablissement : $ETAB" [[ -z "$ETAB" ]] && usage CURR_DIR=$(cd `dirname $0` && pwd) APP_DIR=$(cd ${CURR_DIR}/.. && pwd) echo "Répertoire courant : $CURR_DIR" echo "Répertoire de l'appli : $APP_DIR" # Avorte si le script est déjà en cours d'exécution (avec les mêmes arguments) LOCK_FILE=/run/$(basename $0)_${ETAB}.lock echo "Lock file : $LOCK_FILE" exec 200>$LOCK_FILE flock -n 200 if [ $? -eq 1 ]; then echo "Script $(realpath $0) déjà en cours d'exécution ($LOCK_FILE). Stop !" exit 1 fi echo TAG="cron-${ETAB}-$(date +%Y%m%d_%H%M%S)" /usr/bin/php ${APP_DIR}/public/index.php step-star:envoyer-theses --etat S --etablissement ${ETAB} --tag ${TAG} --date-soutenance-min P1M /usr/bin/php ${APP_DIR}/public/index.php step-star:envoyer-theses --etat E --etablissement ${ETAB} --tag ${TAG}
module/Application/src/Application/Search/Filter/StrReducedTextSearchFilter.php +13 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,12 @@ class StrReducedTextSearchFilter extends TextSearchFilter protected function applyToQueryBuilderUsingWhereField(QueryBuilder $qb) { $qb ->andWhere(sprintf("strReduce(%s) %s strReduce(:%s)", $this->whereField, $this->getOperator(), $paramName = uniqid('p'))) ->andWhere(sprintf( "strReduce(%s) %s strReduce(:%s)", $this->whereField, $this->getOperator(), $paramName = uniqid('p') )) ->setParameter($paramName, $this->getComparisonValue()); } Loading @@ -17,7 +22,13 @@ class StrReducedTextSearchFilter extends TextSearchFilter { $alias = current($qb->getRootAliases()); $qb ->andWhere(sprintf("strReduce(%s.%s) %s strReduce(:%s)", $alias, $this->getName(), $this->getOperator(), $paramName = uniqid('p'))) ->andWhere(sprintf( "strReduce(%s.%s) %s strReduce(:%s)", $alias, $this->getName(), $this->getOperator(), $paramName = uniqid('p') )) ->setParameter($paramName, $this->getComparisonValue()); } }
module/Application/src/Application/Search/Filter/TextSearchFilter.php +14 −3 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use Doctrine\ORM\QueryBuilder; class TextSearchFilter extends SearchFilter { protected bool $useLikeOperator = false; protected string $likeOperator = 'LIKE'; /** * @param bool $useLikeOperator Loading @@ -23,9 +24,19 @@ class TextSearchFilter extends SearchFilter return $this; } /** * @param string $likeOperator * @return self */ public function setLikeOperator(string $likeOperator): self { $this->likeOperator = $likeOperator; return $this; } protected function canApplyToQueryBuilder(): bool { $filterValue = $this->getValue(); $filterValue = trim($this->getValue()); return $filterValue !== null && strlen($filterValue) > 1; } Loading @@ -47,12 +58,12 @@ class TextSearchFilter extends SearchFilter protected function getOperator(): string { return $this->useLikeOperator ? 'LIKE' : '='; return $this->useLikeOperator ? $this->likeOperator : '='; } public function getComparisonValue(): string { $filterValue = $this->getValue(); $filterValue = trim($this->getValue()); return $this->useLikeOperator ? "%$filterValue%" : $filterValue; } Loading
module/Application/src/Application/Search/SearchService.php +1 −1 Original line number Diff line number Diff line Loading @@ -335,7 +335,7 @@ abstract class SearchService implements SearchServiceInterface $qb = $this->createQueryBuilder(); foreach ($this->filters as $filter) { if ($filter->getValue()) { if ($filter->getValue() !== null) { $filter->applyToQueryBuilder($qb); } } Loading
module/Doctorant/src/Doctorant/Search/DoctorantSearchFilter.php +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ namespace Doctorant\Search; use Application\Search\Filter\TextSearchFilter; use Doctrine\ORM\QueryBuilder; class DoctorantSearchFilter extends TextSearchFilter class DoctorantSearchFilter extends TextSearchFilter // todo : hériter de StrReducedTextSearchFilter { const NAME = 'doctorant'; Loading